Revision: 200948
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 23 Nov 2009 14:47:47 +0200
changeset 0 ed9695c8bcbe
child 1 4fbbce2c82ba
Revision: 200948
group/bld.inf
layers.sysdef.xml
package_definition.xml
sysdef_1_4_0.dtd
videotelephony_plat/group/bld.inf
videotelephony_plat/video_telephony_control_mediator_api/group/bld.inf
videotelephony_plat/video_telephony_control_mediator_api/inc/videotelcontrolmediatorapi.h
videotelephony_plat/video_telephony_control_mediator_api/video_telephony_control_mediator_api.metaxml
videotelephony_plat/video_telephony_media_configuration_api/group/bld.inf
videotelephony_plat/video_telephony_media_configuration_api/inc/VideoTelephonyDomainPSKeys.h
videotelephony_plat/video_telephony_media_configuration_api/video_telephony_media_configuration_api.metaxml
vtengines/group/bld.inf
vtengines/videoteleng/Bmarm/VIDEOTELENGU.DEF
vtengines/videoteleng/CallCtrl/Bmarm/CSCALLCTRLU.DEF
vtengines/videoteleng/CallCtrl/Bwins/CSCALLCTRLU.DEF
vtengines/videoteleng/CallCtrl/EABI/CSCallCtrlU.DEF
vtengines/videoteleng/CallCtrl/Group/bld.inf
vtengines/videoteleng/CallCtrl/Group/videocallctrl.mmp
vtengines/videoteleng/CallCtrl/Inc/CVtCtlCallControl.h
vtengines/videoteleng/CallCtrl/Inc/CVtCtlCallStatusMonitor.h
vtengines/videoteleng/CallCtrl/Inc/CVtCtlFactory.h
vtengines/videoteleng/CallCtrl/Inc/CVtCtlLineMonitor.h
vtengines/videoteleng/CallCtrl/Inc/CVtCtlSessionContainer.h
vtengines/videoteleng/CallCtrl/Inc/CVtCtlVideoCall.h
vtengines/videoteleng/CallCtrl/Inc/MVtCtlCallControl.h
vtengines/videoteleng/CallCtrl/Inc/MVtCtlCallStatusObserver.h
vtengines/videoteleng/CallCtrl/Inc/MVtCtlCommandObserver.h
vtengines/videoteleng/CallCtrl/Inc/MVtCtlEventObserver.h
vtengines/videoteleng/CallCtrl/Inc/MVtCtlLineEventObserver.h
vtengines/videoteleng/CallCtrl/Inc/TVtCtlType.h
vtengines/videoteleng/CallCtrl/Inc/TVtCtlType.inl
vtengines/videoteleng/CallCtrl/Inc/VtCtlConfig.hrh
vtengines/videoteleng/CallCtrl/Inc/VtCtlDefs.h
vtengines/videoteleng/CallCtrl/Inc/VtCtlEvents.h
vtengines/videoteleng/CallCtrl/Inc/VtCtlPanic.h
vtengines/videoteleng/CallCtrl/Inc/VtCtlTypes.h
vtengines/videoteleng/CallCtrl/Inc/VtCtlTypes.inl
vtengines/videoteleng/CallCtrl/Src/CVtCtlCallControl.cpp
vtengines/videoteleng/CallCtrl/Src/CVtCtlCallControlStub.cpp
vtengines/videoteleng/CallCtrl/Src/CVtCtlCallStatusMonitor.cpp
vtengines/videoteleng/CallCtrl/Src/CVtCtlFactory.cpp
vtengines/videoteleng/CallCtrl/Src/CVtCtlLineMonitor.cpp
vtengines/videoteleng/CallCtrl/Src/CVtCtlSessionContainer.cpp
vtengines/videoteleng/CallCtrl/Src/CVtCtlVideoCall.cpp
vtengines/videoteleng/CallCtrl/Src/VtCtlPanic.cpp
vtengines/videoteleng/EABI/videotelengU.DEF
vtengines/videoteleng/Group/bld.inf
vtengines/videoteleng/Group/videoteleng.mmp
vtengines/videoteleng/Inc/Audio/CVtEngAudioHandler.h
vtengines/videoteleng/Inc/Audio/MVtEngAudio.h
vtengines/videoteleng/Inc/Base/CVTEngPubSubsListener.h
vtengines/videoteleng/Inc/Base/CVtEngAccessoryHandler.h
vtengines/videoteleng/Inc/Base/CVtEngCRObserverItem.h
vtengines/videoteleng/Inc/Base/CVtEngCRProxy.h
vtengines/videoteleng/Inc/Base/CVtEngDeviceLockMonitor.h
vtengines/videoteleng/Inc/Base/CVtEngEventManager.h
vtengines/videoteleng/Inc/Base/CVtEngHandlerContainer.h
vtengines/videoteleng/Inc/Base/CVtEngHandlerContainer.inl
vtengines/videoteleng/Inc/Base/CVtEngInitializer.h
vtengines/videoteleng/Inc/Base/CVtEngModel.h
vtengines/videoteleng/Inc/Base/CVtEngSATClient.h
vtengines/videoteleng/Inc/Base/CVtEngSettings.h
vtengines/videoteleng/Inc/Base/CVtEngSettings.inl
vtengines/videoteleng/Inc/Base/MVtEngAccessoryObserver.h
vtengines/videoteleng/Inc/Base/MVtEngCRSettingObserver.h
vtengines/videoteleng/Inc/Base/MVtEngEventObserver.h
vtengines/videoteleng/Inc/Base/MVtEngSettingObserver.h
vtengines/videoteleng/Inc/Base/MVtEngSettingPSObserver.h
vtengines/videoteleng/Inc/Base/TVtEngType.h
vtengines/videoteleng/Inc/Base/TVtEngType.inl
vtengines/videoteleng/Inc/Base/VtEngConstants.h
vtengines/videoteleng/Inc/Base/VtEngDefs.hrh
vtengines/videoteleng/Inc/Base/VtEngEvents.h
vtengines/videoteleng/Inc/Base/VtEngPanic.h
vtengines/videoteleng/Inc/Base/VtEngUtils.h
vtengines/videoteleng/Inc/Base/VtEngUtils.inl
vtengines/videoteleng/Inc/Base/cvtengincomingcallmonitor.h
vtengines/videoteleng/Inc/Base/cvtengmdtrcommandsender.h
vtengines/videoteleng/Inc/Base/cvtengmdtrmessagelistener.h
vtengines/videoteleng/Inc/Base/cvtengmediatorservice.h
vtengines/videoteleng/Inc/Commands/CVtEngCommandHandler.h
vtengines/videoteleng/Inc/Commands/CVtEngOperation.h
vtengines/videoteleng/Inc/Commands/CVtEngOperation.inl
vtengines/videoteleng/Inc/Commands/MVtEngCommandHandler.h
vtengines/videoteleng/Inc/Commands/MVtEngCommandObserver.h
vtengines/videoteleng/Inc/Commands/TVtEngOperationUtils.h
vtengines/videoteleng/Inc/Commands/cvtenginternaloperation.h
vtengines/videoteleng/Inc/Commands/mvtengoperationobserver.h
vtengines/videoteleng/Inc/Commands/vtengcommands.h
vtengines/videoteleng/Inc/Extensions/CVtEngCameraPreferences.h
vtengines/videoteleng/Inc/Extensions/CVtEngExtensionBase.h
vtengines/videoteleng/Inc/Extensions/CVtEngExtensions.h
vtengines/videoteleng/Inc/Extensions/MVtEngCameraPreferences.h
vtengines/videoteleng/Inc/Extensions/cvtengr2ftoneplayer.h
vtengines/videoteleng/Inc/Extensions/cvtengrecord2file.h
vtengines/videoteleng/Inc/Extensions/mvtengcamerapreferencesobserver.h
vtengines/videoteleng/Inc/Extensions/mvtengrecord2file.h
vtengines/videoteleng/Inc/Media/CVtEngDrawDP.h
vtengines/videoteleng/Inc/Media/CVtEngDrawDSA.h
vtengines/videoteleng/Inc/Media/CVtEngDrawNGA.h
vtengines/videoteleng/Inc/Media/CVtEngDtmfHandler.h
vtengines/videoteleng/Inc/Media/CVtEngImageScaler.h
vtengines/videoteleng/Inc/Media/CVtEngLocalVideo.h
vtengines/videoteleng/Inc/Media/CVtEngMediaHandler.h
vtengines/videoteleng/Inc/Media/CVtEngRemoteVideo.h
vtengines/videoteleng/Inc/Media/MVtEngDraw.h
vtengines/videoteleng/Inc/Media/MVtEngFrameObserver.h
vtengines/videoteleng/Inc/Media/MVtEngImageScaler.h
vtengines/videoteleng/Inc/Media/MVtEngMedia.h
vtengines/videoteleng/Inc/Media/TVtEngRenderConfig.h
vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDP.h
vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDP.inl
vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDSA.h
vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDSA.inl
vtengines/videoteleng/Inc/Media/TVtEngRenderConfigNGA.h
vtengines/videoteleng/Inc/Media/TVtEngRenderConfigNGA.inl
vtengines/videoteleng/Inc/Media/TVtEngRendering.h
vtengines/videoteleng/Inc/Media/TVtEngRendering.inl
vtengines/videoteleng/Inc/Media/TVtEngRenderingDP.h
vtengines/videoteleng/Inc/Media/TVtEngRenderingDP.inl
vtengines/videoteleng/Inc/Media/TVtEngRenderingDSA.h
vtengines/videoteleng/Inc/Media/TVtEngRenderingDSA.inl
vtengines/videoteleng/Inc/Media/TVtEngRenderingNGA.h
vtengines/videoteleng/Inc/Media/TVtEngRenderingNGA.inl
vtengines/videoteleng/Inc/Session/CVtEngSessionHandler.h
vtengines/videoteleng/Inc/Session/MVtEngDtmfHandler.h
vtengines/videoteleng/Inc/Session/MVtEngSessionInfo.h
vtengines/videoteleng/Inc/Session/TVtEngDtmfTone.h
vtengines/videoteleng/Inc/Session/TVtEngDtmfTone.inl
vtengines/videoteleng/Inc/State/CVtEngDtmfState.h
vtengines/videoteleng/Inc/State/CVtEngStateAlerting.h
vtengines/videoteleng/Inc/State/CVtEngStateBase.h
vtengines/videoteleng/Inc/State/CVtEngStateClearing.h
vtengines/videoteleng/Inc/State/CVtEngStateConnected.h
vtengines/videoteleng/Inc/State/CVtEngStateIdle.h
vtengines/videoteleng/Inc/State/CVtEngStateInitializing.h
vtengines/videoteleng/Inc/State/CVtEngStateManager.h
vtengines/videoteleng/Inc/State/CVtEngStateManager.inl
vtengines/videoteleng/Inc/State/CVtEngStateNegotiating.h
vtengines/videoteleng/Inc/State/CVtEngStateOpen.h
vtengines/videoteleng/Inc/State/CVtEngStateRinging.h
vtengines/videoteleng/Logger/Bmarm/VTLOGGERU.DEF
vtengines/videoteleng/Logger/Bwins/VTLOGGERU.DEF
vtengines/videoteleng/Logger/EABI/vtloggerU.DEF
vtengines/videoteleng/Logger/Group/bld.inf
vtengines/videoteleng/Logger/Group/vtlogger.mmp
vtengines/videoteleng/Logger/Inc/cvtlogger.h
vtengines/videoteleng/Logger/Inc/vtlogger.hrh
vtengines/videoteleng/Logger/Src/CVtLogger.cpp
vtengines/videoteleng/Logger/Src/CVtLoggerStub.cpp
vtengines/videoteleng/Rom/videoteleng.iby
vtengines/videoteleng/Src/Audio/CVtEngAudioHandler.cpp
vtengines/videoteleng/Src/Base/CVtEngAccessoryHandler.cpp
vtengines/videoteleng/Src/Base/CVtEngCRObserverItem.cpp
vtengines/videoteleng/Src/Base/CVtEngCRProxy.cpp
vtengines/videoteleng/Src/Base/CVtEngDeviceLockMonitor.cpp
vtengines/videoteleng/Src/Base/CVtEngEventManager.cpp
vtengines/videoteleng/Src/Base/CVtEngHandlerContainer.cpp
vtengines/videoteleng/Src/Base/CVtEngInitializer.cpp
vtengines/videoteleng/Src/Base/CVtEngModel.cpp
vtengines/videoteleng/Src/Base/CVtEngPubSubsListener.cpp
vtengines/videoteleng/Src/Base/CVtEngSATClient.cpp
vtengines/videoteleng/Src/Base/CVtEngSettings.cpp
vtengines/videoteleng/Src/Base/VtEngUtils.cpp
vtengines/videoteleng/Src/Base/cvtengincomingcallmonitor.cpp
vtengines/videoteleng/Src/Base/cvtengmdtrcommandsender.cpp
vtengines/videoteleng/Src/Base/cvtengmdtrmessagelistener.cpp
vtengines/videoteleng/Src/Base/cvtengmediatorservice.cpp
vtengines/videoteleng/Src/Commands/CVtEngCommandHandler.cpp
vtengines/videoteleng/Src/Commands/CVtEngOperation.cpp
vtengines/videoteleng/Src/Commands/TVtEngOperationUtils.cpp
vtengines/videoteleng/Src/Commands/cvtenginternaloperation.cpp
vtengines/videoteleng/Src/Extensions/CVtEngCameraPreferences.cpp
vtengines/videoteleng/Src/Extensions/CVtEngExtensionBase.cpp
vtengines/videoteleng/Src/Extensions/CVtEngExtensions.cpp
vtengines/videoteleng/Src/Extensions/cvtengr2ftoneplayer.cpp
vtengines/videoteleng/Src/Extensions/cvtengrecord2file.cpp
vtengines/videoteleng/Src/Media/CVtEngDrawDP.cpp
vtengines/videoteleng/Src/Media/CVtEngDrawDSA.cpp
vtengines/videoteleng/Src/Media/CVtEngDrawNGA.cpp
vtengines/videoteleng/Src/Media/CVtEngDtmfHandler.cpp
vtengines/videoteleng/Src/Media/CVtEngImageScaler.cpp
vtengines/videoteleng/Src/Media/CVtEngLocalVideo.cpp
vtengines/videoteleng/Src/Media/CVtEngMediaHandler.cpp
vtengines/videoteleng/Src/Media/CVtEngRemoteVideo.cpp
vtengines/videoteleng/Src/Session/CVtEngSessionHandler.cpp
vtengines/videoteleng/Src/State/CVtEngDtmfBuffered.cpp
vtengines/videoteleng/Src/State/CVtEngDtmfIdle.cpp
vtengines/videoteleng/Src/State/CVtEngDtmfSending.cpp
vtengines/videoteleng/Src/State/CVtEngDtmfState.cpp
vtengines/videoteleng/Src/State/CVtEngStateAlerting.cpp
vtengines/videoteleng/Src/State/CVtEngStateBase.cpp
vtengines/videoteleng/Src/State/CVtEngStateClearing.cpp
vtengines/videoteleng/Src/State/CVtEngStateConnected.cpp
vtengines/videoteleng/Src/State/CVtEngStateIdle.cpp
vtengines/videoteleng/Src/State/CVtEngStateInitializing.cpp
vtengines/videoteleng/Src/State/CVtEngStateManager.cpp
vtengines/videoteleng/Src/State/CVtEngStateNegotiating.cpp
vtengines/videoteleng/Src/State/CVtEngStateOpen.cpp
vtengines/videoteleng/Src/State/CVtEngStateRinging.cpp
vtengines/videoteleng/bwins/VIDEOTELENGU.DEF
vtengines/videoteleng/data/videoteleng_stub.SIS
vtengines/videoteleng/data/videoteleng_stub.pkg
vtengines/vtmediatorplugin/data/vtmediatorplugin.pkg
vtengines/vtmediatorplugin/data/vtmediatorplugin.rss
vtengines/vtmediatorplugin/data/vtmediatorplugin.sis
vtengines/vtmediatorplugin/data/vtmediatorplugin_stub.pkg
vtengines/vtmediatorplugin/data/vtmediatorplugin_stub.sis
vtengines/vtmediatorplugin/group/bld.inf
vtengines/vtmediatorplugin/group/vtmediatorplugin.mmp
vtengines/vtmediatorplugin/inc/cvtmediatorplugin.h
vtengines/vtmediatorplugin/inc/vtinternalmediatorapi.h
vtengines/vtmediatorplugin/rom/vtmediatorplugin.iby
vtengines/vtmediatorplugin/src/cvtmediatorplugin.cpp
vtengines/vtmediatorplugin/src/vtmediatorpluginproxy.cpp
vtprotocolplugins/DisplaySink/EABI/DisplaySinkU.DEF
vtprotocolplugins/DisplaySink/EABI/VtImageConverterU.DEF
vtprotocolplugins/DisplaySink/EABI/VtImageTransformsU.DEF
vtprotocolplugins/DisplaySink/bmarm/DISPLAYSINKU.DEF
vtprotocolplugins/DisplaySink/bmarm/VTIMAGECONVERTERU.DEF
vtprotocolplugins/DisplaySink/bmarm/VTIMAGETRANSFORMSU.DEF
vtprotocolplugins/DisplaySink/bwins/DISPLAYSINKU.DEF
vtprotocolplugins/DisplaySink/bwins/VTIMAGECONVERTERU.DEF
vtprotocolplugins/DisplaySink/bwins/VTIMAGETRANSFORMSU.DEF
vtprotocolplugins/DisplaySink/data/displaysink_stub.SIS
vtprotocolplugins/DisplaySink/data/displaysink_stub.pkg
vtprotocolplugins/DisplaySink/group/DisplaySink.mmp
vtprotocolplugins/DisplaySink/group/VtImageConverter.mmp
vtprotocolplugins/DisplaySink/group/VtImageTransforms.mmp
vtprotocolplugins/DisplaySink/group/bld.inf
vtprotocolplugins/DisplaySink/inc/CDisplaySink.h
vtprotocolplugins/DisplaySink/inc/CDisplaySinkDP.h
vtprotocolplugins/DisplaySink/inc/CDisplaySinkDSA.h
vtprotocolplugins/DisplaySink/inc/CDisplaySinkNGA.h
vtprotocolplugins/DisplaySink/inc/CVtImageBitmap.h
vtprotocolplugins/DisplaySink/inc/CVtImageConverter.h
vtprotocolplugins/DisplaySink/inc/CVtImageIYUV.h
vtprotocolplugins/DisplaySink/inc/CVtImageRotatorImpl.h
vtprotocolplugins/DisplaySink/inc/CVtImageRotatorImplClockwise.h
vtprotocolplugins/DisplaySink/inc/CVtImageRotatorImplMirrorFlip.h
vtprotocolplugins/DisplaySink/inc/CVtImageScaler.h
vtprotocolplugins/DisplaySink/inc/CVtImageScalerImpl.h
vtprotocolplugins/DisplaySink/inc/CVtImageScalerImplBilinear.h
vtprotocolplugins/DisplaySink/inc/CVtImageScalerImplNearest.h
vtprotocolplugins/DisplaySink/inc/CVtImageScalerImplWeightedAverage.h
vtprotocolplugins/DisplaySink/inc/CVtImageScalerMacros.h
vtprotocolplugins/DisplaySink/inc/CVtImageTransformsUids.hrh
vtprotocolplugins/DisplaySink/inc/DisplaySinkUids.hrh
vtprotocolplugins/DisplaySink/inc/TDisplaySinkParamsDP.h
vtprotocolplugins/DisplaySink/inc/TDisplaySinkParamsDSA.h
vtprotocolplugins/DisplaySink/inc/TDisplaySinkParamsNGA.h
vtprotocolplugins/DisplaySink/inc/VtImageConverterUids.hrh
vtprotocolplugins/DisplaySink/inc/cvtimage.h
vtprotocolplugins/DisplaySink/inc/cvtimageconverter.inl
vtprotocolplugins/DisplaySink/inc/cvtimagerotator.h
vtprotocolplugins/DisplaySink/inc/mdisplaysink.h
vtprotocolplugins/DisplaySink/inc/tdisplaysinkparamsdsa.inl
vtprotocolplugins/DisplaySink/inc/vtyuvconverter.h
vtprotocolplugins/DisplaySink/rom/DisplaySink.iby
vtprotocolplugins/DisplaySink/src/CDisplaySink.cpp
vtprotocolplugins/DisplaySink/src/CDisplaySinkDP.cpp
vtprotocolplugins/DisplaySink/src/CDisplaySinkDSA.cpp
vtprotocolplugins/DisplaySink/src/CDisplaySinkNGA.cpp
vtprotocolplugins/DisplaySink/src/CVtImage.cpp
vtprotocolplugins/DisplaySink/src/CVtImageBitmap.cpp
vtprotocolplugins/DisplaySink/src/CVtImageConverter.cpp
vtprotocolplugins/DisplaySink/src/CVtImageIYUV.cpp
vtprotocolplugins/DisplaySink/src/CVtImageRotator.cpp
vtprotocolplugins/DisplaySink/src/CVtImageRotatorImpl.cpp
vtprotocolplugins/DisplaySink/src/CVtImageRotatorImplClockwise.cpp
vtprotocolplugins/DisplaySink/src/CVtImageRotatorImplMirrorFlip.cpp
vtprotocolplugins/DisplaySink/src/CVtImageScaler.cpp
vtprotocolplugins/DisplaySink/src/CVtImageScalerImpl.cpp
vtprotocolplugins/DisplaySink/src/CVtImageScalerImplBilinear.cpp
vtprotocolplugins/DisplaySink/src/CVtImageScalerImplNearest.cpp
vtprotocolplugins/DisplaySink/src/CVtImageScalerImplWeightedAverage.cpp
vtprotocolplugins/DisplaySink/src/vtyuvconverter.cpp
vtprotocolplugins/VideoSource/EABI/VideoSourceU.DEF
vtprotocolplugins/VideoSource/bmarm/VIDEOSOURCEU.DEF
vtprotocolplugins/VideoSource/bwins/VIDEOSOURCEU.DEF
vtprotocolplugins/VideoSource/data/videosource_stub.SIS
vtprotocolplugins/VideoSource/data/videosource_stub.pkg
vtprotocolplugins/VideoSource/group/CApiVideoSource.mmp
vtprotocolplugins/VideoSource/group/bld.inf
vtprotocolplugins/VideoSource/inc/CApiVideoSource.h
vtprotocolplugins/VideoSource/inc/CVSCameraDataProvider.h
vtprotocolplugins/VideoSource/inc/CVSCameraDataProvider.inl
vtprotocolplugins/VideoSource/inc/CVSControllerImp.h
vtprotocolplugins/VideoSource/inc/CVSDataSourceImp.h
vtprotocolplugins/VideoSource/inc/CVSMMFDataBuffer.h
vtprotocolplugins/VideoSource/inc/CVSOnboardCameraDataProvider.h
vtprotocolplugins/VideoSource/inc/CVSStillImageDataProvider.h
vtprotocolplugins/VideoSource/inc/VSPanic.h
vtprotocolplugins/VideoSource/inc/VideoSourceUids.hrh
vtprotocolplugins/VideoSource/inc/cactivewait.h
vtprotocolplugins/VideoSource/inc/cactivewait.inl
vtprotocolplugins/VideoSource/inc/capivideosource.inl
vtprotocolplugins/VideoSource/inc/cmultiframedataao.h
vtprotocolplugins/VideoSource/inc/cmultiframeloopao.h
vtprotocolplugins/VideoSource/inc/cmultiframeprovider.h
vtprotocolplugins/VideoSource/inc/mmultiframeprovider.h
vtprotocolplugins/VideoSource/rom/VideoSource.iby
vtprotocolplugins/VideoSource/src/CVSCameraDataProvider.cpp
vtprotocolplugins/VideoSource/src/CVSController.cpp
vtprotocolplugins/VideoSource/src/CVSControllerImp.cpp
vtprotocolplugins/VideoSource/src/CVSDataProvider.cpp
vtprotocolplugins/VideoSource/src/CVSDataSourceImp.cpp
vtprotocolplugins/VideoSource/src/CVSMMFDataBuffer.cpp
vtprotocolplugins/VideoSource/src/CVSOnboardCameraDataProvider.cpp
vtprotocolplugins/VideoSource/src/CVSStillImageDataProvider.cpp
vtprotocolplugins/VideoSource/src/cactivewait.cpp
vtprotocolplugins/VideoSource/src/cmultiframedataao.cpp
vtprotocolplugins/VideoSource/src/cmultiframeloopao.cpp
vtprotocolplugins/VideoSource/src/cmultiframeprovider.cpp
vtprotocolplugins/group/bld.inf
vtprotocols/bwins/videotelprotou.def
vtprotocols/eabi/videotelprotou.def
vtprotocols/group/bld.inf
vtprotocols/group/videotelproto.mmp
vtprotocols/inc/caudioconfighandler.h
vtprotocols/inc/ccommserver.h
vtprotocols/inc/cdatasinkproxy.h
vtprotocols/inc/cdatasourceproxy.h
vtprotocols/inc/ch324confighandler.h
vtprotocols/inc/csessionhandler.h
vtprotocols/inc/cvideoconfighandler.h
vtprotocols/inc/cvtuserinput.h
vtprotocols/inc/mvtprotocolhandler.h
vtprotocols/src/caudioconfighandler.cpp
vtprotocols/src/cdatasinkproxy.cpp
vtprotocols/src/cdatasourceproxy.cpp
vtprotocols/src/ch324confighandler.cpp
vtprotocols/src/csessionhandler.cpp
vtprotocols/src/cvideoconfighandler.cpp
vtprotocols/src/cvtuserinput.cpp
vtprotocols/src/vtprotocolfactory.cpp
vtprotocolsstub/bwins/videotelprotou.def
vtprotocolsstub/eabi/videotelprotou.def
vtprotocolsstub/group/bld.inf
vtprotocolsstub/group/videotelproto.mmp
vtprotocolsstub/inc/caudioconfighandler.h
vtprotocolsstub/inc/ccommserver.h
vtprotocolsstub/inc/cdatasinkproxy.h
vtprotocolsstub/inc/cdatasourceproxy.h
vtprotocolsstub/inc/ch324confighandler.h
vtprotocolsstub/inc/csessionhandler.h
vtprotocolsstub/inc/cvideoconfighandler.h
vtprotocolsstub/inc/cvtuserinput.h
vtprotocolsstub/inc/mvtprotocolhandler.h
vtprotocolsstub/src/caudioconfighandler.cpp
vtprotocolsstub/src/cdatasinkproxy.cpp
vtprotocolsstub/src/cdatasourceproxy.cpp
vtprotocolsstub/src/ch324confighandler.cpp
vtprotocolsstub/src/csessionhandler.cpp
vtprotocolsstub/src/cvideoconfighandler.cpp
vtprotocolsstub/src/cvtuserinput.cpp
vtprotocolsstub/src/vtprotocolfactory.cpp
vtuis/group/bld.inf
vtuis/videotelui/aif/videoteluiaif.rss
vtuis/videotelui/cenrep/keys_s60videotelephony.xls
vtuis/videotelui/conf/s60videotelephony.confml
vtuis/videotelui/conf/s60videotelephony_102072D0.crml
vtuis/videotelui/conf/s60videotelephony_10281872.crml
vtuis/videotelui/data/VtStartRecord.wav
vtuis/videotelui/data/VtStopRecord.wav
vtuis/videotelui/data/videotelui.rss
vtuis/videotelui/data/videotelui_caption.rss
vtuis/videotelui/data/videotelui_reg.rss
vtuis/videotelui/data/videotelui_stub.SIS
vtuis/videotelui/data/videotelui_stub.pkg
vtuis/videotelui/group/bld.inf
vtuis/videotelui/group/videotelui.mmp
vtuis/videotelui/group/videotelui_icons.mk
vtuis/videotelui/group/videotelui_icons_aif_bitmaps.mk
vtuis/videotelui/group/videotelui_icons_aif_bitmaps_dc.mk
vtuis/videotelui/group/videotelui_icons_aif_scalable.mk
vtuis/videotelui/group/videotelui_icons_aif_scalable_dc.mk
vtuis/videotelui/group/videotelui_icons_dc.mk
vtuis/videotelui/inc/CVtUiActivateBtHfDialog.h
vtuis/videotelui/inc/CVtUiActiveExec.h
vtuis/videotelui/inc/CVtUiAllowVideoDialog.h
vtuis/videotelui/inc/CVtUiApp.h
vtuis/videotelui/inc/CVtUiAppUi.h
vtuis/videotelui/inc/CVtUiBitmapManager.h
vtuis/videotelui/inc/CVtUiBlankControl.h
vtuis/videotelui/inc/CVtUiBlankDialog.h
vtuis/videotelui/inc/CVtUiContextControl.h
vtuis/videotelui/inc/CVtUiDoc.h
vtuis/videotelui/inc/CVtUiExecuteCmdDialog.h
vtuis/videotelui/inc/CVtUiMainControl.h
vtuis/videotelui/inc/CVtUiMutedControl.h
vtuis/videotelui/inc/CVtUiNaviPane.h
vtuis/videotelui/inc/CVtUiNaviPaneControl.h
vtuis/videotelui/inc/CVtUiNumberEntryActivationControl.h
vtuis/videotelui/inc/CVtUiRemoteVideoControl.h
vtuis/videotelui/inc/CVtUiZoomControl.h
vtuis/videotelui/inc/MVtUiEngineCommandManager.h
vtuis/videotelui/inc/MVtUiVideoWindow.h
vtuis/videotelui/inc/TVtUiCallParameters.h
vtuis/videotelui/inc/VideoTelephonyInternalCRKeys.h
vtuis/videotelui/inc/VideoTelephonyVariant.hrh
vtuis/videotelui/inc/VtUiLayout.h
vtuis/videotelui/inc/VtUiPanic.h
vtuis/videotelui/inc/VtUiUtility.h
vtuis/videotelui/inc/commands/cvtuicmdbase.h
vtuis/videotelui/inc/commands/cvtuicmdcontext.h
vtuis/videotelui/inc/commands/cvtuicmdcustomvalidationactionbase.h
vtuis/videotelui/inc/commands/cvtuicmdstatecheckaction.h
vtuis/videotelui/inc/commands/cvtuicmdvalidationactionbase.h
vtuis/videotelui/inc/commands/cvtuicmdvalidatorbase.h
vtuis/videotelui/inc/commands/cvtuicommandmanager.h
vtuis/videotelui/inc/commands/cvtuicommandmodifybase.h
vtuis/videotelui/inc/commands/cvtuicommandpolicymanager.h
vtuis/videotelui/inc/commands/cvtuicommandsetting.h
vtuis/videotelui/inc/commands/cvtuicommandsetting.inl
vtuis/videotelui/inc/commands/cvtuiexecutioncontext.h
vtuis/videotelui/inc/commands/cvtuifeaturecmdbase.h
vtuis/videotelui/inc/commands/cvtuiprimarycmdpolicy.h
vtuis/videotelui/inc/commands/mvtuicommanditerator.h
vtuis/videotelui/inc/commands/mvtuicommandmanager.h
vtuis/videotelui/inc/commands/mvtuicommandsetting.h
vtuis/videotelui/inc/commands/mvtuicommandui.h
vtuis/videotelui/inc/commands/tVtuifeaturevariation.h
vtuis/videotelui/inc/commands/tvtflagcontainer.h
vtuis/videotelui/inc/commands/tvtflagcontainer.inl
vtuis/videotelui/inc/commands/tvtuiaudiostate.h
vtuis/videotelui/inc/commands/tvtuiaudiostate.inl
vtuis/videotelui/inc/commands/tvtuicmdcontexttype.h
vtuis/videotelui/inc/commands/tvtuicmdpolicypriority.h
vtuis/videotelui/inc/commands/tvtuicmdvalidatorcallback.h
vtuis/videotelui/inc/commands/tvtuicmdvalidatorcallback.inl
vtuis/videotelui/inc/commands/tvtuicommandmodifierpriority.h
vtuis/videotelui/inc/commands/tvtuilocalvariation.h
vtuis/videotelui/inc/commands/tvtuilocalvariation.inl
vtuis/videotelui/inc/commands/tvtuimediastate.h
vtuis/videotelui/inc/commands/tvtuimediastate.inl
vtuis/videotelui/inc/commands/tvtuistates.h
vtuis/videotelui/inc/commands/tvtuistates.inl
vtuis/videotelui/inc/compman/cvtuicomponentmanager.h
vtuis/videotelui/inc/compman/mvtuicomponent.h
vtuis/videotelui/inc/compman/mvtuicomponentmanager.h
vtuis/videotelui/inc/compman/mvtuikeyeventobserver.h
vtuis/videotelui/inc/compman/mvtuilayoutchangeobserver.h
vtuis/videotelui/inc/compman/mvtuiresourcechangeobserver.h
vtuis/videotelui/inc/compman/mvtuiwindowservereventobserver.h
vtuis/videotelui/inc/compman/tvtuiblocklists.h
vtuis/videotelui/inc/compman/tvtuicomponentstate.h
vtuis/videotelui/inc/cvtuiappshutter.h
vtuis/videotelui/inc/cvtuidtmfbuffer.h
vtuis/videotelui/inc/cvtuivideocontrolbase.h
vtuis/videotelui/inc/features/cvtuifeaturebase.h
vtuis/videotelui/inc/features/cvtuifeaturemanager.h
vtuis/videotelui/inc/features/dialer/cvtuicmdclosedialer.h
vtuis/videotelui/inc/features/dialer/cvtuicmdopendialer.h
vtuis/videotelui/inc/features/dialer/cvtuidialer.h
vtuis/videotelui/inc/features/dialer/cvtuidialercontainer.h
vtuis/videotelui/inc/features/dialer/cvtuidialerskmodifier.h
vtuis/videotelui/inc/features/dialer/cvtuidialervideocontrol.h
vtuis/videotelui/inc/features/dialer/mvtuidialer.h
vtuis/videotelui/inc/features/menu/cvtuimenucontext.h
vtuis/videotelui/inc/features/menu/cvtuimenuitemdimmeraction.h
vtuis/videotelui/inc/features/menu/cvtuimenus.h
vtuis/videotelui/inc/features/menu/tvtuimenucommanditerator.h
vtuis/videotelui/inc/features/mvtuifeature.h
vtuis/videotelui/inc/features/numberentry/CVtUiNumberEntryControl.h
vtuis/videotelui/inc/features/numberentry/cvtuinumberentry.h
vtuis/videotelui/inc/features/numberentry/mvtuinumberentrycontrolobserver.h
vtuis/videotelui/inc/features/prefs/cvtuibrightness.h
vtuis/videotelui/inc/features/prefs/cvtuibrightnesspopup.h
vtuis/videotelui/inc/features/prefs/cvtuicolortone.h
vtuis/videotelui/inc/features/prefs/cvtuicontrast.h
vtuis/videotelui/inc/features/prefs/cvtuicontrastpopup.h
vtuis/videotelui/inc/features/prefs/cvtuiprefpopupbase.h
vtuis/videotelui/inc/features/prefs/cvtuiprefsettinglistbase.h
vtuis/videotelui/inc/features/prefs/cvtuiprefsliderbase.h
vtuis/videotelui/inc/features/prefs/cvtuiprefsliderskmodifier.h
vtuis/videotelui/inc/features/prefs/cvtuitransparentsettingpage.h
vtuis/videotelui/inc/features/prefs/cvtuivideoquality.h
vtuis/videotelui/inc/features/prefs/cvtuiwhitebalance.h
vtuis/videotelui/inc/features/prefs/mvtuisettingpageobserver.h
vtuis/videotelui/inc/features/softkey/cvtuisoftkeycontext.h
vtuis/videotelui/inc/features/softkey/cvtuisoftkeys.h
vtuis/videotelui/inc/features/softkey/cvtuisoftkeysetting.h
vtuis/videotelui/inc/features/softkey/cvtuisoftkeyvalidationaction.h
vtuis/videotelui/inc/features/toolbar/cvtuifixedtoolbar.h
vtuis/videotelui/inc/features/toolbar/cvtuifloatingtoolbar.h
vtuis/videotelui/inc/features/toolbar/cvtuihidetoolbaritemaction.h
vtuis/videotelui/inc/features/toolbar/cvtuitoolbarbase.h
vtuis/videotelui/inc/features/toolbar/cvtuitoolbarbutton.h
vtuis/videotelui/inc/features/toolbar/cvtuitoolbarcmdpolicy.h
vtuis/videotelui/inc/features/toolbar/cvtuitoolbarcontext.h
vtuis/videotelui/inc/features/toolbar/cvtuitoolbarskmodifier.h
vtuis/videotelui/inc/features/toolbar/tvtuitoolbarcommanditerator.h
vtuis/videotelui/inc/features/tvtuifeatureids.h
vtuis/videotelui/inc/features/volume/cvtuivolume.h
vtuis/videotelui/inc/features/volume/cvtuivolumecontrol.h
vtuis/videotelui/inc/features/volume/cvtuivolumepopup.h
vtuis/videotelui/inc/features/zoom/cvtuizoom.h
vtuis/videotelui/inc/features/zoom/cvtuizoompopup.h
vtuis/videotelui/inc/mvtuinumbersource.h
vtuis/videotelui/inc/mvtuishutterobserver.h
vtuis/videotelui/inc/mvtuistatecontext.h
vtuis/videotelui/inc/sliders/cvtuipopupbase.h
vtuis/videotelui/inc/sliders/cvtuisliderbase.h
vtuis/videotelui/inc/sliders/mvtuicomponentstateobserver.h
vtuis/videotelui/inc/tvtuiappstatebase.h
vtuis/videotelui/inc/tvtuiappstatebase.inl
vtuis/videotelui/inc/tvtuiappstates.h
vtuis/videotelui/inc/tvtuiwsevent.h
vtuis/videotelui/inc/tvtuiwsevent.inl
vtuis/videotelui/inc/videotelui.hrh
vtuis/videotelui/loc/videotelui.loc
vtuis/videotelui/rom/videotelui.iby
vtuis/videotelui/rom/videoteluiResources.iby
vtuis/videotelui/src/CVtUiActivateBtHfDialog.cpp
vtuis/videotelui/src/CVtUiActiveExec.cpp
vtuis/videotelui/src/CVtUiAllowVideoDialog.cpp
vtuis/videotelui/src/CVtUiApp.cpp
vtuis/videotelui/src/CVtUiAppUi.cpp
vtuis/videotelui/src/CVtUiBitmapManager.cpp
vtuis/videotelui/src/CVtUiBlankControl.cpp
vtuis/videotelui/src/CVtUiBlankDialog.cpp
vtuis/videotelui/src/CVtUiContextControl.cpp
vtuis/videotelui/src/CVtUiDoc.cpp
vtuis/videotelui/src/CVtUiExecuteCmdDialog.cpp
vtuis/videotelui/src/CVtUiMainControl.cpp
vtuis/videotelui/src/CVtUiMutedControl.cpp
vtuis/videotelui/src/CVtUiNaviPane.cpp
vtuis/videotelui/src/CVtUiNaviPaneControl.cpp
vtuis/videotelui/src/CVtUiNumberEntryActivationControl.cpp
vtuis/videotelui/src/CVtUiRemoteVideoControl.cpp
vtuis/videotelui/src/CVtUiZoomControl.cpp
vtuis/videotelui/src/TVtUiCallParameters.cpp
vtuis/videotelui/src/VtUiLayout.cpp
vtuis/videotelui/src/VtUiPanic.cpp
vtuis/videotelui/src/VtUiUtility.cpp
vtuis/videotelui/src/commands/cvtuicmdbase.cpp
vtuis/videotelui/src/commands/cvtuicmdcontext.cpp
vtuis/videotelui/src/commands/cvtuicmdcustomvalidationactionbase.cpp
vtuis/videotelui/src/commands/cvtuicmdstatecheckaction.cpp
vtuis/videotelui/src/commands/cvtuicmdvalidationactionbase.cpp
vtuis/videotelui/src/commands/cvtuicmdvalidatorbase.cpp
vtuis/videotelui/src/commands/cvtuicommandmanager.cpp
vtuis/videotelui/src/commands/cvtuicommandmodifybase.cpp
vtuis/videotelui/src/commands/cvtuicommandpolicymanager.cpp
vtuis/videotelui/src/commands/cvtuiexecutioncontext.cpp
vtuis/videotelui/src/commands/cvtuifeaturecmdbase.cpp
vtuis/videotelui/src/commands/cvtuiprimarycmdpolicy.cpp
vtuis/videotelui/src/commands/tVtuifeaturevariation.cpp
vtuis/videotelui/src/commands/tvtuiaudiostate.cpp
vtuis/videotelui/src/commands/tvtuilocalvariation.cpp
vtuis/videotelui/src/commands/tvtuimediastate.cpp
vtuis/videotelui/src/commands/tvtuistates.cpp
vtuis/videotelui/src/compman/cvtuicomponentmanager.cpp
vtuis/videotelui/src/compman/tvtuiblocklists.cpp
vtuis/videotelui/src/compman/tvtuicomponentstate.cpp
vtuis/videotelui/src/cvtuiappshutter.cpp
vtuis/videotelui/src/cvtuidtmfbuffer.cpp
vtuis/videotelui/src/cvtuivideocontrolbase.cpp
vtuis/videotelui/src/features/cvtuifeaturebase.cpp
vtuis/videotelui/src/features/cvtuifeaturemanager.cpp
vtuis/videotelui/src/features/dialer/cvtuicmdclosedialer.cpp
vtuis/videotelui/src/features/dialer/cvtuicmdopendialer.cpp
vtuis/videotelui/src/features/dialer/cvtuidialer.cpp
vtuis/videotelui/src/features/dialer/cvtuidialercontainer.cpp
vtuis/videotelui/src/features/dialer/cvtuidialerskmodifier.cpp
vtuis/videotelui/src/features/dialer/cvtuidialervideocontrol.cpp
vtuis/videotelui/src/features/menu/cvtuimenucontext.cpp
vtuis/videotelui/src/features/menu/cvtuimenuitemdimmeraction.cpp
vtuis/videotelui/src/features/menu/cvtuimenus.cpp
vtuis/videotelui/src/features/menu/tvtuimenucommanditerator.cpp
vtuis/videotelui/src/features/numberentry/CVtUiNumberEntryControl.cpp
vtuis/videotelui/src/features/numberentry/cvtuinumberentry.cpp
vtuis/videotelui/src/features/prefs/cvtuibrightness.cpp
vtuis/videotelui/src/features/prefs/cvtuibrightnesspopup.cpp
vtuis/videotelui/src/features/prefs/cvtuicolortone.cpp
vtuis/videotelui/src/features/prefs/cvtuicontrast.cpp
vtuis/videotelui/src/features/prefs/cvtuicontrastpopup.cpp
vtuis/videotelui/src/features/prefs/cvtuiprefpopupbase.cpp
vtuis/videotelui/src/features/prefs/cvtuiprefsettinglistbase.cpp
vtuis/videotelui/src/features/prefs/cvtuiprefsliderbase.cpp
vtuis/videotelui/src/features/prefs/cvtuitransparentsettingpage.cpp
vtuis/videotelui/src/features/prefs/cvtuivideoquality.cpp
vtuis/videotelui/src/features/prefs/cvtuiwhitebalance.cpp
vtuis/videotelui/src/features/softkey/cvtuisoftkeycontext.cpp
vtuis/videotelui/src/features/softkey/cvtuisoftkeys.cpp
vtuis/videotelui/src/features/softkey/cvtuisoftkeysetting.cpp
vtuis/videotelui/src/features/softkey/cvtuisoftkeyvalidationaction.cpp
vtuis/videotelui/src/features/toolbar/cvtuifixedtoolbar.cpp
vtuis/videotelui/src/features/toolbar/cvtuifloatingtoolbar.cpp
vtuis/videotelui/src/features/toolbar/cvtuihidetoolbaritemaction.cpp
vtuis/videotelui/src/features/toolbar/cvtuitoolbarbase.cpp
vtuis/videotelui/src/features/toolbar/cvtuitoolbarbutton.cpp
vtuis/videotelui/src/features/toolbar/cvtuitoolbarcmdpolicy.cpp
vtuis/videotelui/src/features/toolbar/cvtuitoolbarcontext.cpp
vtuis/videotelui/src/features/toolbar/cvtuitoolbarskmodifier.cpp
vtuis/videotelui/src/features/toolbar/tvtuitoolbarcommanditerator.cpp
vtuis/videotelui/src/features/volume/cvtuivolume.cpp
vtuis/videotelui/src/features/volume/cvtuivolumecontrol.cpp
vtuis/videotelui/src/features/volume/cvtuivolumepopup.cpp
vtuis/videotelui/src/features/zoom/cvtuizoom.cpp
vtuis/videotelui/src/features/zoom/cvtuizoompopup.cpp
vtuis/videotelui/src/sliders/cvtuipopupbase.cpp
vtuis/videotelui/src/sliders/cvtuisliderbase.cpp
vtuis/videotelui/src/tvtuiappstatebase.cpp
vtuis/videotelui/src/tvtuistateresetting.cpp
vtuis/videotelui/src/tvtuistaterunning.cpp
vtuis/videotelui/src/tvtuistatestarting.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* 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:    Telephony / videotelephony
+*
+*/
+
+
+
+#include "../vtprotocolplugins/group/bld.inf"
+#include "../vtengines/group/bld.inf"
+#include "../vtuis/group/bld.inf"
+#include "../videotelephony_plat/group/bld.inf"
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/app/videotelephony" >
+]>
+
+<SystemDefinition name="videotelephony" schema="1.4.0">
+  <systemModel>
+    <layer name="app_layer">
+      <module name="videotelephony">
+        <unit name="videotelephony_plat" unitID="tedo.videotelephony_plat" bldFile="&layer_real_source_path;/videotelephony_plat/group" mrp="" />
+        <unit name="PacketVideoEngineBinaries" unitID="tedo.PacketVideoEngineBinaries" bldFile="&layer_real_source_path;/packetvideoengine/PacketVideoEngineBinaries/group" mrp="" filter="!sf_build" /> 
+        <unit name="vtprotocolsstub" unitID="tedo.vtprotocolsstub" bldFile="&layer_real_source_path;/vtprotocolsstub/group" mrp="" filter="sf_build" />  
+        <unit name="vtprotocols" unitID="tedo.vtprotocols" bldFile="&layer_real_source_path;/vtprotocols/group" mrp="" filter="!sf_build" />
+        <unit name="DisplaySink" unitID="tedo.DisplaySink" bldFile="&layer_real_source_path;/vtprotocolplugins/DisplaySink/group" mrp="" /> 
+        <unit name="VideoSource" unitID="tedo.VideoSource" bldFile="&layer_real_source_path;/vtprotocolplugins/VideoSource/group" mrp="" />
+        <unit name="videoteleng" unitID="tedo.videoteleng" bldFile="&layer_real_source_path;/vtengines/videoteleng/Group" mrp="" />  
+        <unit name="videotelui" unitID="tedo.videotelui" bldFile="&layer_real_source_path;/vtuis/videotelui/group" mrp="" /> 
+	<unit name="vtmediatorplugin" unitID="tedo.vtmediatorplugin" bldFile="&layer_real_source_path;/vtengines/vtmediatorplugin/group" mrp="" />
+      </module>
+    </layer>
+  </systemModel>
+</SystemDefinition>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0">
+  <package id="videotelephony" name="Video Telephony Apps" levels="engine plugin prot ui">
+    <collection id="vtengines" name="Video Telephony Engines" level="engine">
+      <component id="videoteleng" filter="s60" name="Video Telephony Engine">
+        <unit bldFile="vtengines/videoteleng/group"/>
+        	<!-- should these be #included? -->
+        <!-- <unit bldFile="vtengines/videoteleng/logger/group"/> -->
+        <!-- <unit bldFile="vtengines/videoteleng/callctrl/group"/> -->
+      </component>
+      <component id="vtmediatorplugin" filter="s60" name="VT Mediator Plugin" class="plugin">
+        <unit bldFile="vtengines/vtmediatorplugin/group"/>
+      </component>
+    </collection>
+    <collection id="vtuis" name="Video Telephony UIs" level="ui">
+      <component id="videotelui" filter="s60" name="Video Telephony UI">
+        <unit bldFile="vtuis/videotelui/group"/>
+      </component>
+    </collection>
+    <collection id="vtprotocolplugins" name="VT Protocol Plugins" level="plugin">
+      <component id="displaysink" filter="s60" name="Display Sink" introduced="tb91">
+        <unit bldFile="vtprotocolplugins/displaysink/group"/>
+      </component>
+      <component id="videosource" filter="s60" name="Video Source" introduced="tb91">
+        <unit bldFile="vtprotocolplugins/videosource/group"/>
+      </component>
+    </collection>
+    <collection id="vtprotocolsstub" name="VT Protocols Stub" level="prot">
+      <component id="videotelproto" filter="s60" name="Video Telephony Protocol">
+        <unit bldFile="vtprotocolsstub/group"/>
+      </component>
+    </collection>
+    <collection id="videotelephony_info" name="VT Apps Info" level="ui">
+      <component id="videotelephony_plat" filter="s60" name="VT Apps Platform Interfaces" class="api">
+        <unit bldFile="videotelephony_plat/group"/>
+      </component>
+    </collection>
+  </package>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Mon Nov 23 14:47:47 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>  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,22 @@
+/*
+* 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 "../video_telephony_control_mediator_api/group/bld.inf"
+#include "../video_telephony_media_configuration_api/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/video_telephony_control_mediator_api/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 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:  File that exports the files belonging to 
+:                Video Telephony Control Mediator API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/videotelcontrolmediatorapi.h     APP_LAYER_PLATFORM_EXPORT_PATH( videotelcontrolmediatorapi.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/video_telephony_control_mediator_api/inc/videotelcontrolmediatorapi.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 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 Telephony specific message services sent from Phone
+*                Application to Video Telephony.
+*
+*/
+
+
+#ifndef VIDEOTELCONTROLMEDIATORAPI_H
+#define VIDEOTELCONTROLMEDIATORAPI_H
+
+// INCLUDES
+#include <e32base.h>
+
+/**  The category UID for the messages in this header file. */
+const TUid KCatPhoneToVideotelCommands = { 0x200159A1 };
+
+/**  Version number of this API */
+const TInt KPhoneToVideotelCmdVersionMajor( 1 );
+const TInt KPhoneToVideotelCmdVersionMinor( 0 );
+const TInt KPhoneToVideotelCmdVersionBuild( 0 );
+
+/** package for passing dataport name to Video Telephony */
+typedef TPckgBuf<TName> TDataPortPackage;
+
+/**  Video Telephony related commands. */
+enum TPhoneToVideotelCommands
+    {
+    /**
+     * Commands Video Telephony to enable microphone.
+     */
+    EVtCmdUnmute = 0,
+    
+    /**
+     * Commands Video Telephony to disable microphone.
+     */
+    EVtCmdMute,
+        
+    /**
+     * Commands Video Telephony to use dataport. Command paramemeter is
+     * TDataPortPackage. This should be called when dataport is loaned.
+     * When this is sent, dataport recovery is allowed only after
+     * 1) later issued EVtCmdShutdown response is received.
+     * 2) call is ended by network/peer (i.e. local phone doesn't do hangup)
+     * 3) EPhoneCmdEndActiveCall command is received (see Mediator Commands To 
+     *    Telephony API)
+     *  Otherwise H.245 (VT) signalling may fail if call is released in two
+     *  stage.
+     */
+    EVtCmdUseDataport,
+    
+    EVtCmdReleaseDataport
+    };
+
+#endif // VIDEOTELCONTROLMEDIATORAPI_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/video_telephony_control_mediator_api/video_telephony_control_mediator_api.metaxml	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="216d6a20aad391ac9077f1a2e8d8477d" dataversion="2.0">
+  <name>Video Telephony Control Mediator API</name>
+  <description>An interface for exchanging video telephony related commands (e.g. call initiation and termination) and providing data synchronization (e.g. contact data and audio mute state) between Phone and Video Telephone applications.</description>
+  <type>c++</type>
+  <collection>vtengines</collection>
+  <libs>
+  </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/videotelephony_plat/video_telephony_media_configuration_api/group/bld.inf	Mon Nov 23 14:47:47 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 
+:                Video Telephony Media Configuration API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/VideoTelephonyDomainPSKeys.h     APP_LAYER_PLATFORM_EXPORT_PATH(videotelephonydomainpskeys.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/video_telephony_media_configuration_api/inc/VideoTelephonyDomainPSKeys.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* 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:  Video Telephony Domain Publish and Subscribe keys.
+*
+*/
+
+
+#ifndef VIDEOTELEPHONYDOMAINPSKEYS_H
+#define VIDEOTELEPHONYDOMAINPSKEYS_H
+
+#include <e32std.h>
+
+
+// CONSTANTS
+
+/**
+* Media Configuration API for video telephony.
+*/
+const TUid KPSUidVTMediaConfiguration = {0x1020736A};
+
+/**
+* Preferred camera that the application should use as source.
+* @type RProperty::EInt
+*/
+const TUint32 KPSPreferredCamera = 0x00000000;
+enum EPSPreferredCamera
+    {
+    EPSPreferredCameraUnknown,
+    EPSPreferredCameraInwards,
+    EPSPreferredCameraOutwards
+    };
+
+
+#endif      // VIDEOTELEPHONYDOMAINPSKEYS_H
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videotelephony_plat/video_telephony_media_configuration_api/video_telephony_media_configuration_api.metaxml	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="427f4a40c8f79845b018f1dccadea15f" dataversion="2.0">
+  <name>Video Telephony Media Configuration API</name>
+  <description>An interface to access transient (run-time) media configuration related to video telephony, e.g. preferred camera in VT.</description>
+  <type>c++</type>
+  <collection>vtengines</collection>
+  <libs>
+  </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/vtengines/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  Build information for Vtengines subsystem.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Include components' bld.inf files
+#include "../videoteleng/Group/bld.inf"
+#include "../vtmediatorplugin/group/bld.inf"
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Bmarm/VIDEOTELENGU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,8 @@
+EXPORTS
+	Audio__C11CVtEngModel @ 1 NONAME R3UNUSED ; CVtEngModel::Audio(void) const
+	CommandHandler__C11CVtEngModel @ 2 NONAME R3UNUSED ; CVtEngModel::CommandHandler(void) const
+	Extension__FRC4TUid @ 3 NONAME R3UNUSED ; Extension(TUid const &)
+	Media__C11CVtEngModel @ 4 NONAME R3UNUSED ; CVtEngModel::Media(void) const
+	NewL__11CVtEngModelR19MVtEngEventObserverR21MVtEngCommandObserver @ 5 NONAME R3UNUSED ; CVtEngModel::NewL(MVtEngEventObserver &, MVtEngCommandObserver &)
+	Session__C11CVtEngModel @ 6 NONAME R3UNUSED ; CVtEngModel::Session(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Bmarm/CSCALLCTRLU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	CreateFactory__Fv @ 1 NONAME R3UNUSED ; CreateFactory(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Bwins/CSCALLCTRLU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?CreateFactory@@YAPAVCVtCtlFactory@@XZ @ 1 NONAME ; class CVtCtlFactory * __cdecl CreateFactory(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/EABI/CSCallCtrlU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z13CreateFactoryv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* 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:  videocallctrl build information file.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+../Group/videocallctrl.mmp
+
+//PRJ_TESTMMPFILES
+// CsCallCtrl CVT case.
+//../tsrc/group/CsCallCtrl_CVT_Test.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Group/videocallctrl.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* 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:  This is project specification file for the Video Call Control.
+*
+*/
+
+
+#include  <platform_paths.hrh>
+
+#include "../Inc/VtCtlConfig.hrh"
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+TARGET          cscallctrl.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x101F867F
+
+SOURCEPATH      ../Src
+SOURCE          CVtCtlFactory.cpp
+#if defined VTCALLCONTROLSTUB
+// call state connected, previous state alerting
+SOURCE          CVtCtlCallControlStub.cpp
+DOCUMENT        CVtCtlCallControl.cpp
+#else
+SOURCE          CVtCtlCallControl.cpp
+DOCUMENT        CVtCtlCallControlStub.cpp
+#endif
+SOURCE          CVtCtlSessionContainer.cpp
+SOURCE          CVtCtlCallStatusMonitor.cpp
+SOURCE          CVtCtlLineMonitor.cpp
+SOURCE          CVtCtlVideoCall.cpp
+SOURCE          VtCtlPanic.cpp
+
+DOCUMENT        ../Group/bld.inf
+
+USERINCLUDE     ../Inc
+SYSTEMINCLUDE   ../../../../inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib 
+LIBRARY etel.lib 
+LIBRARY etelmm.lib
+DEBUGLIBRARY vtlogger.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlCallControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2004 - 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:  Call control
+*
+*/
+
+
+
+#ifndef CVTCTLCALLCONTROL_H
+#define CVTCTLCALLCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "MVtCtlCallControl.h"
+#include "MVtCtlCallStatusObserver.h"
+#include <etelmm.h>
+
+// FORWARD DECLARATIONS
+class MVtCtlEventObserver;
+class CVtCtlSessionContainer;
+
+// CLASS DECLARATION
+
+/**
+*  Call control implementation.
+*
+*  @lib CSCallCtrl.lib
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlCallControl ) : 
+    public CBase, 
+    public MVtCtlCallControl,
+    public MVtCtlCallStatusObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aEventObserver reference to event observer
+        * @param aCommandObserver reference to command observer
+        * @return call control
+        */
+        static CVtCtlCallControl* NewL(
+            MVtCtlEventObserver& aEventObserver );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtCtlCallControl();
+
+    public: // From MVtCtlCallControl
+
+        /**
+        * @see MVtCtlCallControl::GetDuration
+        */
+        virtual TInt GetDuration( 
+            TVtCtlSessionId aId,
+            TVtCtlDuration& aDuration );
+
+
+        /**
+        * @see MVtCtlCallControl::GetSessionInfoL
+        */
+        virtual void GetSessionInfoL( 
+            TVtCtlSessionId aId,
+            TDes8& aInfo );
+
+        /**
+        * @see MVtCtlCallControl::GetSessionState
+        */
+        virtual TVtCtlState GetSessionState( 
+            TVtCtlSessionId aId ) const;
+
+        /**
+        * @see MVtCtlCallControl::GetPreviousPreviousState
+        */
+        virtual TVtCtlState GetPreviousPreviousState( 
+            TVtCtlSessionId aId ) const;
+
+    public: // from MVtCtlCallStatusObserver
+
+        /**
+        * @see MVtCtlCallStatusObserver::HandleCallStatusChangeL
+        */
+        virtual void HandleCallStatusChangeL( 
+            TVtCtlSessionId aId,
+            MVtCtlCallControl::TVtCtlState aStatus,
+            MVtCtlCallControl::TVtCtlState aPreviousStatus );
+        
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CVtCtlCallControl(
+            MVtCtlEventObserver& aEventObserver );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Validates that data passed as descriptor is of
+        * correct type. If not leaves KErrNotSupported.
+        * @param aData TVtCtlType derived class represented as descriptor
+        * @param aExtension expected type
+        */
+        static void ValidateDataExtensionL( 
+            TDesC8& aData,
+            TInt aExtension );
+
+    private:    // Data
+        
+        // Event observer
+        MVtCtlEventObserver&    iEventObserver;
+
+        // Container for ETel sessions
+        CVtCtlSessionContainer* iContainer;
+    };
+
+#endif      // CVTCTLCALLCONTROL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlCallStatusMonitor.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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:  Monitors call status.
+*
+*/
+
+
+
+#ifndef CVTCTLCALLSTATUSMONITOR_H
+#define CVTCTLCALLSTATUSMONITOR_H
+
+//  INCLUDES
+
+#include "MVtCtlCallControl.h"
+#include <e32base.h>
+#include <etelmm.h>
+
+/**
+* Array for resolving call status (TMobileCallStatus) transition validity.
+* Transition to lower value is not possible with exception to 0 priority
+* (always possible to go to idle state). Initial state is EStatusUnknown.
+*/
+static const TInt KVtCtlStatusTransitionPriorities[] =
+    { 
+      1, //    EStatusUnknown
+      0, //    EStatusIdle, possible from any
+      2, //    EStatusDialling
+      2, //    EStatusRinging
+      3, //    EStatusAnswering
+      3, //    EStatusConnecting
+      4, //    EStatusConnected
+      5, //    EStatusDisconnecting          
+      // Status values below are not valid in video calls => should not happen.
+      5, //    EStatusDisconnectingWithInband      
+      0, //    EStatusReconnectPending
+      0, //    EStatusHold
+      0, //    EStatusWaitingAlternatingCallSwitch
+      0, //    EStatusTransferring
+      0  //    EStatusTransferAlerting
+    };
+
+// FORWARD DECLARATIONS
+class MVtCtlCallStatusObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Monitor for call status
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlCallStatusMonitor ) : public CActive
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        * @param aCall call subsession
+        * @param aObserver call status observer
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        CVtCtlCallStatusMonitor( 
+            RMobileCall& aCall,
+            MVtCtlCallStatusObserver& aObserver );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtCtlCallStatusMonitor();
+
+    public: // New functions
+        
+        /**
+        * Starts monitoring
+        */
+        void Start();
+
+    private:  // From CActive
+
+        /**
+        * Cancel monitoring.
+        */
+        virtual void DoCancel();
+
+        /**
+        * Handles call status change.
+        */
+        virtual void RunL();
+
+        /**
+        * Handles leave in RunL.
+        * @param aError error code
+        * @return KErrNone
+        */
+        virtual TInt RunError( TInt aError );
+
+    public: // New functions
+        
+        /**
+        * Maps Etel status to internal state
+        * @param aStatus mobile call status
+        * @return session state, see TVtCtlState
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        static MVtCtlCallControl::TVtCtlState MapState(
+            const RMobileCall::TMobileCallStatus aStatus );
+                
+        /**
+        * Checks if call state transition specified by arguments is legal.
+        * @param aNewState proposed new call state
+        * @param aCurrentState current call state
+        * @return ETrue if transition is valid
+        */
+        static TBool IsLegalNewState(
+            const RMobileCall::TMobileCallStatus aNewState,
+            const RMobileCall::TMobileCallStatus aCurrentState );
+                
+    private:    // Data
+
+        // Data call
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileCall& iCall;
+        
+        // Observer for call status changes
+        MVtCtlCallStatusObserver& iObserver;
+
+        // Call status and previous status
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileCall::TMobileCallStatus iCallStatus;
+        RMobileCall::TMobileCallStatus iPreviousStatus;
+    };
+
+#endif      // CVTCTLCALLSTATUSMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlFactory.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2004 - 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:  Factory for creating call control
+*
+*/
+
+
+
+#ifndef CVTCTLFACTORY_H
+#define CVTCTLFACTORY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "VtCtlDefs.h"
+
+// CONSTANTS
+_LIT( KVtCtlLibraryName, "CSCallCtrl" );
+
+// FORWARD DECLARATIONS
+class MVtCtlEventObserver;
+class MVtCtlCommandObserver;
+class MVtCtlCallControl;
+
+/**
+* Factory class for instantiating call control.
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlFactory ) : public CBase
+    {
+    public:
+
+        /**
+        * Instantiates call control
+        * @param aEventObserver
+        * @param aCommandObserver
+        * @return call control
+        */
+        virtual MVtCtlCallControl* CreateCallControlL(
+            MVtCtlEventObserver& aEventObserver );
+
+        /**
+        * Destructs call control created with CreateCallControlL.
+        * @param aCallControl pointer to call control instance
+        */
+        virtual void Delete( MVtCtlCallControl* aCallControl );
+    };
+
+/**
+* Creates call control factory
+* @return factory
+*/
+IMPORT_C CVtCtlFactory* CreateVtCtlFactory();
+
+#endif      // CVTCTLFACTORY_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlLineMonitor.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,112 @@
+/*
+* 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:  Monitors new calls on data line.
+*
+*/
+
+
+
+#ifndef CVTCTLLINEMONITOR_H
+#define CVTCTLLINEMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelmm.h>
+
+// FORWARD DECLARATIONS
+
+class MVtCtlLineEventObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Monitor for new calls
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlLineMonitor ) : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        * @param aLine line subsession
+        * @param aObserver line event observer
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        CVtCtlLineMonitor( 
+            RMobileLine& aLine,
+            MVtCtlLineEventObserver& aObserver);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtCtlLineMonitor();
+
+    public: // New functions
+        
+        /**
+        * Starts monitoring
+        */
+        void Start();
+
+    private:  // Functions from CActive
+
+        /**
+        * Cancel monitoring.
+        */
+        virtual void DoCancel();
+
+        /**
+        * Handles new call on line.
+        */
+        virtual void RunL();
+                
+        /**
+        * Error handler for leave in RunL
+        * @param aError error code
+        * @return KErrNone
+        */
+        virtual TInt RunError( TInt aError );
+
+    private:    // Data
+
+        // Data line
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileLine& iLine;
+        
+        // Observer for new calls on line
+        MVtCtlLineEventObserver& iObserver;
+
+        // Call name
+        TName        iName;
+
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileCall::TMobileCallStatus iLastLineStatus;
+        RMobileCall::TMobileCallStatus iLineStatus;
+    };
+
+#endif      // CVTCTLLINEMONITOR_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlSessionContainer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,216 @@
+/*
+* 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:  Container for ETel session and subsessions
+*
+*/
+
+
+
+#ifndef CVTCTLSESSIONCONTAINER_H
+#define CVTCTLSESSIONCONTAINER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelmm.h>
+#include "MVtCtlLineEventObserver.h"
+#include "MVtCtlCallStatusObserver.h"
+#include "MVtCtlCallControl.h"
+
+// FORWARD DECLARATIONS
+class CVtCtlLineMonitor;
+class CVtCtlCallMonitor;
+class CVtCtlVideoCall;
+
+// CLASS DECLARATION
+
+/**
+*  Container for ETel (sub)session(s).
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlSessionContainer ) : 
+    public CBase, 
+    public MVtCtlLineEventObserver,
+    public MVtCtlCallStatusObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aObserver call status observer
+        */
+        static CVtCtlSessionContainer* NewL(
+            MVtCtlCallStatusObserver& aObserver );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtCtlSessionContainer();
+
+    public: // MVtCtlLineEventObserver
+
+        /**
+        * @see MVtCtlLineEventObserver::HandleLineEventL
+        */
+        virtual void HandleLineEventL(
+            const TLineEvent aEvent, 
+            TDesC& aCallName );
+
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        virtual void HandleLineEventL( 
+            const TLineEvent aEvent, 
+            const RMobileCall::TMobileCallStatus aStatus );
+
+    public: // MVtCtlCallStatusObserver
+        
+        /**
+        * @see MVtCtlLineEventObserver::HandleCallStatusChangeL
+        */
+        virtual void HandleCallStatusChangeL( 
+            TVtCtlSessionId aId,
+            MVtCtlCallControl::TVtCtlState aStatus,
+            MVtCtlCallControl::TVtCtlState aPreviousStatus );
+
+    public: // New functions
+
+        /**
+        * Finds call by name.
+        * @param aCallName search key
+        * @return call or NULL if not found
+        */
+        CVtCtlVideoCall* FindCall( TDesC& aCallName ) const;
+        
+        /**
+        * Finds call by session id.
+        * @param aId search key
+        * @return call or NULL if not found
+        */
+        CVtCtlVideoCall* FindCall( TVtCtlSessionId aId ) const;
+
+        /**
+        * Gets sessions.
+        * @param aArray sessions are returned in this
+        * @return number of sessions in aArray
+        */
+        TInt GetSessions( RVtCtlSessionIdArray& aArray ) const;        
+
+    private:
+
+        /**
+        * Removes call from array and deletes it.
+        * @param aId session id
+        */
+        void DestructCall( TVtCtlSessionId aId );
+
+        /**
+        * Checks that call is of correct type (multimedia)
+        * @param aName call object
+        * @param aName call name
+        * @return ETrue if call is multimedia call
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        TBool CheckCallTypeL( 
+            RMobileCall& aCall,
+            const TName& aName );
+
+        /**
+        * Initializes video call object
+        * @param aCallName call name        
+        * @return ETrue if call was initialized
+        */
+        TBool InitCallL( const TName& aCallName );
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aObserver call status observer
+        */
+        CVtCtlSessionContainer( MVtCtlCallStatusObserver& aObserver );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Class for maintaining session identities
+        */
+        class TVtCtlSessionIdentities
+            {
+            public:
+                // c++ default constructor
+                TVtCtlSessionIdentities();
+
+                /**
+                * Create new session id
+                * @return session id
+                */
+                TVtCtlSessionId Create();
+
+                /**
+                * Returns current session id
+                * @return session id
+                */
+                TVtCtlSessionId Current() const;
+
+            private:
+                // Last session id
+                TVtCtlSessionId iCurrentId;
+            };
+
+    private:    // Data
+        
+        // ETel session
+        RTelServer             iServer;
+
+        // Phone session
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobilePhone           iPhone;
+
+        // Data line
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileLine            iLine;
+
+        // Monitors new calls on line.
+        CVtCtlLineMonitor*     iLineMonitor;
+        
+        // Array of ongoing video calls
+        RPointerArray<CVtCtlVideoCall> iCalls;
+
+        // Session id management
+        TVtCtlSessionIdentities iSessionIds;
+
+        // Call status observer
+        MVtCtlCallStatusObserver& iObserver;
+    };
+
+#endif      // CVTCTLSESSIONCONTAINER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/CVtCtlVideoCall.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,195 @@
+/*
+* 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:  Video call abstraction
+*
+*/
+
+
+
+#ifndef CVTCTLVIDEOCALL_H
+#define CVTCTLVIDEOCALL_H
+
+//  INCLUDES
+#include <etelmm.h>
+#include "MVtCtlCallControl.h"
+#include "MVtCtlCallStatusObserver.h"
+
+
+// FORWARD DECLARATIONS
+class CVtCtlCallStatusMonitor;
+
+// CLASS DECLARATION
+
+/**
+*  Video call abstraction
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtCtlVideoCall ) : 
+    public CBase,
+    public MVtCtlCallStatusObserver
+    {
+    public:
+        
+        /**
+        * Call information
+        */
+        struct TVtCtlCallInfo
+            {
+            // Session state
+            MVtCtlCallControl::TVtCtlState     iStatus;
+            // Previous session state
+            MVtCtlCallControl::TVtCtlState     iPreviousStatus;
+            // Session id
+            TVtCtlSessionId                    iId;
+            // Session direction
+            MVtCtlCallControl::TVtCtlDirection iDirection;
+            };
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aDataLine line subsession
+        * @param aId session id
+        * @param aObserver call status observer
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        static CVtCtlVideoCall* NewL( 
+            RMobileLine& aDataLine,
+            TVtCtlSessionId aId,
+            MVtCtlCallStatusObserver& aObserver
+            );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtCtlVideoCall();
+
+    public: // New functions
+        
+        /**
+        * Returns call info
+        * @return reference to call info
+        */
+        const CVtCtlVideoCall::TVtCtlCallInfo& CallInfo() const;
+
+        /**
+        * Returns Etel call info
+        * @return call info
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        const RMobileCall::TMobileCallInfoV1& MobileInfo() const;
+
+        /**
+        * Opens call subsession and starts monitoring call status.
+        * @param aCallName call name
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        void InitializeCallL( RMobileCall& aCall );
+
+        /**
+        * Updates call information from ETel
+        * @return Symbian OS error code
+        */
+        TInt UpdateCallInfo();
+
+        /**
+        * Returns call duration from Etel
+        * @param aDuration duration
+        * @return Symbian OS error code
+        */
+        TInt GetDuration( TVtCtlDuration& aDuration );
+        
+        /**
+        * Obtains video call state from the server and returns it.
+        * @param aState updated call state
+        * @return Symbian OS error code
+        * @since S60 3.1
+        */
+        TInt GetCallState( MVtCtlCallControl::TVtCtlState& aState );
+
+    protected:  // From MVtCtlCallStatusObserver
+        
+        /**
+        * @see MVtCtlCallStatusObserver::HandleCallStatusChangeL
+        */
+        virtual void HandleCallStatusChangeL( 
+            TVtCtlSessionId aId,
+            MVtCtlCallControl::TVtCtlState aStatus,
+            MVtCtlCallControl::TVtCtlState aPreviousStatus );
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDataLine data line
+        * @param aId session id
+        * @param aObserver observer
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        CVtCtlVideoCall( 
+            RMobileLine& aDataLine, 
+            TVtCtlSessionId aId,
+            MVtCtlCallStatusObserver& aObserver );
+
+    private:    // Data
+
+        // Call information
+        TVtCtlCallInfo iCallInfo;
+
+        // Etel call
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileCall* iCall;
+
+        // Data line
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileLine& iLine;
+
+        // Etel call information
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileCall::TMobileCallInfoV1 iMobileCallInfo;
+        
+        // Call status monitor
+        CVtCtlCallStatusMonitor* iStatusMonitor;
+
+        // Call status observer
+        MVtCtlCallStatusObserver& iObserver;
+    };
+
+#endif      // CVTCTLVIDEOCALL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlCallControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2004 - 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:  Call control interface
+*
+*/
+
+
+
+#ifndef MVTCTLCALLCONTROL_H
+#define MVTCTLCALLCONTROL_H
+
+//  INCLUDES
+#include "VtCtlDefs.h"
+#include "TVtCtlType.h"
+
+// CLASS DECLARATION
+
+/**
+*  Call control class
+*  
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+class MVtCtlCallControl
+    {
+    public:  // new functions
+
+        /**
+        * Session state
+        * EIdle          idle, no connection
+        * EInitializing  initializing MO session
+        * EAlerting      alerting at remote end 
+        * ERinging       incoming session ringing
+        * EConnected     session is established
+        * EDisconnecting disconnecting session
+        */
+        enum TVtCtlState {
+            EUnknown,       // 0
+            EIdle,          // 1
+            EInitializing,  // 2
+            EAlerting,      // 3
+            ERinging,       // 4
+            EConnected,     // 5
+            EDisconnecting  // 6
+            };        
+
+        /**
+        * Session direction
+        * EDirectionUnknown          unknown direction
+        * EDirectionMobileOriginated MO session
+        * DirectionMobileTerminated  MT session
+        */
+        enum TVtCtlDirection
+            {
+            EDirectionUnknown,
+            EDirectionMobileOriginated,
+            DirectionMobileTerminated
+            };
+
+        /**
+        * Gets session duration
+        * @param aId session id
+        * @param aDuration session duration
+        * @return Symbian OS error code
+        */
+        virtual TInt GetDuration( 
+            TVtCtlSessionId aId,
+            TVtCtlDuration& aDuration ) = 0;
+
+        /**
+        * Gets information on a session. 
+        * @param aId session id
+        * @param aInfo packetized object derived from TVtCtlType
+        */
+        virtual void GetSessionInfoL( 
+            TVtCtlSessionId aId,
+            TDes8& aInfo ) = 0;
+
+        /**
+        * Returns session state
+        * @param aId session id
+        * @return session state
+        */
+        virtual TVtCtlState GetSessionState( 
+            TVtCtlSessionId aId ) const = 0;
+
+        /**
+        * Returns previous session state
+        * @param aId session id
+        * @return session state
+        */
+        virtual TVtCtlState GetPreviousPreviousState( 
+            TVtCtlSessionId aId ) const = 0;
+
+    };
+
+#endif      // MVTCTLCALLCONTROL_H
+ 
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlCallStatusObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* 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:  Call status observer interface
+*
+*/
+
+
+
+#ifndef MVTCTLCALLSTATUSOBSERVER_H
+#define MVTCTLCALLSTATUSOBSERVER_H
+
+//  INCLUDES
+#include "MVtCtlCallControl.h"
+
+// CLASS DECLARATION
+
+/**
+*  Call status observer interface
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+class MVtCtlCallStatusObserver
+    {
+    public:  // new functions
+
+        /**
+        * Handles call status change.
+        * @param aId session id
+        * @param aStatus new session status
+        * @param aPreviousStatus previous session status
+        */
+        virtual void HandleCallStatusChangeL( 
+            TVtCtlSessionId aId,
+            MVtCtlCallControl::TVtCtlState aStatus,
+            MVtCtlCallControl::TVtCtlState aPreviousStatus ) = 0;
+    };
+
+#endif      // MVTCTLCALLSTATUSOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlCommandObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* 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:  Session command observer interface
+*
+*/
+
+
+
+#ifndef MVTCTLCOMMANDOBSERVER_H
+#define MVTCTLCOMMANDOBSERVER_H
+
+//  INCLUDES
+#include "MVtCtlCallControl.h"
+
+// CLASS DECLARATION
+
+/**
+*  Session command observer interface
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+class MVtCtlCommandObserver
+    {
+    public:  // new functions
+
+        /**
+        * Handles command completion in session control.
+        * @param aCmd command
+        * @param aResult completion result
+        */
+        virtual void HandleVtSessionCommandL( 
+            MVtCtlCallControl::TVtCtlCmd aCmd,
+            TInt aResult ) = 0;
+    };
+
+#endif      // MVTCTLCOMMANDOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlEventObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* 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:  Session event observer interface.
+*
+*/
+
+
+
+#ifndef MVTCTLEVENTOBSERVER_H
+#define MVTCTLEVENTOBSERVER_H
+
+//  INCLUDES
+#include "VtCtlEvents.h"
+
+/**
+*  Session event observer interface
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+class MVtCtlEventObserver
+    {
+    public:  // new functions
+
+        /**
+        * Handles event from session control.
+        * @param aEvent session event
+        * @param aParams parameters related to event.
+        *        Actual type depends on event.
+        */
+        virtual void HandleVtSessionEventL( 
+            TInt aEvent,
+            TAny* aParams ) = 0;
+    };
+
+#endif      // MVTCTLEVENTOBSERVER_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/MVtCtlLineEventObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,75 @@
+/*
+* 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:  Observer interface for line events.
+*
+*/
+
+
+
+#ifndef MVTCTLLINEEVENTOBSERVER_H
+#define MVTCTLLINEEVENTOBSERVER_H
+
+//  INCLUDES
+#include <e32def.h>
+
+// CLASS DECLARATION
+
+/**
+*  Observer interface for line events
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+class MVtCtlLineEventObserver
+    {
+    public:  // new functions
+
+        /**
+        * ELineEventCallAdded    call added to line
+        * ELineEventIncomingCall incoming call
+        * ELineEventStatusChange line status changed
+        */
+        enum TLineEvent {
+            ELineEventCallAdded,
+            ELineEventIncomingCall,
+            ELineEventStatusChange
+            };
+
+        /**
+        * Event handler for line events.
+        * @param aEvent line event
+        * @param aCallName call name
+        */
+        virtual void HandleLineEventL( 
+            const TLineEvent aEvent, 
+            TDesC& aCallName ) = 0;
+
+        /**
+        * Event handler for line events.
+        * @param aEvent line event
+        * @param aCallName call name
+        * @param aStatus call status
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        virtual void HandleLineEventL( 
+            const TLineEvent aEvent, 
+            const RMobileCall::TMobileCallStatus aStatus ) = 0;
+    };
+
+#endif      // MVTCTLLINEEVENTOBSERVER_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/TVtCtlType.h	Mon Nov 23 14:47:47 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:  Session type base class.
+*
+*/
+
+
+
+#ifndef MVTCTLSESSIONINFO_H
+#define MVTCTLSESSIONINFO_H
+
+//  INCLUDES
+#include <e32def.h>
+
+// CLASS DECLARATION
+
+/**
+*  Base class data types.
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+class TVtCtlType
+    {
+    public:
+        
+        /**
+        * Returns extension id
+        * @return extension id
+        */
+        inline TInt Extension() const;
+
+    protected:
+        // Extension id to be used in defining actual data type.
+        TInt iExtension;
+    };
+
+#include    "TVtCtlType.inl"
+
+#endif      // MVTCTLSESSIONINFO_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/TVtCtlType.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  Inline methods of class TVtCtlType.
+*
+*/
+
+
+
+// -----------------------------------------------------------------------------
+// TVtCtlType::Extension
+// Returns extension id.
+// -----------------------------------------------------------------------------
+//
+inline TInt TVtCtlType::Extension() const { return iExtension; }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlConfig.hrh	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* 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:  Project configuration file.
+*
+*/
+
+
+#ifndef VTCTLCONFIG_HRH
+#define VTCTLCONFIG_HRH
+
+//  INCLUDES
+
+/**
+* Macro that chooses stub implementation for CsCallCtrl.
+* In stub following attributes are effective
+* - duration = 5
+* - session info returns :
+*       direction = MO
+*       state = connected
+*       previous state = alerting
+*       tel number = 0501234567
+*       duration = 5 
+*/
+//#define VTCALLCONTROLSTUB
+
+#endif // VTCTLCONFIG_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlDefs.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* 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:  General definitions for Video telephony call control
+*
+*/
+
+
+
+#ifndef VTCTLDEFS_H
+#define VTCTLDEFS_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// Null session id
+const TInt KNullSessionId = -1;
+
+// Session id for active session
+const TInt KActiveSessionId = -2;
+
+/**
+* Active object priorities
+*/
+const TInt KVtCtlCallAdditionMonitorPriority = CActive::EPriorityStandard;
+const TInt KVtCtlCallStatusMonitorPriority = CActive::EPriorityStandard;
+
+/**
+* Maximum length for telephone number
+*/
+const TInt KVtCtlTelNumberLength = 100;
+
+
+// DATA TYPES
+
+/**
+* Remote end address
+*/
+typedef TBuf<KVtCtlTelNumberLength> TVtCtlTelNumber;
+
+/**
+* Session duration
+*/
+typedef TTimeIntervalSeconds TVtCtlDuration;
+
+/**
+* Session array
+*/
+typedef RArray<TInt> RVtCtlSessionIdArray;
+
+/**
+* Session id
+*/
+typedef TInt TVtCtlSessionId;
+
+/**
+* Session command
+*/
+typedef TInt TVtCtlCmd;
+
+/**
+* Extension ids
+*/
+enum {
+    EVtCtlCSSessionInfoExtensionId = 1
+    };
+
+#endif      // VTCTLDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlEvents.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* 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:  Call control events
+*
+*/
+
+
+
+#ifndef VTCLTDEFS_H
+#define VTCLTDEFS_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// DATA TYPES
+typedef TInt TVtCtlEvent;
+
+// CONSTANTS
+
+/**
+* Session status is changed. aParams in 
+* MVtCtlEventObserver::HandleVtSessionEventL is of 
+* type MVtCtlCallControl::TVtCtlState
+*/
+const TVtCtlEvent KVtCtlEventSessionStatusChanged = 1;
+
+/**
+* Session duration is changed. aParams 
+* MVtCtlEventObserver::HandleVtSessionEventL is of 
+* type TVtCtlDuration
+*/
+const TVtCtlEvent KVtCtlEventDurationChanged = 2;
+
+#endif      // VTCLTDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlPanic.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* 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:  Data types for call control
+*
+*/
+
+
+
+#ifndef VTCTLPANIC_H
+#define VTCTLPANIC_H
+
+//  INCLUDES
+
+#include <e32std.h>
+
+// CONSTANTS
+
+/**
+* Panic text
+*/
+_LIT( KVtCtlPanicCategory, "VtCSCall" );
+
+// DATA TYPES
+
+/**
+* Panic values
+*/
+enum TVtCtlPanic {
+    //** Line subsession handle is null */
+    EVtCtlPanicLineHandleNull,
+    /** Call subsession handle is null */
+    EVtCtlPanicCallHandleNull
+    };
+
+// FUNCTION PROTOTYPES
+
+/**
+* Call control panic.
+* @param aPanic panic value
+*/
+void Panic( TVtCtlPanic aPanic );
+
+#endif // VTCTLPANIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlTypes.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* 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:  Data types for call control
+*
+*/
+
+
+#ifndef VTCTLTYPES_H
+#define VTCTLTYPES_H
+
+//  INCLUDES
+#include "VtCtlDefs.h"
+#include "TVtCtlType.h"
+
+/**
+*  CS Session information.
+*
+*  @lib CSCallCtrl
+*  @since 2.6
+*/
+class TVtCtlCSSessionInfoV1 : public TVtCtlType
+    {
+    public: // constructors
+        /**
+        * C++ default contructor.
+        */
+        inline TVtCtlCSSessionInfoV1();
+
+    public: // data members
+
+        // Session duration
+        TVtCtlDuration  iDuration;
+
+        // Address
+        TVtCtlTelNumber iTelNumber;
+
+        // Session state
+        MVtCtlCallControl::TVtCtlState iState;
+
+        // Previous session state
+        MVtCtlCallControl::TVtCtlState iPreviousState;
+
+        // Session direction MO/MT
+        MVtCtlCallControl::TVtCtlDirection iDirection;
+    };
+
+/**
+* Data passed in MVtCtlEventObserver::HandleVtSessionEventL
+* when event is KVtCtlEventSessionStatusChanged.
+*/
+struct TVtCtlSessionStateEvent
+    {
+    /**
+    * Session state
+    */
+    MVtCtlCallControl::TVtCtlState iState;
+    
+    /**
+    * Previous session state
+    */
+    MVtCtlCallControl::TVtCtlState iPreviousState;
+    
+    /**
+    * Session id
+    */
+    TVtCtlSessionId                iSessionId;
+    };
+
+#include "VtCtlTypes.inl"
+
+#endif // VTCTLTYPES_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Inc/VtCtlTypes.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* 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:  Data types for call control
+*
+*/
+
+
+
+// -----------------------------------------------------------------------------
+// TVtCtlCSSessionInfoV1::TVtCtlSessionInfoV1
+// c++ default constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtCtlCSSessionInfoV1::TVtCtlCSSessionInfoV1() 
+    : iDuration( 0 ),
+      iState( MVtCtlCallControl::EUnknown ),
+      iPreviousState( MVtCtlCallControl::EUnknown ),
+      iDirection( MVtCtlCallControl::EDirectionUnknown )
+    {
+    iExtension = EVtCtlCSSessionInfoExtensionId;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlCallControl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,252 @@
+/*
+* 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:  CVtCtlCallControl class implementation.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include <cvtlogger.h>
+#include    "CVtCtlCallControl.h"
+#include    "MVtCtlEventObserver.h"
+#include    "CVtCtlSessionContainer.h"
+#include    "CVtCtlVideoCall.h"
+#include    "VtCtlTypes.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::NewL
+// two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl* CVtCtlCallControl::NewL(
+            MVtCtlEventObserver& aEventObserver )
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.NewL" )
+    CVtCtlCallControl* self = new ( ELeave )
+        CVtCtlCallControl( aEventObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtCtlCallControl.NewL" )
+    return self;
+    }
+        
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::~CVtCtlCallControl
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl::~CVtCtlCallControl()
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.~" )
+    delete iContainer;
+    // uninitialize logging (if enabled)
+    VTLOGUNINIT
+    __VTPRINTEXIT( "CVtCtlCallControl.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::CVtCtlCallControl
+// c++ constructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl::CVtCtlCallControl(
+    MVtCtlEventObserver& aEventObserver ) :
+    iEventObserver( aEventObserver )
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.CVtCtlCallControl" )
+    __VTPRINTEXIT( "CVtCtlCallControl.CVtCtlCallControl" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::ConstructL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::ConstructL()
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.ConstructL" )
+    // initialize logging (if enabled)
+    VTLOGINIT
+    iContainer = CVtCtlSessionContainer::NewL( *this );
+    __VTPRINTEXIT( "CVtCtlCallControl.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetDuration
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlCallControl::GetDuration(
+    TVtCtlSessionId aId,
+    TVtCtlDuration& aDuration )     
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.GetDuration" )
+    CVtCtlVideoCall* call = iContainer->FindCall( aId );
+    TInt err( KErrNotFound );
+    if ( call )
+        {
+        err = call->GetDuration( aDuration );
+        }
+    __VTPRINTEXIT( "CVtCtlCallControl.GetDuration" )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetSessionInfoL
+// 
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CVtCtlCallControl::GetSessionInfoL( 
+    TVtCtlSessionId aId,
+    TDes8& aInfo )
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.GetSessionInfoL" )
+    ValidateDataExtensionL( aInfo, EVtCtlCSSessionInfoExtensionId );
+    CVtCtlVideoCall* call = iContainer->FindCall( aId );
+    if ( call )
+        {
+        TPckg<TVtCtlCSSessionInfoV1>& pckg = 
+            reinterpret_cast<TPckg<TVtCtlCSSessionInfoV1>&>( aInfo );
+        TVtCtlCSSessionInfoV1& info = pckg();
+        TInt err( call->UpdateCallInfo() );
+        if ( err == KErrNone )
+            {
+            const RMobileCall::TMobileCallInfoV1& mobileInfo = call->MobileInfo();
+            info.iDuration = mobileInfo.iDuration;
+            info.iTelNumber = mobileInfo.iRemoteParty.iRemoteNumber.iTelNumber;
+            __VTPRINT2( DEBUG_SESSION, "VtCtl: mobile dir=%d", 
+                mobileInfo.iRemoteParty.iDirection  )
+            switch ( mobileInfo.iRemoteParty.iDirection )
+                {
+                case RMobileCall::EMobileOriginated:
+                    info.iDirection = EDirectionMobileOriginated;
+                    break;
+                case RMobileCall::EMobileTerminated:
+                    info.iDirection = DirectionMobileTerminated;
+                    break;
+                case RMobileCall::EDirectionUnknown:
+                default:
+                    info.iDirection = EDirectionUnknown;
+                    break;
+                }
+            }
+        }
+    else
+        {
+        __VTPRINT( DEBUG_SESSION, "CallCtrl.GetSessionInfoL not found" )
+        User::Leave( KErrNotFound );
+        }
+    __VTPRINTEXIT( "CVtCtlCallControl.GetSessionInfoL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetState
+// 
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtCtlCallControl::GetSessionState( 
+    TVtCtlSessionId aId ) const
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.GetSessionState" )
+    __VTPRINT2( DEBUG_SESSION, "CallCtrl.GetSessionState for id:%d",aId )
+    MVtCtlCallControl::TVtCtlState state = EUnknown;
+    CVtCtlVideoCall* call = iContainer->FindCall( aId );
+    if ( call )
+        {
+        call->GetCallState( state );
+        }
+    __VTPRINT3( DEBUG_SESSION, " callPtr=%d state=%d", (TInt) call, state )
+    __VTPRINTEXIT( "CVtCtlCallControl.GetSessionState" )
+    return state;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetPreviousState
+// 
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtCtlCallControl::GetPreviousPreviousState(
+    TVtCtlSessionId aId ) const
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.GetPreviousPreviousState" )
+    MVtCtlCallControl::TVtCtlState state = EUnknown;
+    const CVtCtlVideoCall* call = iContainer->FindCall( aId );
+    if ( call )
+        {
+        state = call->CallInfo().iPreviousStatus;
+        }
+    __VTPRINTEXIT( "CVtCtlCallControl.GetPreviousPreviousState" )
+    return state;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::HandleCallStatusChangeL
+// Notifies observer about call status change.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::HandleCallStatusChangeL(
+    TVtCtlSessionId aId,
+    MVtCtlCallControl::TVtCtlState aStatus,
+    MVtCtlCallControl::TVtCtlState aPreviousStatus )
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.HandleCallStatusChangeL" )
+    __VTPRINT2( DEBUG_SESSION, " status=%d", (TInt) aStatus )
+    
+    TVtCtlSessionStateEvent event;
+    event.iPreviousState = aPreviousStatus;
+    event.iState = aStatus;
+    event.iSessionId = aId;
+
+    TAny* parameter = &event;
+    iEventObserver.HandleVtSessionEventL(
+        KVtCtlEventSessionStatusChanged,
+        parameter );
+    __VTPRINTEXIT( "CVtCtlCallControl.HandleCallStatusChangeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::ValidateDataExtensionL
+// Validates extension id of descriptor representation of data type.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::ValidateDataExtensionL(
+    TDesC8& aData,
+    TInt aExtension )
+    {
+    __VTPRINTENTER( "CVtCtlCallControl.ValidateDataExtensionL" )
+    TVtCtlType type;
+    TPckg<TVtCtlType> pckg(type);
+    TPtrC8 ptr( aData.Ptr(), sizeof( TVtCtlType ) );
+    pckg.Copy( ptr );
+    if ( type.Extension() != aExtension )
+        {
+        __VTPRINT( DEBUG_SESSION, "CallCtrl.Validate not supported" )
+        User::Leave( KErrNotSupported );
+        }
+    __VTPRINTEXIT( "CVtCtlCallControl.ValidateDataExtensionL" )
+    }
+#pragma CTC ENDSKIP
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlCallControlStub.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,194 @@
+/*
+* 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:  Stub version of call control.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include    "CVtCtlCallControl.h"
+#include    "MVtCtlEventObserver.h"
+#include    "CVtCtlSessionContainer.h"
+#include    "CVtCtlVideoCall.h"
+#include    "VtCtlTypes.h"
+#include    <CVtLogger.h>
+
+// CONSTANTS
+_LIT( KVtCtlStubTelNumber, "0501234567" );
+
+// Duration
+const TInt KVtCtlStubDuration = 5;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::NewL
+// Two-phase constructor.
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl* CVtCtlCallControl::NewL(
+            MVtCtlEventObserver& aEventObserver )
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.NewL" )
+    CVtCtlCallControl* self = new ( ELeave )
+        CVtCtlCallControl( aEventObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtCtlCallControlStub.NewL" )
+    return self;
+    }
+        
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::~CVtCtlCallControl
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl::~CVtCtlCallControl()
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.~" )
+    delete iContainer;
+    // uninitialize logging
+    VTLOGUNINIT
+    __VTPRINTEXIT( "CVtCtlCallControlStub.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::CVtCtlCallControl
+// c++ constructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallControl::CVtCtlCallControl(
+    MVtCtlEventObserver& aEventObserver) :
+    iEventObserver( aEventObserver )
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.CVtCtlCallControl" )
+    __VTPRINTEXIT( "CVtCtlCallControlStub.CVtCtlCallControl" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::ConstructL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::ConstructL()
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.ConstructL" )
+    // initialize logging
+    VTLOGINIT
+    iContainer = CVtCtlSessionContainer::NewL( *this );
+    __VTPRINTEXIT( "CVtCtlCallControlStub.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetDuration
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlCallControl::GetDuration(
+    TVtCtlSessionId ,
+    TVtCtlDuration& aDuration )     
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.GetDuration" )
+    aDuration = 5;
+    __VTPRINTEXIT( "CVtCtlCallControlStub.GetDuration" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetSessionInfoL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::GetSessionInfoL( 
+    TVtCtlSessionId ,
+    TDes8& aInfo )
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.GetSessionInfoL" )
+    
+    TPckg<TVtCtlCSSessionInfoV1>& pckg = 
+        reinterpret_cast<TPckg<TVtCtlCSSessionInfoV1>&>( aInfo );
+    __VTPRINT( DEBUG_SESSION, "VtCtl:CallCtrl. 1" )
+    TVtCtlCSSessionInfoV1& info = pckg();
+    __VTPRINT( DEBUG_SESSION, "VtCtl:CallCtrl. 2" )
+    info.iDirection = MVtCtlCallControl::EDirectionMobileOriginated;
+    info.iDuration = KVtCtlStubDuration;
+    info.iState = MVtCtlCallControl::EConnected;
+    info.iPreviousState = MVtCtlCallControl::EAlerting;
+    info.iTelNumber = KVtCtlStubTelNumber;
+    __VTPRINTEXIT( "CVtCtlCallControlStub.GetSessionInfoL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetState
+// 
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtCtlCallControl::GetSessionState( 
+    TVtCtlSessionId  ) const
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.GetSessionState" )
+    MVtCtlCallControl::TVtCtlState state = MVtCtlCallControl::EConnected;    
+    __VTPRINTEXIT( "CVtCtlCallControlStub.GetSessionState" )
+    return state;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::GetPreviousState
+// 
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtCtlCallControl::GetPreviousPreviousState(
+    TVtCtlSessionId  ) const
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.GetPreviousPreviousState" )
+    MVtCtlCallControl::TVtCtlState state = EAlerting;
+    __VTPRINTEXIT( "CVtCtlCallControlStub.GetPreviousPreviousState" )
+    return state;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::HandleCallStatusChangeL
+// Notifies
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::HandleCallStatusChangeL(
+    TVtCtlSessionId ,
+    MVtCtlCallControl::TVtCtlState ,
+    MVtCtlCallControl::TVtCtlState )
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.HandleCallStatusChangeL" )
+    __VTPRINTEXIT( "CVtCtlCallControlStub.HandleCallStatusChangeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallControl::ValidateDataExtensionL
+// Validates extension id of descriptor representation of data type.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallControl::ValidateDataExtensionL(
+            TDesC8& ,
+            TInt  )
+    {
+    __VTPRINTENTER( "CVtCtlCallControlStub.ValidateDataExtensionL" )
+    __VTPRINTEXIT( "CVtCtlCallControlStub.ValidateDataExtensionL" )
+    }
+#pragma CTC ENDSKIP
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlCallStatusMonitor.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,227 @@
+/*
+* 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:  Monitors call status.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include    "CVtCtlCallStatusMonitor.h"
+#include    "MVtCtlCallStatusObserver.h"
+#include    "VtCtlDefs.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::CVtCtlCallStatusMonitor
+// C++ constructor 
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+CVtCtlCallStatusMonitor::CVtCtlCallStatusMonitor(
+    RMobileCall& aCall,
+    MVtCtlCallStatusObserver& aObserver ) : 
+    CActive( KVtCtlCallStatusMonitorPriority ),
+    iCall( aCall ),
+    iObserver( aObserver ),
+    iCallStatus( RMobileCall::EStatusUnknown ),
+    iPreviousStatus( RMobileCall::EStatusUnknown )
+    {
+    __VTPRINTENTER( "CVtCtlCallStatusMonitor.CVtCtlCallStatusMonitor" )
+    CActiveScheduler::Add( this );
+    __VTPRINTEXIT( "CVtCtlCallStatusMonitor.CVtCtlCallStatusMonitor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::~CVtCtlCallStatusMonitor
+// destructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlCallStatusMonitor::~CVtCtlCallStatusMonitor()
+    {
+    __VTPRINTENTER( "CVtCtlCallStatusMonitor.~" )
+    Cancel();    
+    __VTPRINTEXIT( "CVtCtlCallStatusMonitor.~" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::Start
+// Starts monitoring
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CVtCtlCallStatusMonitor::Start()
+    {
+    __VTPRINTENTER( "CVtCtlCallStatusMonitor.Start" )
+    if ( iPreviousStatus == RMobileCall::EStatusUnknown )
+        {
+        RMobileCall::TMobileCallStatus status( RMobileCall::EStatusUnknown );
+        if ( iCall.GetMobileCallStatus( status ) == KErrNone )
+            {
+            iPreviousStatus = status;
+            }
+        }
+    if ( !IsActive() )
+        {
+        iCall.NotifyMobileCallStatusChange( iStatus, iCallStatus );
+        SetActive();
+        }
+    __VTPRINTEXIT( "CVtCtlCallStatusMonitor.Start" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::DoCancel
+// Cancels monitoring
+// -----------------------------------------------------------------------------
+//
+void CVtCtlCallStatusMonitor::DoCancel()
+    {
+    __VTPRINTENTER( "CVtCtlCallStatusMonitor.DoCancel" )
+    iCall.CancelAsyncRequest( EMobileCallNotifyMobileCallStatusChange );
+    __VTPRINTEXIT( "CVtCtlCallStatusMonitor.DoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::RunL
+// Receives call status change and notifies observer
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CVtCtlCallStatusMonitor::RunL()
+    {
+    __VTPRINTENTER( "CVtCtlCallStatusMonitor.RunL" )
+    __VTPRINT2( DEBUG_SESSION , "CallStatMon.RunL err=%d",iStatus.Int() )
+    __VTPRINT2( DEBUG_SESSION , "CallStatMon.RunL sta=%d",
+        (TInt)iCallStatus )
+    if ( iStatus == KErrNone )
+        {
+        const RMobileCall::TMobileCallStatus cache( iCallStatus );
+        Start();
+        MVtCtlCallControl::TVtCtlState state = MapState( cache );
+        if ( CVtCtlCallStatusMonitor::IsLegalNewState( 
+                cache, iPreviousStatus ) )
+            {
+            iPreviousStatus = cache;
+            if ( state != MVtCtlCallControl::EUnknown )
+                {
+                iObserver.HandleCallStatusChangeL( 
+                    KNullSessionId, // unknown by this
+                    state,
+                    MapState( iPreviousStatus ) );
+                }
+            }
+        }
+    __VTPRINTEXIT( "CVtCtlCallStatusMonitor.RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::RunError
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlCallStatusMonitor::RunError(
+#ifdef VTDEBUG                                       
+    TInt aError )
+#else
+    TInt /*aError*/ )
+#endif
+    {
+    __VTPRINTENTER( "CVtCtlCallStatusMonitor.RunError" )
+    __VTPRINTEXITR( "CVtCtlCallStatusMonitor.RunError err=%d", aError )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::MapState
+// Maps Etel call status to internal type
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+MVtCtlCallControl::TVtCtlState CVtCtlCallStatusMonitor::MapState(
+    const RMobileCall::TMobileCallStatus aStatus )
+    {
+    __VTPRINTENTER( "CVtCtlCallStatusMonitor.MapState" )
+    MVtCtlCallControl::TVtCtlState state( MVtCtlCallControl::EUnknown );
+    switch ( aStatus )
+        {
+        case RMobileCall::EStatusIdle:
+            state = MVtCtlCallControl::EIdle;
+            break;
+        case RMobileCall::EStatusDialling:
+            state = MVtCtlCallControl::EInitializing;
+            break;
+        case RMobileCall::EStatusRinging:
+            state = MVtCtlCallControl::ERinging;
+            break;
+        case RMobileCall::EStatusAnswering:
+            state = MVtCtlCallControl::ERinging;
+            break;
+        case RMobileCall::EStatusConnecting:
+            state = MVtCtlCallControl::EInitializing;
+            break;
+        case RMobileCall::EStatusConnected:
+            state = MVtCtlCallControl::EConnected;
+            break;
+        case RMobileCall::EStatusDisconnecting:
+        case RMobileCall::EStatusDisconnectingWithInband:
+            state = MVtCtlCallControl::EDisconnecting;
+            break;
+        case RMobileCall::EStatusUnknown:
+            state = MVtCtlCallControl::EUnknown;
+            break;
+        default:
+            break;
+        }
+    __VTPRINTEXIT( "CVtCtlCallStatusMonitor.MapState state" )
+    return state;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlCallStatusMonitor::IsLegalNewState
+// Checks if call state transition specified by arguments is legal.
+// -----------------------------------------------------------------------------
+//
+TBool CVtCtlCallStatusMonitor::IsLegalNewState(
+    const RMobileCall::TMobileCallStatus aNewState,
+    const RMobileCall::TMobileCallStatus aCurrentState )
+    {
+    // check state transition priority          
+    const TInt newPrio = KVtCtlStatusTransitionPriorities[ aNewState ];
+    const TInt prevPrio = KVtCtlStatusTransitionPriorities[ aCurrentState ];
+
+    /**
+    * Legal transition if new state is logically consecutive compared to old
+    * state. Exception: transition to idle always possible ( !newPrio )
+    */
+    const TBool isLegal = ( newPrio > prevPrio || !newPrio );
+    return isLegal;
+    }
+#pragma CTC ENDSKIP    
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlFactory.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,70 @@
+/*
+* 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:  CVtCtlFactory class implementation.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include "CVtCtlFactory.h"
+#include "CVtCtlCallControl.h"
+#include <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// MVtCtlCallControl::CreateCallControlL
+// Creates call control.
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl* CVtCtlFactory::CreateCallControlL(
+    MVtCtlEventObserver& aEventObserver )
+    {
+    __VTPRINTENTER( "CVtCtlCallStatusMonitor.IsLegalNewState" )
+    MVtCtlCallControl* control = CVtCtlCallControl::NewL(
+        aEventObserver );
+    __VTPRINTEXIT( "CVtCtlCallStatusMonitor.IsLegalNewState" )
+    return control;
+    }
+
+// -----------------------------------------------------------------------------
+// MVtCtlCallControl::Delete
+// Destructs call control object.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlFactory::Delete( MVtCtlCallControl* aCallControl )
+    {
+    __VTPRINTENTER( "CVtCtlFactory.Delete" )
+    CVtCtlCallControl* callControl =
+        static_cast<CVtCtlCallControl*>( aCallControl );
+    delete callControl;
+    __VTPRINTEXIT( "CVtCtlFactory.Delete" )
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// CreateFactory
+// Returns: Factory for creating and destructing call control.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVtCtlFactory* CreateFactory()
+    {
+    CVtCtlFactory* factory = new CVtCtlFactory;
+    return factory;
+    }
+#pragma CTC ENDSKIP
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlLineMonitor.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,131 @@
+/*
+* 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:  Monitors new calls on data line
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include    "CVtCtlLineMonitor.h"
+#include    "MVtCtlLineEventObserver.h"
+#include    "VtCtlDefs.h"
+#include    <cvtlogger.h>
+#include    <etelmm.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::CVtCtlLineMonitor
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+CVtCtlLineMonitor::CVtCtlLineMonitor( 
+    RMobileLine& aLine,
+    MVtCtlLineEventObserver& aObserver) : 
+    CActive( KVtCtlCallAdditionMonitorPriority ),
+    iLine ( aLine ),
+    iObserver( aObserver ),
+    iLastLineStatus( RMobileCall::EStatusIdle ),
+    iLineStatus( RMobileCall::EStatusIdle )
+    {
+    __VTPRINTENTER( "CVtCtlLineMonitor.CVtCtlLineMonitor" )
+    CActiveScheduler::Add( this );
+    __VTPRINTEXIT( "CVtCtlLineMonitor.CVtCtlLineMonitor" )
+    }
+    
+// Destructor
+CVtCtlLineMonitor::~CVtCtlLineMonitor()
+    {
+    __VTPRINTENTER( "CVtCtlLineMonitor.~" )
+    Cancel();
+    __VTPRINTEXIT( "CVtCtlLineMonitor.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::Start
+// Start monitoring
+// -----------------------------------------------------------------------------
+//
+void CVtCtlLineMonitor::Start()
+    {
+    __VTPRINTENTER( "CVtCtlLineMonitor.Start" )
+    if ( !IsActive() )
+        {      
+        iLine.NotifyMobileLineStatusChange( iStatus, iLineStatus );
+        SetActive();
+        }
+    __VTPRINTEXIT( "CVtCtlLineMonitor.Start" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::DoCancel
+// Stop monitoring
+// -----------------------------------------------------------------------------
+//
+void CVtCtlLineMonitor::DoCancel()
+    {
+    __VTPRINTENTER( "CVtCtlLineMonitor.DoCancel" )
+    iLine.CancelAsyncRequest( EMobileLineNotifyMobileLineStatusChange );
+    __VTPRINTEXIT( "CVtCtlLineMonitor.DoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::RunL
+// Notifies observer on the event.
+// -----------------------------------------------------------------------------
+//
+void CVtCtlLineMonitor::RunL()
+    {
+    __VTPRINTENTER( "CVtCtlLineMonitor.RunL" )
+    __VTPRINT2( DEBUG_SESSION , "VtCtl:LineMon.RunL %d", iStatus.Int() )
+    if ( iStatus == KErrNone )
+        {
+        if ( iLineStatus != iLastLineStatus )
+            {
+            iObserver.HandleLineEventL( 
+                MVtCtlLineEventObserver::ELineEventStatusChange, iLineStatus );
+            iLastLineStatus = iLineStatus;
+            }
+        Start();
+        }    
+    __VTPRINTEXIT( "CVtCtlLineMonitor.RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlLineMonitor::RunError
+// Starts monitoring after error
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlLineMonitor::RunError( 
+#ifdef VTDEBUG
+    TInt aError )
+#else
+    TInt )
+#endif
+    {    
+    __VTPRINTENTER( "CVtCtlLineMonitor.RunError" )
+    Start();
+    __VTPRINTEXITR( "CVtCtlLineMonitor.RunError err=%d", aError )
+    return KErrNone;
+    }
+#pragma CTC ENDSKIP
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlSessionContainer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,457 @@
+/*
+* Copyright (c) 2004 - 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:  Container for ETel session and subsessions.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include    "CVtCtlSessionContainer.h"
+#include    "CVtCtlLineMonitor.h"
+#include    "CVtCtlVideoCall.h"
+#include    <mmtsy_names.h>
+#include    <cvtlogger.h>
+
+// CONSTANTS
+
+// Retrials for connecting to ETel server
+const TInt KVtCtlETelConnectRetrials = 5;
+
+// Granularity
+const TInt KVtCtlMaxCalls = 5;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::CVtCtlSessionContainer
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtCtlSessionContainer::CVtCtlSessionContainer(
+    MVtCtlCallStatusObserver& aObserver ) :
+    iCalls( KVtCtlMaxCalls ), 
+    iObserver( aObserver )
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.CVtCtlSessionContainer" )
+    __VTPRINTEXIT( "CVtCtlSessionContainer.CVtCtlSessionContainer" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CVtCtlSessionContainer::ConstructL()
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.ConstructL" )
+    TInt retries( KVtCtlETelConnectRetrials );
+    TInt err( KErrNone );
+    while ( retries-- && 
+            iServer.Handle() == KNullHandle )
+        {
+        err = iServer.Connect();        
+        }
+    User::LeaveIfError( err );
+    User::LeaveIfError( iServer.LoadPhoneModule( KMmTsyModuleName() ) );
+    User::LeaveIfError( iPhone.Open( iServer, KMmTsyPhoneName() ) );
+    User::LeaveIfError( iLine.Open( iPhone, KMmTsyDataLineName() ) );
+
+    iLineMonitor = new ( ELeave ) CVtCtlLineMonitor( iLine, *this );
+    iLineMonitor->Start();
+
+    RMobileCall::TMobileCallStatus lineStatus;
+    User::LeaveIfError( iLine.GetMobileLineStatus( lineStatus ) );
+    if ( lineStatus != RMobileCall::EStatusIdle )
+        {
+        __VTPRINT( DEBUG_SESSION | DEBUG_CONSTRUCT, 
+            "VtCtl:SesConL line active" )
+        TInt calls( 0 );
+        User::LeaveIfError( iLine.EnumerateCall( calls ) );
+        while ( calls-- )
+            {
+            RLine::TCallInfo callInfo;
+            iLine.GetCallInfo( calls, callInfo );
+            if ( InitCallL( callInfo.iCallName ) )
+                {
+                __VTPRINT( DEBUG_SESSION | DEBUG_CONSTRUCT, 
+                    "VtCtl:SesConL call found and created" )
+                calls = 0;
+                }
+            }
+        }
+
+    __VTPRINTEXIT( "CVtCtlSessionContainer.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtCtlSessionContainer* CVtCtlSessionContainer::NewL( 
+    MVtCtlCallStatusObserver& aObserver )
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.NewL" )
+    CVtCtlSessionContainer* self = 
+        new ( ELeave ) CVtCtlSessionContainer( aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    __VTPRINTEXIT( "CVtCtlSessionContainer.NewL" )
+    return self;
+    }
+
+    
+// Destructor
+CVtCtlSessionContainer::~CVtCtlSessionContainer()
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.~" )
+
+    TInt count( iCalls.Count() );
+    CVtCtlVideoCall* call = NULL;
+    while ( count-- )
+        {
+        call = iCalls[count];
+        delete call;
+        }
+    iCalls.Close();
+    delete iLineMonitor;
+    iLine.Close();
+    iPhone.Close();    
+    iServer.UnloadPhoneModule( KMmTsyModuleName() );
+    iServer.Close();
+    __VTPRINTEXIT( "CVtCtlSessionContainer.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::HandleLineEventL
+// Handle new call on data line
+// -----------------------------------------------------------------------------
+//
+void CVtCtlSessionContainer::HandleLineEventL(
+    const TLineEvent aEvent, 
+    TDesC& aCallName )
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.HandleLineEventL" )
+    if ( aEvent == ELineEventCallAdded )
+        {
+        CVtCtlVideoCall* call = FindCall( aCallName );
+        if ( call == NULL )
+            {
+            InitCallL( aCallName );
+            }
+        }
+    __VTPRINTEXITR( "CVtCtlSessionContainer.HandleLineEventL event=%d", 
+        aEvent )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::HandleLineEventL
+// 
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CVtCtlSessionContainer::HandleLineEventL( 
+    const TLineEvent aEvent, 
+    const RMobileCall::TMobileCallStatus aStatus )
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.HandleLineEventL" )
+    __VTPRINT3( DEBUG_SESSION, "SesCont.LineEvent2 event=%d,status=%d",
+        (TInt) aEvent,
+        (TInt) aStatus )
+    if ( aEvent == ELineEventStatusChange && 
+         ( aStatus == RMobileCall::EStatusRinging ||
+           aStatus == RMobileCall::EStatusDialling ) )
+        {
+        TInt calls( 0 );
+        iLine.EnumerateCall( calls );
+        while ( calls-- )
+            {
+            RLine::TCallInfo callInfo;
+            TInt err( iLine.GetCallInfo( calls, callInfo ) );
+            // ensure we're opening correct call
+            if ( err == KErrNone &&
+               ( callInfo.iStatus == RCall::EStatusDialling ||
+                 callInfo.iStatus == RCall::EStatusRinging ) )
+                {
+                calls = 0; // break
+                CVtCtlVideoCall* call = FindCall( callInfo.iCallName );
+                if ( call == NULL )
+                    {
+                    InitCallL( callInfo.iCallName );
+                    }
+                }
+            }        
+        }
+    __VTPRINTEXIT( "CVtCtlSessionContainer.HandleLineEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::HandleCallStatusChangeL
+// passes call status change event to observer
+// -----------------------------------------------------------------------------
+//
+void CVtCtlSessionContainer::HandleCallStatusChangeL( 
+    TVtCtlSessionId aId,
+    MVtCtlCallControl::TVtCtlState aStatus,
+    MVtCtlCallControl::TVtCtlState aPreviousStatus )
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.HandleCallStatusChangeL" )
+    iObserver.HandleCallStatusChangeL( aId, aStatus, aPreviousStatus );
+    if ( aStatus == MVtCtlCallControl::EIdle )
+        {
+        DestructCall( aId );
+        }
+    __VTPRINTEXIT( "CVtCtlSessionContainer.HandleCallStatusChangeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::FindCall
+// Finds call by name
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+CVtCtlVideoCall* CVtCtlSessionContainer::FindCall( TDesC& aCallName ) const
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.FindCall" )
+    TInt count( iCalls.Count() );
+    CVtCtlVideoCall* call = NULL;
+    while ( count-- )
+        {
+        call = iCalls[count];
+        const RMobileCall::TMobileCallInfoV1& mobileInfo = call->MobileInfo();
+        if ( aCallName == mobileInfo.iCallName )
+            {
+            count = 0; // break
+            }
+        else
+            {
+            call = NULL;
+            }
+        }
+    __VTPRINT2( DEBUG_SESSION | DEBUG_DETAIL, 
+        "SesCont.FindCall by name --> %d",(TInt)call )
+    __VTPRINTEXIT( "CVtCtlSessionContainer.FindCall" )
+    return call;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::FindCall
+// Finds call by id.
+// -----------------------------------------------------------------------------
+//
+CVtCtlVideoCall* CVtCtlSessionContainer::FindCall( TVtCtlSessionId aId ) const
+    {    
+    __VTPRINTENTER( "CVtCtlSessionContainer.FindCall" )
+    TInt count( iCalls.Count() );
+    CVtCtlVideoCall* call = NULL;
+    if ( aId == KActiveSessionId && count == 1 )
+        {
+        call = iCalls[0];
+        count = 0;
+        }
+    while ( count-- )
+        {
+        call = iCalls[count];
+        const CVtCtlVideoCall::TVtCtlCallInfo& info =
+            call->CallInfo();
+        if ( aId == info.iId )
+            {
+            count = 0; // break
+            }
+        else
+            {
+            call = NULL;
+            }
+        }
+    __VTPRINT2( DEBUG_SESSION | DEBUG_DETAIL, 
+        "SesCont.FindCall by id --> %d",(TInt)call )
+    __VTPRINTEXIT( "CVtCtlSessionContainer.FindCall" )
+    return call;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::Sessions
+// Returns sessions.
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlSessionContainer::GetSessions( RVtCtlSessionIdArray& aArray ) const
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.GetSessions" )
+    const TInt count( iCalls.Count() );
+    for ( TInt ii = 0; ii < count; ii++ )
+        {
+        TInt err( aArray.Append( iCalls[ii]->CallInfo().iId ) );
+        if ( err != KErrNone )
+            {
+            __VTPRINTEXIT( "CVtCtlSessionContainer.GetSessions" )
+            return err;
+            }
+        }
+    __VTPRINTEXIT( "CVtCtlSessionContainer.GetSessions" )
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::DestructCall
+// Destructs call
+// -----------------------------------------------------------------------------
+//
+void CVtCtlSessionContainer::DestructCall( TVtCtlSessionId aId )
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.DestructCall" )
+    TInt count( iCalls.Count() );
+    CVtCtlVideoCall* call = NULL;
+    while ( count-- )
+        {
+        call = iCalls[count];
+        const CVtCtlVideoCall::TVtCtlCallInfo& info =
+            call->CallInfo();
+        if ( aId == info.iId )
+            {
+            delete call;
+            iCalls.Remove( count );
+            count = 0; // break
+            }
+        }
+    __VTPRINTEXIT( "CVtCtlSessionContainer.DestructCall" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::CheckCallTypeL
+// Checks call type
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+TBool CVtCtlSessionContainer::CheckCallTypeL( 
+    RMobileCall& aCall, 
+    const TName& aName )
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.CheckCallTypeL" )
+    User::LeaveIfError( aCall.OpenExistingCall( iLine, aName ) );
+    TBool typeOk( EFalse );
+    RMobileCall::TMobileCallDataCapsV1 caps;
+    RMobileCall::TMobileCallDataCapsV1Pckg pckg( caps );
+    User::LeaveIfError( aCall.GetMobileDataCallCaps( pckg ) );
+    __VTPRINT3( DEBUG_SESSION | DEBUG_DETAIL,
+        "SesCont.ChkCall speedCaps=%d,protCaps=%d", 
+        caps.iSpeedCaps, caps.iProtocolCaps )    
+    if ( caps.iProtocolCaps & RMobileCall::KCapsIsdnMultimedia )
+        {
+        typeOk = ETrue;
+        }
+    else
+        {        
+        aCall.Close();
+        }
+    __VTPRINTEXIT( "CVtCtlSessionContainer.CheckCallTypeL" )
+    return typeOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::InitCallL
+// Initializes call if it is video call.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+TBool CVtCtlSessionContainer::InitCallL( const TName& aCallName )
+    {
+    __VTPRINTENTER( "CVtCtlSessionContainer.InitCallL" )
+    RMobileCall* mobilecall = new ( ELeave ) RMobileCall;
+    CleanupStack::PushL( mobilecall );
+
+    // check that type is multimedia call
+    const TBool callTypeOk = CheckCallTypeL( *mobilecall, aCallName );
+    if ( callTypeOk )
+        {
+        __VTPRINT( DEBUG_SESSION | DEBUG_DETAIL,
+            "SesCont.InitCall ok" )
+        TVtCtlSessionId id = iSessionIds.Create();
+        CVtCtlVideoCall* call = CVtCtlVideoCall::NewL( 
+            iLine, id, *this );
+        CleanupStack::PushL( call );
+        User::LeaveIfError( iCalls.Append( call ) );
+        call->InitializeCallL( *mobilecall ); // takes ownership
+        const CVtCtlVideoCall::TVtCtlCallInfo& callInfo = call->CallInfo();
+        iObserver.HandleCallStatusChangeL( 
+            id, callInfo.iStatus, callInfo.iPreviousStatus );
+        CleanupStack::Pop(2); // mobilecall, call
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy(); // mobilecall
+        }
+    __VTPRINTEXIT( "CVtCtlSessionContainer.InitCallL" )
+    return callTypeOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::TVtCtlSessionIdentities::TVtCtlSessionIdentities
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CVtCtlSessionContainer::TVtCtlSessionIdentities::TVtCtlSessionIdentities() 
+    : iCurrentId( 0 )
+    {
+    __VTPRINTENTER( "TVtCtlSessionIdentities.TVtCtlSessionIdentities" )
+    __VTPRINTEXIT( "TVtCtlSessionIdentities.TVtCtlSessionIdentities" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::TVtCtlSessionIdentities::Create
+// Increment session id.
+// -----------------------------------------------------------------------------
+//
+TVtCtlSessionId CVtCtlSessionContainer::TVtCtlSessionIdentities::Create()
+    {
+    __VTPRINTENTER( "TVtCtlSessionIdentities.Create" )
+    __VTPRINTEXIT( "TVtCtlSessionIdentities.Create" )
+    return ++iCurrentId;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlSessionContainer::TVtCtlSessionIdentities::Current
+// Return current session id.
+// -----------------------------------------------------------------------------
+//
+TVtCtlSessionId CVtCtlSessionContainer::TVtCtlSessionIdentities::Current() const
+    {
+    __VTPRINTENTER( "TVtCtlSessionIdentities.Current" )
+    __VTPRINTEXIT( "TVtCtlSessionIdentities.Current" )
+    return iCurrentId;
+    }
+#pragma CTC ENDSKIP
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/CVtCtlVideoCall.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,242 @@
+/*
+* 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:  Video call abstraction implementation.
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include    "CVtCtlVideoCall.h"
+#include    "CVtCtlCallStatusMonitor.h"
+#include    "VtCtlPanic.h"
+#include    "cvtlogger.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::CVtCtlVideoCall
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+CVtCtlVideoCall::CVtCtlVideoCall( 
+    RMobileLine& aDataLine,
+    TVtCtlSessionId aId,
+    MVtCtlCallStatusObserver& aObserver ) 
+    : iLine( aDataLine ), iObserver( aObserver )
+    {
+    __VTPRINTENTER( "CVtCtlVideoCall.CVtCtlVideoCall" )
+    iCallInfo.iId = aId;
+    __VTPRINTEXIT( "CVtCtlVideoCall.CVtCtlVideoCall" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+CVtCtlVideoCall* CVtCtlVideoCall::NewL( 
+    RMobileLine& aDataLine,
+    TVtCtlSessionId aId,
+    MVtCtlCallStatusObserver& aObserver )
+    {
+    __VTPRINTENTER( "CVtCtlVideoCall.NewL" )
+    CVtCtlVideoCall* self = new( ELeave ) 
+        CVtCtlVideoCall( aDataLine, aId, aObserver );
+    __VTPRINTEXIT( "CVtCtlVideoCall.NewL" )
+    return self;
+    }
+
+    
+// Destructor
+CVtCtlVideoCall::~CVtCtlVideoCall()
+    {
+    __VTPRINTENTER( "CVtCtlVideoCall.~" )
+    __VTPRINT( DEBUG_SESSION | DEBUG_DESTRUCT, "VtCtl:Call~")
+    delete iStatusMonitor;
+    if ( iCall )
+    	{
+    	iCall->Close();
+    	delete iCall;
+    	}
+    __VTPRINTEXIT( "CVtCtlVideoCall.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::CallInfo
+// Returns call information containing information not associated to ETel
+// -----------------------------------------------------------------------------
+//
+const CVtCtlVideoCall::TVtCtlCallInfo& CVtCtlVideoCall::CallInfo() const
+    {
+    return iCallInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::MobileInfo
+// Returns ETel call information.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+const RMobileCall::TMobileCallInfoV1& CVtCtlVideoCall::MobileInfo() const
+    {
+    return iMobileCallInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::InitializeCallL
+// Opens call subsession and starts status monitor.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CVtCtlVideoCall::InitializeCallL( 
+    RMobileCall& aCall )
+    {
+    __VTPRINTENTER( "CVtCtlVideoCall.InitializeCallL" )
+    __ASSERT_ALWAYS( iLine.SubSessionHandle(), 
+        Panic( EVtCtlPanicLineHandleNull ) );
+    iCall = &aCall;
+    iStatusMonitor = new ( ELeave ) CVtCtlCallStatusMonitor( *iCall, *this );
+    iStatusMonitor->Start();
+    UpdateCallInfo();
+    iCallInfo.iPreviousStatus = MVtCtlCallControl::EIdle;
+    iCallInfo.iStatus = 
+        CVtCtlCallStatusMonitor::MapState( iMobileCallInfo.iStatus );
+
+    __VTPRINTEXIT( "CVtCtlVideoCall.InitializeCallL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::UpdateCallInfo
+// Updates call information from ETel
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+TInt CVtCtlVideoCall::UpdateCallInfo()
+    {
+    __VTPRINTENTER( "CVtCtlVideoCall.UpdateCallInfo" )
+    __ASSERT_ALWAYS( iCall->SubSessionHandle(), 
+        Panic( EVtCtlPanicCallHandleNull ) );
+        
+    RMobileCall::TMobileCallInfoV1Pckg pckg( iMobileCallInfo );
+    const TInt err( iCall->GetMobileCallInfo( pckg ) );
+    __VTPRINT2( DEBUG_SESSION, "VtCtl:Call. dir %d",
+        iMobileCallInfo.iRemoteParty.iDirection )
+    __VTPRINT2( DEBUG_SESSION, "VtCtl:Call. status %d",
+        iMobileCallInfo.iStatus )
+#ifdef VTDEBUG
+    RDebug::Print(_L(" VtCtl.RemoteNumber=%S"),
+        &iMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber );
+#endif
+    __VTPRINTEXITR( "CVtCtlVideoCall.UpdateCallInfo err=%d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::GetDuration
+// Returns call duration
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlVideoCall::GetDuration( TVtCtlDuration& aDuration )
+    {
+    __VTPRINTENTER( "CVtCtlVideoCall.GetDuration" )
+    const TInt res( UpdateCallInfo() );
+    if ( res == KErrNone )
+        {
+        aDuration = iMobileCallInfo.iDuration;
+        }
+    __VTPRINTEXITR( "CVtCtlVideoCall.GetDuration err=%d", res )
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::GetCallState
+// Gets call state
+// -----------------------------------------------------------------------------
+//
+TInt CVtCtlVideoCall::GetCallState( 
+    MVtCtlCallControl::TVtCtlState& aState )
+    {
+    __VTPRINTENTER( "CVtCtlVideoCall.GetCallState" )
+    RMobileCall::TMobileCallStatus status;
+    aState = iCallInfo.iStatus;    
+    const TInt res( iCall->GetMobileCallStatus( status ) );
+    
+    // update internal state only if differs from previous state
+    if ( res == KErrNone &&
+         CVtCtlCallStatusMonitor::IsLegalNewState( 
+            status, iMobileCallInfo.iStatus ) )
+        {
+        // update 1) internal values, and
+        iMobileCallInfo.iStatus = status;        
+        iCallInfo.iPreviousStatus = iCallInfo.iStatus;
+        iCallInfo.iStatus = CVtCtlCallStatusMonitor::MapState( status );
+
+        // 2) return value
+        aState = iCallInfo.iStatus;                    
+        }
+    __VTPRINTEXITR( "CVtCtlVideoCall.GetCallState err=%d", res )
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCtlVideoCall::HandleCallStatusChangeL
+// Handles status change
+// -----------------------------------------------------------------------------
+//
+void CVtCtlVideoCall::HandleCallStatusChangeL( 
+    TVtCtlSessionId ,
+    MVtCtlCallControl::TVtCtlState aStatus,
+    MVtCtlCallControl::TVtCtlState aPreviousStatus )
+    {
+    __VTPRINTENTER( "CVtCtlVideoCall.HandleCallStatusChangeL" )
+    // If monitor has received outdated notification ignore the event.
+    // This may happen if call status has asked from ETel and there
+    // are still old completed status notifications that are not handled.
+    // => contradition between internal status in this object and one 
+    //    received from ststus monitor. Ignore it.
+    if ( aStatus > iCallInfo.iStatus || aStatus == MVtCtlCallControl::EIdle )
+        {
+        iCallInfo.iPreviousStatus = iCallInfo.iStatus;
+        iCallInfo.iStatus = aStatus;
+
+        iObserver.HandleCallStatusChangeL( 
+            iCallInfo.iId, 
+            aStatus,
+            aPreviousStatus );
+        }
+    __VTPRINTEXIT( "CVtCtlVideoCall.HandleCallStatusChangeL" )
+    }
+#pragma CTC ENDSKIP
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/CallCtrl/Src/VtCtlPanic.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* 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:  Call control panic
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include    "VtCtlPanic.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Panic
+// 
+// -----------------------------------------------------------------------------
+//
+void Panic( TVtCtlPanic aPanic )
+    {
+    User::Panic( KVtCtlPanicCategory(), aPanic );
+    }
+#pragma CTC ENDSKIP
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/EABI/videotelengU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,8 @@
+EXPORTS
+	_ZN11CVtEngModel4NewLER19MVtEngEventObserverR21MVtEngCommandObserver @ 1 NONAME
+	_ZN11CVtEngModel9ExtensionERK4TUid @ 2 NONAME
+	_ZNK11CVtEngModel14CommandHandlerEv @ 3 NONAME
+	_ZNK11CVtEngModel5AudioEv @ 4 NONAME
+	_ZNK11CVtEngModel5MediaEv @ 5 NONAME
+	_ZNK11CVtEngModel7SessionEv @ 6 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2004 - 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:  videoteleng build information file.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+
+../Inc/Base/VtEngEvents.h                    |../../../inc/vtengevents.h
+../Inc/Base/CVtEngModel.h                    |../../../inc/cvtengmodel.h
+../Inc/Base/MVtEngEventObserver.h            |../../../inc/mvtengeventobserver.h
+../Inc/Commands/vtengcommands.h              |../../../inc/vtengcommands.h
+../Inc/Commands/MVtEngCommandHandler.h       |../../../inc/mvtengcommandhandler.h
+../Inc/Commands/MVtEngCommandObserver.h      |../../../inc/mvtengcommandobserver.h
+../Inc/Session/MVtEngSessionInfo.h           |../../../inc/mvtengsessioninfo.h
+../Inc/Audio/MVtEngAudio.h                   |../../../inc/mvtengaudio.h
+../Inc/Media/MVtEngMedia.h                   |../../../inc/mvtengmedia.h
+../Inc/Media/MVtEngFrameObserver.h           |../../../inc/mvtengframeobserver.h
+../Inc/Media/TVtEngRendering.h               |../../../inc/tvtengrendering.h
+../Inc/Media/TVtEngRendering.inl             |../../../inc/tvtengrendering.inl
+../Inc/Media/TVtEngRenderingDSA.h            |../../../inc/tvtengrenderingdsa.h
+../Inc/Media/TVtEngRenderingDSA.inl          |../../../inc/tvtengrenderingdsa.inl
+../Inc/Media/TVtEngRenderingDP.h             |../../../inc/tvtengrenderingdp.h
+../Inc/Media/TVtEngRenderingDP.inl           |../../../inc/tvtengrenderingdp.inl
+../Inc/Media/TVtEngRenderingNGA.h             |../../../inc/tvtengrenderingnga.h
+../Inc/Media/TVtEngRenderingNGA.inl           |../../../inc/tvtengrenderingnga.inl
+../Inc/Extensions/MVtEngCameraPreferences.h  |../../../inc/mvtengcamerapreferences.h
+../Inc/Extensions/mvtengrecord2file.h  		 |../../../inc/mvtengrecord2file.h
+
+
+../data/videoteleng_stub.SIS                 /epoc32/data/z/system/install/videoteleng_stub.sis
+
+../Logger/Inc/cvtlogger.h                    |../../../inc/cvtlogger.h
+../Logger/Inc/vtlogger.hrh                   |../../../inc/vtlogger.hrh
+
+// Export IBY file
+../Rom/videoteleng.iby                       CORE_APP_LAYER_IBY_EXPORT_PATH(videoteleng.iby)
+
+PRJ_MMPFILES
+
+../Logger/Group/vtlogger.mmp
+../CallCtrl/Group/videocallctrl.mmp
+../Group/videoteleng.mmp
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Group/videoteleng.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* 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:  This is project specification file for the Videoteleng.
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../Inc/Base/VtEngDefs.hrh"
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+TARGET          videoteleng.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x101F867F
+
+SOURCEPATH      ../Src/Audio
+SOURCE          CVtEngAudioHandler.cpp
+
+SOURCEPATH      ../Src/Base
+SOURCE          CVtEngModel.cpp
+SOURCE          CVtEngEventManager.cpp
+SOURCE          CVtEngHandlerContainer.cpp
+SOURCE          CVtEngSettings.cpp
+SOURCE          CVtEngPubSubsListener.cpp
+SOURCE			cvtengincomingcallmonitor.cpp
+
+SOURCE			cvtengmdtrcommandsender.cpp
+SOURCE			cvtengmdtrmessagelistener.cpp
+SOURCE			cvtengmediatorservice.cpp
+SOURCE          CVtEngAccessoryHandler.cpp
+
+SOURCE          CVtEngCRProxy.cpp
+SOURCE			CVtEngCRObserverItem.cpp
+SOURCE          CVtEngInitializer.cpp
+SOURCE          CVtEngSATClient.cpp
+SOURCE          CVtEngDeviceLockMonitor.cpp
+SOURCE          VtEngUtils.cpp
+
+SOURCEPATH      ../Src/Commands
+SOURCE          CVtEngCommandHandler.cpp
+SOURCE          CVtEngOperation.cpp
+SOURCE          cvtenginternaloperation.cpp
+SOURCE          TVtEngOperationUtils.cpp
+
+SOURCEPATH      ../Src/Extensions
+SOURCE          CVtEngExtensions.cpp
+SOURCE          CVtEngExtensionBase.cpp
+SOURCE          CVtEngCameraPreferences.cpp
+#if defined (RD_VT_RTF)
+SOURCE			cvtengrecord2file.cpp
+SOURCE  		cvtengr2ftoneplayer.cpp
+#endif // RD_VT_RTF
+
+
+SOURCEPATH      ../Src/Media
+SOURCE          CVtEngMediaHandler.cpp
+SOURCE          CVtEngDrawDP.cpp
+SOURCE          CVtEngDrawDSA.cpp
+SOURCE          CVtEngDrawNGA.cpp
+SOURCE          CVtEngDtmfHandler.cpp
+SOURCE          CVtEngLocalVideo.cpp
+SOURCE          CVtEngRemoteVideo.cpp
+SOURCE          CVtEngImageScaler.cpp
+
+SOURCEPATH      ../Src/Session
+SOURCE          CVtEngSessionHandler.cpp
+
+SOURCEPATH      ../Src/State
+SOURCE          CVtEngStateManager.cpp
+SOURCE          CVtEngStateAlerting.cpp
+SOURCE          CVtEngStateBase.cpp
+SOURCE          CVtEngStateClearing.cpp
+SOURCE          CVtEngStateConnected.cpp
+SOURCE          CVtEngStateIdle.cpp
+SOURCE          CVtEngStateInitializing.cpp
+SOURCE          CVtEngStateNegotiating.cpp
+SOURCE          CVtEngStateOpen.cpp
+SOURCE          CVtEngStateRinging.cpp
+SOURCE          CVtEngDtmfState.cpp
+SOURCE          CVtEngDtmfIdle.cpp
+SOURCE          CVtEngDtmfSending.cpp
+SOURCE          CVtEngDtmfBuffered.cpp
+
+DOCUMENT        ../../Group/bld.inf
+
+USERINCLUDE     ../Inc/Base
+USERINCLUDE     ../Inc/Audio
+USERINCLUDE     ../Inc/Commands
+USERINCLUDE     ../Inc/Session
+USERINCLUDE     ../Inc/Media
+USERINCLUDE     ../Inc/State
+USERINCLUDE     ../Inc/Extensions
+USERINCLUDE     ../CallCtrl/Inc
+
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+SYSTEMINCLUDE   /epoc32/include/mmf/server
+
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+LIBRARY ws32.lib
+LIBRARY videosource.lib
+LIBRARY bitgdi.lib
+LIBRARY displaysink.lib
+LIBRARY featmgr.lib
+LIBRARY phoneclient.lib
+LIBRARY dsclient.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
+LIBRARY sysutil.lib
+LIBRARY centralrepository.lib
+LIBRARY cenrepnotifhandler.lib
+
+LIBRARY	commonengine.lib
+LIBRARY mediaclientaudio.lib
+
+LIBRARY accclient.lib
+LIBRARY telephonyaudiorouting.lib
+
+LIBRARY vtimagetransforms.lib
+
+DEBUGLIBRARY vtlogger.lib
+
+
+LIBRARY satclient.lib
+
+LIBRARY esock.lib // BigEndian
+
+LIBRARY mmfdevsound.lib
+
+LIBRARY gdi.lib
+
+LIBRARY mediatorclient.lib
+LIBRARY videotelproto.lib
+LIBRARY surfaceupdateclient.lib
+LIBRARY surfacemanager.lib
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Audio/CVtEngAudioHandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,304 @@
+/*
+* 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:  Audio handler class.
+*
+*/
+
+
+
+#ifndef CVTENGAUDIOHANDLER_H
+#define CVTENGAUDIOHANDLER_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    "MVtEngAudio.h"
+#include    "CVtEngOperation.h"
+#include    "MVtEngSettingPSObserver.h"
+#include    "CVTEngPubSubsListener.h"
+#include    "CVtEngAccessoryHandler.h"
+#include    "MVtEngAccessoryObserver.h"
+// new audio routing
+#include    "telephonyaudiorouting.h"
+#include    "mtelephonyaudioroutingobserver.h"
+#include    <rphcltserver.h>
+#include    <mmf/server/sounddevice.h>
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+class CRoutingEnabler;
+
+/**
+*  Class for audio handling.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngAudioHandler )
+    : public CBase,
+      public MVtEngAudio,
+      private MVtEngAccessoryObserver,
+      private MTelephonyAudioRoutingObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CVtEngAudioHandler* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngAudioHandler();
+
+    public: // New functions.
+
+        /**
+        * Performs on operation in the handler.
+        * @param operation to be performed on the handler
+        */
+        void HandleL( CVtEngOperation& aOperation );
+
+        /**
+        * Creates/releases temporary DevSound instance.
+        * @param aEnable
+        *   ETrue creates devSound
+        *   EFalse destructs devSound
+        */
+        void SetRoutingEnablerL( const TBool aEnable );
+
+        /**
+        * Increases audio volume
+        */
+        TBool IncreaseVolume();
+
+        /**
+        * Decreases audio volume
+        */
+        TBool DecreaseVolume();
+
+    private: // Functions from base classes.
+
+        // from MVtEngAccessoryObserver
+
+        /** @see MVtEngAccessoryObserver */
+        virtual void AccessoryModeChanged( const TAccMode& aMode,
+            const TBool aActivated );
+
+        // from MTelephonyAudioRoutingObserver
+
+        /** @see MTelephonyAudioRoutingObserver::AvailableOutputsChanged */
+		virtual void AvailableOutputsChanged( CTelephonyAudioRouting& aTelephonyAudioRouting );
+
+        /** @see MTelephonyAudioRoutingObserver::OutputChanged */
+		virtual void OutputChanged( CTelephonyAudioRouting& aTelephonyAudioRouting );
+
+        /** @see MTelephonyAudioRoutingObserver::SetOutputComplete */
+		virtual void SetOutputComplete( CTelephonyAudioRouting& aTelephonyAudioRouting,
+		    TInt aError );
+
+    public: // Functions from base classes.
+
+        /** @see MVtEngAudio::GetRoutingState. */
+        virtual TInt GetRoutingState( TAudioRoutingState& aAudioRoutingState );
+
+        /** @see MVtEngAudio::GetRoutingAvailability. */
+        virtual TInt GetRoutingAvailability(
+            const TAudioRoutingState aAudioRoutingState,
+            TBool& aAvailable );
+
+        /** @see MVtEngAudio::GetHeadsetType. */
+        virtual TInt GetHeadsetType( TWiredHeadsetType& aHeadsetType );
+
+        /** @see MVtEngAudio::OutputVolume. */
+        virtual TInt OutputVolume( const TBool aHandsetVolume ) const;
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngAudioHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Completes operation.
+        * @param aResult error code
+        */
+        void CompleteOperation( TInt aResult );
+
+        /**
+        * Sets loudspeaker on / off.
+        * @param aTurnOn ETrue if on, EFalse if off
+        * @param aShowNote ETrue if note is allowed to be shown, EFalse if not
+        */
+        void SetLoudspeakerL( TBool aTurnOn, TBool aShowNote );
+
+        /**
+        * Sets Bluetooth on / off.
+        * @param aTurnOn ETrue if on, EFalse if off
+        */
+        void SetBluetoothL( TBool aTurnOn );
+
+        /**
+        * Updates current volume that should be used.
+        */
+        void UpdateCurrentVolume();
+
+        /**
+        * Checks if given audio output route is available.
+        * @return ETrue if given audio output route is available
+        */
+        TBool IsOutputAvailable( const CTelephonyAudioRouting::TAudioOutput aOutput );
+
+        /**
+        * Modifies the volume by aDelta.
+        */
+        TBool AdjustVolume( const TInt aDelta );
+
+    private: // Data
+
+        // Enumeration flags used in the implementation.
+        enum
+            {
+            // Handset
+            EFlagHandset = 1,
+            // Loudspeaker
+            EFlagLoudspeaker = 2,
+            // Bluetooth handsfree
+            EFlagBT = 4,
+            // Wired headset
+            EFlagWiredHeadset = 8
+            };
+
+        // Accessory mode listener class.
+        CVtEngAccessoryHandler* iAccHandler;
+
+        // Contains the current accessory and it's audio mode.
+        TAccPolAccessoryMode iAccMode;
+
+        // Pointer to telephony audio routing instance
+        CTelephonyAudioRouting* iTelephonyAudioRouting;
+
+        // Current audio routing state
+        CTelephonyAudioRouting::TAudioOutput iCurrentAudioOutput;
+
+        // Holds old routing state.
+        TAudioRoutingState iOldAudioRoutingState;
+
+        // Pointer to an operation.
+        CVtEngOperation* iOperation;
+
+        /**
+        * For enabling audio routing before actual
+        * DevSound for play is created.
+        */
+        CRoutingEnabler*    iRoutingEnabler;
+    };
+
+/**
+* Class for handling dummy DevSound. It enables audio routing
+* before video call is connected. Proper devSound instance
+* must exist in order to control audio routing. Actual instance
+* is created in protocol in later phase of the stack
+* initialization and one in here is deleted.
+*/
+NONSHARABLE_CLASS( CRoutingEnabler ) :
+    public CBase,
+    private MDevSoundObserver
+    {
+    public: // constructor and destructor
+
+        // Constructor
+        static CRoutingEnabler* NewL();
+
+        // Destructor
+        ~CRoutingEnabler();
+
+    private: // constructors
+
+        // c++ constructor
+        CRoutingEnabler();
+
+        /**
+        * Creates and starts devSound.
+        */
+        void StartL();
+
+    public: // new functions
+
+        public: // from MDevSoundObserver
+
+        /**
+        * @see MDevSoundObserver
+        */
+        virtual void InitializeComplete( TInt aError );
+
+        /**
+        * @see MDevSoundObserver
+        */
+        virtual void ToneFinished( TInt aError );
+
+        /**
+        * @see MDevSoundObserver
+        */
+        virtual void BufferToBeFilled( CMMFBuffer* aBuffer );
+
+        /**
+        * @see MDevSoundObserver
+        */
+        virtual void PlayError( TInt aError );
+
+        /**
+        * @see MDevSoundObserver
+        */
+        virtual void BufferToBeEmptied( CMMFBuffer* aBuffer );
+
+        /**
+        * @see MDevSoundObserver
+        */
+        virtual void RecordError( TInt aError );
+
+        /**
+        * @see MDevSoundObserver
+        */
+        virtual void ConvertError( TInt aError );
+
+        /**
+        * @see MDevSoundObserver
+        */
+        virtual void DeviceMessage(
+            TUid aMessageType,
+            const TDesC8& aMsg );
+
+    private:
+        // Temporary DevSound instance to enable audio routing
+        // before actual instance in protocol is ready.
+        // Routing can be changed already when MO call is alerting.
+        CMMFDevSound* iDevSound;
+
+        // Variable to detect failure in Devsound initialization or PlayInitL().
+        // If failure happens, Devsound instance is deleted outside callback
+        // in desctructor. ETrue; failure happened, EFalse; all OK
+        TBool iDevsoundInitializeFailure;
+    };
+
+
+#endif      // CVTENGAUDIOHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Audio/MVtEngAudio.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* 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:  Audio volume and routing interface
+*
+*/
+
+
+
+#ifndef MVTENGAUDIO_H
+#define MVTENGAUDIO_H
+
+//  INCLUDES
+#include <e32def.h>
+
+/**
+*  Interface for audio related information.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class MVtEngAudio
+    {
+    public:
+
+        /**
+        * Current routing state
+        */
+        enum TAudioRoutingState 
+            {
+            EAudioHandset,
+            EAudioLoudspeaker,
+            EAudioBT,
+            EAudioWiredHeadset
+            };
+
+        /**
+        * Wired headset type
+        */
+        enum TWiredHeadsetType
+            {
+            EWiredHeadset,
+            EWiredLoopset,
+            EWiredTty,
+            EWiredNone
+            };
+
+        /**
+        * Audio routing setting to be used when changing
+        * audio routing from client.
+        */
+        enum TVtEngRoutingSetting
+            {
+            EActivateHandsfree,
+            EDeactivateHansfree,
+            EActivateBT,
+            EDeactivateBT
+            };
+
+        /**
+        * Speaker volume levels for Handset and Handsfree.
+        */
+        struct TVtEngOutputVolume
+            {
+            TInt iHandsetVolume;
+            TInt iHandsfreeVolume;
+            };
+
+        /**
+        * Returns target where audio is currently routed to.
+        * @param aAudioRoutingState routing target
+        * @return Symbian OS error code
+        */
+        virtual TInt GetRoutingState(
+            TAudioRoutingState& aAudioRoutingState ) = 0;
+
+        /**
+        * Returns if routing to specified target can be
+        * done.
+        * @param aAudioRoutingState routing target
+        * @param aAvailable ETrue if possible to do
+        * @return Symbian OS error code
+        */
+        virtual TInt GetRoutingAvailability(
+            const TAudioRoutingState aAudioRoutingState,
+            TBool& aAvailable ) = 0;
+
+        /**
+        * Returns type of wired headset
+        * @return Symbian OS error code.
+        */
+        virtual TInt GetHeadsetType(
+            TWiredHeadsetType& aHeadsetType ) = 0;
+
+        /**
+        * Returns speaker volume
+        * @param aHandsetVolume if ETrue returns handset volume,
+        * otherwise loudspeaker volume.
+        * @return output volume ranging from 1 to 10 or Symbian OS error code.
+        */
+        virtual TInt OutputVolume( 
+            const TBool aHandsetVolume ) const = 0;
+
+
+    };
+
+#endif      // MVTENGAUDIO_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVTEngPubSubsListener.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* 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:  Listener for Publish and subscribe data.
+*
+*/
+
+
+#ifndef CVTENGPUBSUBSGSETTINGS_H
+#define CVTENGPUBSUBSGSETTINGS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <e32property.h>
+
+// FORWARD DECLARATIONS
+class MVtEngSettingPSObserver;
+
+// CLASS DECLARATION
+
+/**
+*  RProperty poller.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.8
+*/
+NONSHARABLE_CLASS( CVtEngPubSubsListener ) : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aUid the Uid to use
+        * @param aKey item's key
+        * @param aObserver callback interface for notification
+        * @return instance of CVtEngPubSubsListener
+        */
+        static CVtEngPubSubsListener* NewL( const TUid aUid, const TInt aKey, 
+            MVtEngSettingPSObserver* aObserver );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngPubSubsListener();
+        
+    public: // New functions.
+
+        /**
+        * Gets integer value from P & S.
+        * @param aVal a value in return
+        * @return error code
+        */       
+        TInt Get( TInt& aVal );
+
+        /**
+        * Gets 8 bit string value from P&S.
+        * @param aVal a value in return
+        * @return error code
+        */
+        TInt Get( TDes8& aVal );
+        
+        /**
+        * Gets 16 bit descriptor value from P&S.
+        * @param aVal a value in return
+        * @return error code
+        */
+        TInt Get( TDes16& aVal );
+
+    private: // New functions.
+
+        /**
+        * Starts the listening (RunL).
+        */
+        void StartListening();
+
+    private: // From CActive.
+
+        /** @see CActive::RunL */
+        virtual void RunL();
+
+        /** @see CActive::Cancel */
+        virtual void DoCancel();
+
+        /** @see CActive::RunError */
+        virtual TInt RunError( TInt aError );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUid the Uid to use
+        * @param aKey item's key
+        * @param aObserver callback interface for notification
+        */
+        CVtEngPubSubsListener( const TUid aUid,  TInt aKey, 
+            MVtEngSettingPSObserver* aObserver );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+    
+    private:    // Data
+    
+        // UID of the monitored item.
+        TUid        iUid;
+        
+        // ID of the monitored item.
+        TInt        iId;
+        
+        // Property to subscribe to.
+        RProperty   iProperty;
+        
+        // The notification interface.
+        MVtEngSettingPSObserver* iCallback;
+    };
+
+#endif // CVTENGPUBSUBSGSETTINGS_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngAccessoryHandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2004-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:  Accessory handler.
+*
+*/
+
+
+
+#ifndef CVTENGACCHANDLER_H
+#define CVTENGACCHANDLER_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <accpolaccessorymode.h>
+#include    <accessoryserver.h>
+#include    <accessorymode.h>
+
+// FORWARD DECLARATIONS
+class MVtEngAccessoryObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Accessory mode listener for video telephony.
+*
+*  @lib videoteleng
+*  @since 3.0
+*/
+NONSHARABLE_CLASS( CVtEngAccessoryHandler ) : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        ¨* @return instance of CVtEngAccessoryHandler
+        */
+        static CVtEngAccessoryHandler* NewL( );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngAccessoryHandler();
+
+    public: // From base classes.
+
+        /**
+        * Handles accessory mode changes.
+        */
+        void RunL();
+
+        /**
+        * Cancels accessory mode monitoring.
+        */
+        void DoCancel();
+
+        /**
+        * Handles exceptions in RunL.
+        * @param aError error code.
+        * @return error code.
+        */
+        TInt RunError( TInt aError );
+
+    public: // New functions
+
+        /**
+        * Sets a new listener interested in accessory changes.
+        * @param aObserver call back interface for notifications.
+        */
+        void RegisterObserverL( MVtEngAccessoryObserver* aObserver );
+
+        /**
+        * Unregisters a listener.
+        * NOTE, do not call this from NotifyObserversL!
+        * @param aObserver call back interface for notifications.
+        */
+        void RemoveObserver( MVtEngAccessoryObserver* aObserver );
+
+        /**
+        * Returns current accessory mode.
+        * @param aAccessoryMode accessory mode in return
+        * @return Symbian error code
+        */
+        TInt AccessoryMode( TAccPolAccessoryMode& aAccessoryMode ) const;
+
+    private: // New functions.
+    
+        /**
+        * Removes all observers
+        */
+        void RemoveAllObservers();
+
+        /**
+        * Sets object active and renews subscription.
+        */
+        void StartListening();
+
+        /**
+        * Notifies all registered listeners.
+        */
+        void NotifyObserversL();
+
+    private: // Constructors.
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngAccessoryHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+    
+    private:    // Data
+        // Current accessory mode.
+        TAccPolAccessoryMode iCurrentAccessoryMode;
+
+        // Owned array of accessory mode observers.
+        RPointerArray< MVtEngAccessoryObserver > iAccessoryObservers;
+
+        // Owned accessory server session.
+        RAccessoryServer iAccessoryServer;
+
+        // Owned accessory mode subsession.
+        RAccessoryMode iAccessoryMode;
+
+        // Accessory mode structure.
+        TAccPolAccessoryMode iMode;
+
+    };
+
+#endif      // CVTENGACCHANDLER_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngCRObserverItem.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,199 @@
+/*
+* 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:  Central repository observer class.
+*
+*/
+
+
+#ifndef CVTENGCROBSITEM_H
+#define CVTENGCROBSITEM_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include "cenrepnotifyhandler.h"
+
+// FORWARD DECLARATIONS
+class MVtEngCRSettingObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Central repository listener for video telephony.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 3.0
+*/
+NONSHARABLE_CLASS( CVtEngCRObserverItem ) : public CBase,
+    public MCenRepNotifyHandlerCallback
+    {
+    public:  // Constructors and destructor.
+        
+        /**
+        * Two-phased constructor.
+        * @param aObserver the real observer to notify
+        * @param aUid UID for this listener
+        * @param aKey ID for this listener
+        * @param aType type of information interested in
+        * @return this CR observer
+        */
+        static CVtEngCRObserverItem* NewL( 
+            MVtEngCRSettingObserver* aObserver,
+            TUid aUid, TUint32 aKey, 
+            CCenRepNotifyHandler::TCenRepKeyType aType );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngCRObserverItem();
+
+    public: // From MCenRepNotifyHandlerCallback.
+
+        /**
+        * Callback to notify changed integer setting.
+        * @param aId changed id
+        * @param aNewValue 
+        */
+        void HandleNotifyInt( TUint32 aId, TInt aNewValue );
+
+        /**
+        * Callback to notify changed real setting.
+        * @param aId changed id
+        * @param aNewValue 
+        */
+        void HandleNotifyReal( TUint32 aId, TReal aNewValue );
+
+        /**
+        * Callback to notify changed string setting.
+        * @param aId changed id
+        * @param aNewValue 
+        */
+        void HandleNotifyString( TUint32 aId, const TDesC16& aNewValue );
+
+        /**
+        * Callback to notify changed binary setting.
+        * @param aId changed id
+        * @param aNewValue 
+        */
+        void HandleNotifyBinary( TUint32 aId, const TDesC8& aNewValue );
+
+        /**
+        * Callback to notify changed setting.
+        * @param aId changed id
+        */
+        void HandleNotifyGeneric( TUint32 aId);
+
+        /**
+        * Callback to notify of an occurred error.
+        * @param aId changed id
+        * @param aError 
+        * @param aHandler which handler
+        */
+        void HandleNotifyError( TUint32 aId, TInt aError, 
+            CCenRepNotifyHandler* aHandler );
+        
+        public: // New functions.
+        
+        /**
+        * Checks if this one matches given UID and key.
+        * @param aUID UID to use in comparison 
+        * @param aKey key to use in comparison
+        * @return ETrue if match
+        */
+        TBool Offer( const TUid aUid, const TUint32 aKey ) const;
+        
+        /**
+        * Checks if this one matches given UID.
+        * @param aUID UID to use in comparison 
+        * @return ETrue if match
+        */
+        TBool Offer( const TUid aUid ) const;
+        
+        /**
+        * Checks if this one matches given key.
+        * @param aKey key to use in comparison 
+        * @return ETrue if match
+        */
+        TBool Offer( const TUint32 aKey ) const;
+        
+        /**
+        * Returns UID of this handler.
+        * @return UID
+        */
+        TUid Uid() const;
+
+        /**
+        * Returns key of this handler.
+        * @return key
+        */
+        TUint32 Key() const;
+        
+        /**
+        * Returns notifier of this handler.
+        * @return notifier
+        */
+        CCenRepNotifyHandler* Notifier() const;
+        
+        /**
+        * Returns type of this handler.
+        * @return type
+        */
+        CCenRepNotifyHandler::TCenRepKeyType Type() const;
+        
+        /**
+        * Returns observer of this handler.
+        * @return observer
+        */
+        MVtEngCRSettingObserver* Observer() const;
+        
+        /**
+        * Sets CenRep notifier
+        * @param notifier to set.
+        */
+        void SetCenRepNotifier( CCenRepNotifyHandler* aNotifier );
+        
+        
+    private: // Constructor.
+
+        /**
+        * C++ default constructor.
+        * @param aObserver the real observer to notify
+        * @param aUid UID for this listener
+        * @param aKey ID for this listener
+        * @param aType type of information interested in
+        */
+        CVtEngCRObserverItem( MVtEngCRSettingObserver* Observer,
+            TUid aUid, TUint32 aKey, 
+            CCenRepNotifyHandler::TCenRepKeyType aType );
+
+    private:    // Data
+
+        // Callback for notifications.
+        MVtEngCRSettingObserver* iObserver;
+
+        // UID for this item.
+        TUid                     iUid;
+
+        // Key for this item.
+        TUint32                  iKey;
+
+        // Type of listener.
+        CCenRepNotifyHandler::TCenRepKeyType iType;
+
+        // Central repository notifier.
+        CCenRepNotifyHandler*   iNotifier;
+};
+#endif      // CVTENGCROBSITEM_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngCRProxy.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,237 @@
+/*
+* 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:  Central repository proxy, which is used by all CR dependent.
+*
+*/
+
+
+
+#ifndef CVTENGCRPROXY_H
+#define CVTENGCRPROXY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <centralrepository.h>
+
+// FORWARD DECLARATIONS
+class CVtEngCRObserverItem;
+class CRepository;
+class MVtEngCRSettingObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Central repository interface for video telephony.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 3.0
+*/
+NONSHARABLE_CLASS( CVtEngCRProxy ) : public CBase
+    {
+    public: // Data structures.
+
+        // Internal data structure for storing CR sessions.
+        NONSHARABLE_CLASS( CCRSession ) : public CBase
+            {
+            public:
+                /**
+                * Destructor needed.
+                */
+                ~CCRSession();
+           
+            // CenRep session.
+            CRepository*    iSession;
+            // Uid attached to CenRep session.
+            TUid            iUid;
+            };
+
+    public:  // Constructors and destructor.
+        
+        /**
+        * Two-phased constructor.
+        * @return instance of CVtEngCRProxy
+        */
+        static CVtEngCRProxy* NewL( );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngCRProxy();
+
+    public: // New functions
+
+        /**
+        * Sets integer value to Central Repository.
+        * @param aUid used UID
+        * @param aId which key to use
+        * @param aVal a value to set
+        * @return error code
+        */  
+        TInt Set( const TUid aUid, const TUint32 aId, TInt aVal );
+
+        /**
+        * Sets real value to Central Repository.
+        * @param aUid used UID
+        * @param aId which key to use
+        * @param aVal a value to set
+        * @return error code
+        */  
+        TInt Set( const TUid aUid, const TUint32 aId, const TReal& aVal );
+
+        /**
+        * Sets binary value to Central Repository.
+        * @param aUid used UID
+        * @param aId which key to use
+        * @param aVal a value to set
+        * @return error code
+        */  
+        TInt Set( const TUid aUid, const TUint32 aId, const TDesC8& aVal );
+
+        /**
+        * Sets string value to Central Repository.
+        * @param aUid used UID
+        * @param aId which key to use
+        * @param aVal a value to set
+        * @return error code
+        */  
+        TInt Set( const TUid aUid, const TUint32 aId, const TDesC16& aVal );
+        
+        /**
+        * Gets integer value from Central Repository.
+        * @param aUid used UID
+        * @param aId which key to use
+        * @param aVal a value in return
+        * @return error code
+        */
+        TInt Get( const TUid aUid, const TUint32 aId, TInt& aVal );
+
+        /**
+        * Gets real value from Central Repository.
+        * @param aUid used UID        
+        * @param aId which key to use
+        * @param aVal a value in return
+        * @return error code
+        */
+        TInt Get( const TUid aUid, const TUint32 aId, TReal& aVal );
+
+        /**
+        * Gets binary value from Central Repository
+        * @param aUid used UID        
+        * @param aId which key to use
+        * @param aVal a value in return
+        * @return error code
+        */
+        TInt Get( const TUid aUid, const TUint32 aId, TDes8& aVal );
+        
+        /**
+        * Gets string value from Central Repository.
+        * @param aUid used UID        
+        * @param aId which key to use
+        * @param aVal a value in return
+        * @return error code
+        */
+        TInt Get( const TUid aUid, const TUint32 aId, TDes16& aVal );
+
+        /**
+        * Add a new Cen Rep interested object.
+        * @param aObserver callback interface
+        */
+        void RegisterInterestedL( CVtEngCRObserverItem* aObserver );
+
+        /**
+        * Removes an observer.
+        * @param aObserver to be removed
+        */
+        void RemoveInterested( CVtEngCRObserverItem& aObserver );
+        
+    private: // New functions
+
+        /**
+        * Gets a Cen Rep session matching UID.
+        * @param aUid UID to use in search
+        * @param aCRSession found session or a new session
+        * @return error code
+        */
+        TInt GetSessionL( const TUid aUid, CRepository*& aCRSession );    
+
+        /**
+        * Creates an id-CenRep paired session.
+        * @param aUid the UID to use
+        * @return new session or NULL 
+        */    
+        CCRSession* NewCRSessionL( TUid aUid );
+    
+        /**
+        * Finds observer item.
+        * @param aKey
+        * @param aIndex
+        * @return observer item or NULL 
+        */    
+        CVtEngCRObserverItem* FindItem( 
+            const TUint32 aKey, TInt& aIndex ) const;
+
+        /**
+        * Removes all observers
+        * 
+        */
+        void RemoveAllObservers();
+
+        /**
+        * Removes all Central repository instances
+        * 
+        */
+        void RemoveSessions();
+
+        /**
+        * Maps a given UID to a certain central repository instance
+        * @param aUid the UID to map
+        * @return found CRepository item or NULL
+        */
+        CRepository* MapUidToCR( const TUid aUid );
+
+        /**
+        * Finds observer item.
+        * @param aUid 
+        * @param aKey
+        * @param aIndex
+        * @return observer item or NULL 
+        */
+        CVtEngCRObserverItem* FindItem( const TUid& aUid, const TUint32 aKey,
+                TInt& aIndex ) const;
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngCRProxy();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+    
+    private:    // Data
+
+        // Storage for data observers.
+        RPointerArray<CVtEngCRObserverItem> iObserverItems;
+
+        // Array for central repository sessions.
+        RPointerArray<CVtEngCRProxy::CCRSession> iCRSessions;
+    };
+
+#endif      // CVTENGCRPROXY_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngDeviceLockMonitor.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* 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:  Monitor for device lock (autolock)
+*
+*/
+
+
+
+#ifndef CVTENGDEVICELOCKMONITOR_H
+#define CVTENGDEVICELOCKMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "MVtEngSettingPSObserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngPubSubsListener;
+
+// CLASS DECLARATION
+
+/**
+*  Monitor for autolock state.
+*
+*  @lib videoteleng
+*  @since 3.1
+*/
+NONSHARABLE_CLASS( CVtEngDeviceLockMonitor ) : public CBase, public MVtEngSettingPSObserver
+    {
+    public:  // Constructors and destructor
+        
+        static CVtEngDeviceLockMonitor* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngDeviceLockMonitor();
+
+    public: // New functions
+        
+        /**
+        * Sends event to UI of current autolock state
+        */
+        void NotifyState() const;
+
+    public: // From MVtEngSettingPSObserver
+    
+        /**
+        * @see MVtEngSettingPSObserver::HandleNotifyPSL
+        */
+        void HandleNotifyPSL( const TUid aUid, const TInt& aKey, 
+            const TRequestStatus& aStatus );
+            
+    private:
+        /**
+        * C++ constructor.
+        */
+        CVtEngDeviceLockMonitor();
+
+        /**
+        * 2nd phase constructor
+        */
+        void ConstructL();
+        
+    private:
+        
+        // Listener for autolock state
+        CVtEngPubSubsListener* iAutolockListener;
+    };
+
+#endif      // CVTENGDEVICELOCKMONITOR_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngEventManager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* 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:  Event manager 
+*
+*/
+
+
+
+#ifndef CVTENGEVENTMANAGER_H
+#define CVTENGEVENTMANAGER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "VtEngEvents.h"
+
+// FORWARD DECLARATIONS
+class MVtEngEventObserver;
+
+// CLASS DECLARATION
+
+/**
+*  This class is responsible for notifying client
+*  on engine events.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngEventManager ) : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CVtEngEventManager* NewL( 
+            MVtEngEventObserver& aEventObserver );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngEventManager();
+
+    public: // New functions
+        
+        /**
+        * Notifies client on session state change.
+        */
+        void SessionStateChanged();
+
+        /**
+        * Notifies event to observer.
+        * @param aEvent event
+        */
+        static void NotifyEvent( const TInt aEvent );
+        
+        void AddObserverL( MVtEngEventObserver* aObserver );
+        
+        void RemoveObserver( const MVtEngEventObserver* aObserver );
+
+    private: // from CActive
+
+        void RunL();
+
+        void DoCancel();
+
+    private:
+
+        /**
+        * Notifies event to observer
+        */
+        void DoNotifyEvent( const TInt aEvent );
+
+        TBool QueueAsyncEvent( const TInt aEvent );
+        
+        /**
+        * Queue event and signal AO.
+        * @param aEvent Asynchronous event to be signalled.
+        */        
+        void QueueAndSignal( const TInt aEvent );
+
+        /**
+        * Signals AO.
+        */
+        void Signal();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngEventManager();
+        
+        // 2nd phase constructor
+        void ConstructL( MVtEngEventObserver& aEventObserver );
+
+    private:     // Data
+        
+        RPointerArray<MVtEngEventObserver> iObservers;
+        
+        // Asynchronous events are stored in this array and 
+        // executed in order
+        CArrayFixFlat< TInt >*  iEventQueue;
+
+    };
+
+#endif      // CVTENGEVENTMANAGER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngHandlerContainer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,131 @@
+/*
+* 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:  Handler container
+*
+*/
+
+
+
+#ifndef CVTENGHANDLERCONTAINER_H
+#define CVTENGHANDLERCONTAINER_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    "CVtEngMediaHandler.h"
+#include    "CVtEngSessionHandler.h"
+#include    "CVtEngAudioHandler.h"
+#include    "CVtEngDtmfHandler.h"
+
+// FORWARD DECLARATIONS
+class MVtEngSessionInfo;
+class MVtEngMedia;
+class MVtEngAudio;
+
+// CLASS DECLARATION
+
+/**
+*  Container for media, audio and session handlers.
+*
+*  @lib videoteleng
+*  @since Series60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngHandlerContainer ) : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CVtEngHandlerContainer* NewL(  );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngHandlerContainer();
+
+    public: // New functions
+            
+
+        /**
+        * Returns session handler.
+        * @return session handler
+        */
+        inline MVtEngSessionInfo& Session() const;
+
+        /**
+        * Returns media handler.
+        * @return media handler
+        */
+        inline MVtEngMedia& Media() const;
+
+        /**
+        * Returns audio handler.
+        * @return audio handler
+        */
+        inline MVtEngAudio& Audio() const;
+
+
+        /**
+        * Returns DTMF handler.
+        * @return DTMF handler
+        */
+        inline CVtEngDtmfHandler& Dtmf() const;
+
+        /*
+        * Uninitializes audio and session handlers.
+        * Media handler uninitialization is done
+        * asynchronously using directly the handler.
+        */
+        void Uninitialize();
+
+        /**
+        * Creates DTMF handler
+        * @param aH324Config H324 configure interface
+        */
+        void CreateDtmfHandlerL( MVtH324ConfigCommand* aH324Config );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngHandlerContainer();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // member data
+
+        // media handler
+        CVtEngMediaHandler* iMedia;
+
+        // session handler
+        CVtEngSessionHandler* iSession;
+
+        // audio handler
+        CVtEngAudioHandler* iAudio;
+
+
+        // DTMF handler
+        CVtEngDtmfHandler*   iDtmf;
+
+    };
+
+#include "CVtEngHandlerContainer.inl"
+
+#endif      // CVTENGHANDLERCONTAINER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngHandlerContainer.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* 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:  handler container 
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Session
+// Returns specific handler
+// 
+// -----------------------------------------------------------------------------
+//
+inline MVtEngSessionInfo& CVtEngHandlerContainer::Session() const 
+    { 
+    return *iSession;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Media
+// Returns specific handler
+// 
+// -----------------------------------------------------------------------------
+//
+inline MVtEngMedia& CVtEngHandlerContainer::Media() const { return *iMedia; }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Audio
+// Returns specific handler
+// 
+// -----------------------------------------------------------------------------
+//
+inline MVtEngAudio& CVtEngHandlerContainer::Audio() const { return *iAudio; }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Dtmf
+// Returns specific handler
+// 
+// -----------------------------------------------------------------------------
+//
+inline CVtEngDtmfHandler& CVtEngHandlerContainer::Dtmf() const { return *iDtmf; }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngInitializer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,239 @@
+/*
+* 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:  Class for initializing the engine gradually.
+*                Active object initializes one "subsystem" on each
+*                round. In case of failure timer is started and
+*                retrial is done after time-out. Uninitialization
+*                is done is one shot.
+*
+*/
+
+
+
+#ifndef CVTENGINITIALIZER_H
+#define CVTENGINITIALIZER_H
+
+//  INCLUDES
+#include    "MVtEngSettingObserver.h"
+#include    <e32base.h>
+#include    <mvtprotocolhandler.h>
+
+// FORWARD DECLARATIONS
+class CVtEngHandlerContainer;
+class CVtEngOperation;
+
+
+/**
+*  Engine initializer.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngInitializer ) :
+    public CActive,
+	public MVtEngSettingObserver
+    {
+    public: // Constructors and destructor
+
+        static CVtEngInitializer* NewL( CVtEngHandlerContainer& aHandlers );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngInitializer();
+
+    public: // new functions
+
+        /**
+        * Starts initialization process.
+        */
+        void InitializeL( CVtEngOperation& aCallback );
+
+        /**
+        * Cancels initialiation
+        * @return ETrue if CActive::Cancel was called
+        */
+        TBool CancelInit();
+
+        /**
+        * Uninitializes engine.
+        */
+        void Uninitialize( CVtEngOperation& aCallback );
+
+        /**
+        * Gets GetSessionCommand ownership after initialization.
+        * @return CSessionCommand interface.
+        */
+        MVtSessionCommand* GetSessionCommand();
+
+        /**
+        * Returns if engine is initialized.
+        * @return ETrue if initialized
+        */
+        TBool Initialized() const;
+
+		/**
+        * Creates handler for DTMF sending.
+		* @param aH324Config H324 configure interface
+        */
+        void CreateDtmfHandlerL( MVtH324ConfigCommand* aH324Config );
+
+		/**
+		* Gets pointer to comms. Still owns the comms.
+		* @return Pointer to comms.
+		*/		
+        MCommServer* GetVtComms();
+
+    private: // from CActive
+
+        /**
+        * performs one initialization step.
+        */
+        void RunL();
+
+        /**
+        * Cancels initialization process.
+        */
+        void DoCancel();
+
+        /**
+        * Handles error in the process.
+        * @return always returns KErrNone
+        */
+        TInt RunError( TInt aError );
+
+    public: // from MVtEngSettingObserver
+        virtual void HandleSettingChangedL( 
+            CVtEngSettings::TSettingId aId, 
+            const TDesC& aValue );
+            
+
+    private: // Constructors
+
+        /**
+        * c++ constructor
+        */
+        CVtEngInitializer( CVtEngHandlerContainer& aHandlers );
+
+        /**
+        *
+        */
+        void ConstructL();
+
+    private:
+
+        enum TProcess
+            {
+            // Go to next step
+            EContinue,
+            // Reset engine
+            EReset,
+            // Retry current step when failed.
+            ERetry
+            };
+
+    private: // new functions
+
+        /**
+        * Reads bit reversal information from locally variated flags.
+        * @return ETrue if reversed.
+        */
+        TBool BitReversalUsed();
+
+        /**
+        * Proceeds to next step or starts retrial of
+        * previously failed step.
+        */
+        void ContinueOrRetry( const TProcess aOperation );
+
+        /**
+        * Notifies observer on initialization completion.
+        */
+        void Notify( const TInt aResult );
+
+        /**
+        * Callback for retrial timer.
+        */
+        static TInt HandleTimer( TAny* aAny );
+
+        /**
+        * Handles retrial timer expiration.
+        */
+        void DoHandleTimer();
+                  
+        TBool ActivateAndSignal( TInt aSignalValue );
+        
+    private:
+
+
+        /**
+        * Initialization steps
+        */
+        enum TVtEngInitializationSteps
+            {
+            EInitNone,
+            EInitSession,
+            EInitMedia,
+            EInitProto,
+			EInitDataportCompleted,
+            EInitComplete,
+            EResetMedia,
+            EResetMediaPhase2
+            };
+
+        /**
+        * Dataport information handling flags.
+        */
+        enum TVtEngDataportInformationFlags
+            {
+            EDataportListened = 0x01,
+            EDataportReceived = 0x02
+            };
+
+    private:
+
+        // handler container
+        CVtEngHandlerContainer& iHandlers;
+
+        // Current (un)initialization step
+        TInt                    iStep;
+
+        // Operation to be notified on completion
+        CVtEngOperation*        iCallback;
+
+        // Retrial count
+        TInt                    iRetrials;
+
+        // Retrial timer
+        CPeriodic*              iTimer;
+
+        // Protocol Session Engine
+		MVtSessionCommand* iSessionCommand;
+
+        // Protocol Comms Server
+        MCommServer*      iComms;
+
+        // Has subscription been made for dataport name.
+        TInt iDataportHandled;
+
+		// If MediaHandler has taken ownership of 2-way, this is true,
+		// otherwise false.
+		TBool iOwnershipInMH;
+
+    };
+
+
+#endif      // CVTENGINITIALIZER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngModel.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* 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:  Video telephony engine class
+*
+*/
+
+
+
+#ifndef CVTENGMODEL_H
+#define CVTENGMODEL_H
+
+//  INCLUDES
+#include <e32base.h>
+//#include <MVtEngEngine.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class MVtEngEventObserver;
+class MVtEngCommandObserver;
+class CVtEngEventManager;
+class CVtEngHandlerContainer;
+class MVtEngCommandHandler;
+class CVtEngCommandHandler;
+class MVtEngSessionInfo;
+class MVtEngMedia;
+class MVtEngAudio;
+class CVtEngStateManager;
+class CVtEngUtility;
+class CVtEngExtensions;
+
+// CLASS DECLARATION
+
+/**
+*  Model for video telephony engine.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngModel ) : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aEventObserver event observer
+        * @param aCommandObserver command observer
+        */
+        IMPORT_C static CVtEngModel* NewL( 
+            MVtEngEventObserver& aEventObserver,
+            MVtEngCommandObserver& aCommandObserver );
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CVtEngModel();
+
+    public: // New functions
+
+        IMPORT_C MVtEngCommandHandler& CommandHandler() const;
+
+        IMPORT_C MVtEngSessionInfo& Session() const;
+
+        IMPORT_C MVtEngMedia& Media() const;
+
+        IMPORT_C MVtEngAudio& Audio() const;
+
+        /**
+        * Returns extension or NULL if extension cannot be found.
+        * @param aExtensionUid extension uid
+        * @return pointer to extension
+        */
+        IMPORT_C TAny* Extension( const TUid& aExtensionUid );
+
+
+        
+    protected:  // New functions
+        
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+
+    protected:  // Functions from base classes
+        
+        /**
+        * From ?base_class ?member_description
+        */
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngModel();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( MVtEngEventObserver& aEventObserver,
+            MVtEngCommandObserver& aCommandObserver );    
+
+    private:    // Data
+
+        // Event manager acting as event mediator.
+        CVtEngEventManager*     iEventManager;
+
+        // Container for functional units.
+        CVtEngHandlerContainer* iHandlers;
+
+        // Handler for UI commands
+        CVtEngCommandHandler*   iCommandHandler;
+
+        // Manager for engine states
+        CVtEngStateManager*     iStateManager;
+
+        // Utility for TLS access
+        CVtEngUtility*          iUtils;
+        
+        //  Container for engine extensions
+        CVtEngExtensions* iExtensions;
+       
+    };
+
+#endif      // CVTENGMODEL_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngSATClient.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,87 @@
+/*
+* 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:  SAT listener.
+*
+*/
+
+
+
+#ifndef CVTENGSATCLIENT_H
+#define CVTENGSATCLIENT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <rsatrefresh.h>
+#include <rsatsession.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  SAT listener.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 3.0
+*/
+NONSHARABLE_CLASS( CVtEngSATClient ) : public CBase, MSatRefreshObserver
+    {
+    public:  // Constructors and destructor.
+        
+        /**
+        * Two-phased constructor.
+        * @return instance of CVtEngSATClient
+        */
+        static CVtEngSATClient* NewL( );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngSATClient();
+        
+    public: // Functions from base classes
+
+        /**
+        * From MSatRefreshObserver
+        */
+        TBool AllowRefresh(
+            TSatRefreshType aType, const TSatRefreshFiles& aFiles );
+        /**
+        * From MSatRefreshObserver.
+        */
+        void Refresh( TSatRefreshType aType, const TSatRefreshFiles& aFiles );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngSATClient();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+    
+    private:    // Data
+    
+        // Session & Refresh for SAT listening.
+        RSatSession iSatSession;
+        RSatRefresh iSatRefresh;
+
+    };
+
+#endif      // CVTENGSATCLIENT_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngSettings.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,484 @@
+/*
+* 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:  Video call setting data.
+*
+*/
+
+
+
+#ifndef CVTENGSETTINGS_H
+#define CVTENGSETTINGS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <bautils.h>
+#include "MVtEngCRSettingObserver.h"
+#include "CVtEngCRObserverItem.h"
+#include "CVtEngCRProxy.h"
+#include "MVtEngAudio.h"
+#include "MVtEngMedia.h"
+#include "MVtEngSessionInfo.h"
+
+// CONSTANTS
+// Default routing.
+const MVtEngAudio::TVtEngRoutingSetting
+    KVtEngDefaultAudioRouting = MVtEngAudio::EActivateHandsfree;
+
+// FORWARD DECLARATIONS
+class MVtEngSettingObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Container for video call settings.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngSettings ) : public CBase
+, public MVtEngCRSettingObserver
+    {
+    public:
+
+        /**
+        * Settings ids
+        */
+        enum TSettingId
+            {
+            EStillImage,
+            EStillImagePath,
+            ECallTimer,
+            EHandsetVolume,
+            EHandsfreeVolume,
+            EBTAudioAccessory,
+            EIhfMode,
+            ESelectVolume, // select Handset / Handsfree volume
+            EDataportInfo
+            };
+
+        /**
+        * Audio configuration
+        */
+        struct TVtEngAudioConfig
+            {
+            // Current volume in use, EFalse: handset,
+            // ETrue: loudspeaker.
+            TBool iCurrentVolume;
+            // Speaker volume
+            MVtEngAudio::TVtEngOutputVolume   iVolume;
+            // Audio routing
+            MVtEngAudio::TVtEngRoutingSetting iRouting;
+            };
+
+        /**
+        * Video configuration
+        */
+        struct TVtEngVideoConfig
+            {
+            // Still image file name
+            TFileName iStillImageFile;
+            // Determines if still image is valid.
+            TBool iImageIsValid;
+            // Determines if video is enabled.
+            TBool iVideoEnabled;
+            };
+
+        /**
+        * Video quality framerates
+        */
+        struct TVtEngVideoQualityFrameRateConfig
+            {
+            // Frame rate for videoquality settings detail
+            TInt    iDetail;
+
+            // Frame rate for videoquality settings normal
+            TInt    iNormal;
+
+            // Frame rate for videoquality settings motion
+            TInt    iMotion;
+            };
+
+        /**
+        * Media configuration
+        */
+        struct TVtEngVideoCallConfig
+            {
+            // @see TVtEngAudioConfig
+            TVtEngAudioConfig iAudio;
+            // @see TVtEngVideoConfig
+            TVtEngVideoConfig iVideo;
+            // defines if call timer is enabled
+            TBool iCallTimerOn;
+            // Engine has green light to make connect on Protocol.
+            TBool iReadyForConnect;
+			// Dataport loaning status
+			TBool iIsDataportLoaned;
+            };
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @return instance of CVtEngSettings
+        */
+        static CVtEngSettings* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngSettings();
+
+    public: // New functions
+
+        /**
+        * Creates stored data observers.
+        * @param aObserver callback interface
+        * @param aUid UID to monitor
+        * @param aKey ID to monitor
+        * @param aType which data type
+        */
+        void CreateDataObserverL(
+            MVtEngCRSettingObserver* aObserver, TUid aUid, TUint32 aKey,
+            CCenRepNotifyHandler::TCenRepKeyType aType );
+
+        /**
+        * Returns configuration.
+        * @return settings data
+        */
+        const CVtEngSettings::TVtEngVideoCallConfig& Config() const;
+
+        /**
+        * Sets current volume.
+        * @param aVolume selected volume,
+        *        EFalse: handset, ETrue: loudspeaker.
+        */
+        void SetCurrentVolume( TBool aVolume );
+
+        /**
+        * Returns current volume.
+        * @return EFalse: handset, ETrue: loudspeaker.
+        */
+        TBool CurrentVolume() const;
+
+        /**
+        * Sets audio output volume levels.
+        * @param aHandsetVolume handset volume level.
+        * @param aHandsfreeVolume handsfree volume level.
+        * @param aInternal not stored to shared data but
+        * internal variable to be used when correct state
+        * is entered.
+        * @return Symbian error code
+        */
+        TInt SetVolume(
+            const TInt aHandsetVolume,
+            const TInt aHandsfreeVolume,
+            const TBool aInternal );
+
+        /**
+        * Gets audio output volume levels from Shared Data.
+        * @param aVolume volume level.
+        * @param aHandsfree if true handsfree volume is read,
+        * otherwise handset.
+        * @param aInternal not read from shared data but
+        * from internal variable
+        * @return error code
+        */
+        TInt GetVolume(
+            TInt& aVolume,
+            const TBool aHandsfree,
+            const TBool aInternal ) const;
+
+        /**
+        * Gets maximum audio output volume level.
+        * @return max volume for device
+        */
+        inline TInt MaxVolume( ) const;
+
+
+        /**
+        * Gets minimum audio output volume level.
+        * @return max volume for device
+        */
+        inline TInt MinVolume( ) const;
+
+        /**
+        * Checks the validity of the volume level.
+        * return either constant minimum, constant maximum
+        * or the passed value level.
+        * @param aVolume the volume level to check
+        * @return suitable volume level
+        */
+        inline TInt ValidVolume( const TInt aVolume ) const;
+
+        /**
+        * Sets audio routing setting.
+        * @param aState audio routing state.
+        */
+        void SetRouting( const MVtEngAudio::TVtEngRoutingSetting& aState );
+
+        /**
+        * Sets output video state setting.
+        * @param aEnabled ETrue if sending is enabled
+        */
+        void SetVideoEnabled( const TBool aEnabled );
+
+        /**
+        * Sets connected state.
+        */
+        void SetConnectReady();
+
+        /**
+        * Reads local variations.
+        */
+        void ReadVariationsL();
+
+        /**
+        * Gets camera orientations for primary and secondary camera.
+        * @see MVtEngMedia::TCameraOrientation
+        * @param aPrimaryCameraOrientation primary camera orientation.
+        * @param aSecondaryCameraOrientation secondary camera orientation.
+        */
+        void GetCameraOrientations(
+            MVtEngMedia::TCameraOrientation& aPrimaryCameraOrientation,
+            MVtEngMedia::TCameraOrientation& aSecondaryCameraOrientation ) const;
+
+        /**
+        * Checks if given bits is turned on in local variation.
+        * @param aBits bits to check
+        * @return ETrue if turned on
+        */
+        TBool CheckBits( const TInt aBits );
+
+        /**
+        * Returns video quality frame rate configuration.
+        * @return Reference to video quality frame rate
+        * configuration.
+        */
+        const TVtEngVideoQualityFrameRateConfig&
+            VideoQualityFrameRateConfig() const;
+
+        /**
+        * Resets settings to default values.
+        */
+        void ResetAll();
+
+        /**
+        * Registers interest on setting change.
+        * @param aId event to observe for
+        * @param aObserver setting observer
+        */
+        void NotifyChangeL(
+            TSettingId aId,
+            MVtEngSettingObserver& aObserver );
+
+        /**
+        * Cancels observering setting changes.
+        * @param aId event to cancel
+        * @param aObserver setting observer
+        */
+        void CancelNotifyChange(
+            TSettingId aId,
+            const MVtEngSettingObserver& aObserver );
+
+		/**
+        * Informs setting is dataport loaned or not yet. 
+        * @param aLoaned TBool value is loaned (ETrue) or not (EFalse)
+        */
+		void SetDataportLoaned( TBool aLoaned );
+		
+		/**
+        * Checks if still image exists. 
+        * @return ETrue if still image exists.
+        */
+		TBool IsDefaultStillImageDefined();
+		
+		
+		
+		/**
+		* Sets CLI. 
+		* @since S60 5.0
+		* @params aCLI call id and address (MSISDN) availability
+		*/
+		void SetCLI( const MVtEngSessionInfo::TCLI& aCLI );
+		
+		/**
+		* Returns CLI
+		* @since S60 5.0
+		* @param aCLI call id and address (MSISDN) availability
+		* @return ETrue if CLI is valid (stored in the first place)
+		*/
+		TBool GetCLI( MVtEngSessionInfo::TCLI& aCLI ) const;
+
+        /**
+		* Sets dataport info
+		* @since S60 5.0
+		* @param aPortInfo port name and number as string
+		*/
+		void SetDataportInfoL( const TDesC& aPortInfo );
+		
+		/**
+		* Returns dataport info or NULL if not available yet
+		* @since S60 5.0
+		* @return dataport info
+		*/
+		const TDesC* DataportInfo() const;
+		
+	public:  // From MVtEngCRSettingObserver.
+
+        /**
+        * Callback to notify changed setting.
+        * @param aUid changed Uid
+        * @param aId changed id
+        * @param aNewValue
+        */
+        void HandleNotifyInt( const TUid aUid, const TUint32 aId,
+            TInt aNewValue );
+
+        /**
+        * Callback to notify changed setting.
+        * @param aUid changed Uid
+        * @param aId changed id
+        * @param aNewValue
+        */
+        void HandleNotifyReal( const TUid aUid, const TUint32 aId,
+            TReal aNewValue );
+
+        /**
+        * Callback to notify changed setting.
+        * @param aUid changed Uid
+        * @param aId changed id
+        * @param aNewValue
+        */
+        void HandleNotifyString( const TUid aUid, const TUint32 aId,
+            const TDesC16& aNewValue );
+
+    private: // New functions.
+        struct TObserverItem
+            {
+            // Callback interface.
+            MVtEngSettingObserver* iObserver;
+            // UID of item.
+            TUid                   iUid;
+            // Key of observer.
+            TPtrC                  iKey;
+            // Integer key, used with CR.
+            TInt                   iIntKey;
+            // Settings internal id.
+            TSettingId             iId;
+            };
+
+        /**
+        * Finds observer item.
+        * @param aUid
+        * @param aKey
+        * @return observer item or NULL
+        */
+        TObserverItem* FindItem( const TUid& aUid, const TDesC& aKey ) const;
+
+        /**
+        * Finds observer item.
+        * @param aUid
+        * @param aKey
+        * @return observer item or NULL
+        */
+        TObserverItem* FindItem( const TUid& aUid, const TInt& aKey ) const;
+
+        /**
+        * Returns value as integer.
+        * @param aValue value to convert
+        * @return value as integer
+        */
+        static TInt SettingAsTInt( const TDesC& aValue );
+
+        /**
+        * Derived class for internal book keeping. Engine knows whether
+        * CLI has been received from call handling
+        */
+        struct TVtEngCLI : public MVtEngSessionInfo::TCLI
+            {
+            // Set to True when CLI received from call handling.
+            TBool iValid;
+            };
+            
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngSettings();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Callback function to inform the observer.
+        * @param aAny pointer to instance of this class.
+        * @return KErrNone always.
+        */
+        static TInt DoInformSelectVolumeObserver( TAny* aAny );
+
+
+        /**
+        * Parses VQ frame rates read from cenrep.
+        */
+        void ParseFrameRates( TVtEngVideoQualityFrameRateConfig& aVQFR,
+            const TDesC& aBuffer );
+
+    private:    // Data
+        // Central Repository proxy.
+        CVtEngCRProxy* iCRProxy;
+
+        // Settings data.
+        TVtEngVideoCallConfig iConfig;
+
+        // Setting data observers.
+        CArrayFixFlat<TObserverItem>* iObserverItems;
+
+        // File system handle.
+        RFs iFs;
+
+        // Owned idle callback instance.
+        CIdle* iSelectVolumeIdle;
+
+        // Observer for ESelectVolume.
+        MVtEngSettingObserver* iSelectVolumeObserver;
+        
+        // Observer for EDataportInfo
+        MVtEngSettingObserver* iDataportObserver;
+
+        // Locally variated bits are read to this.
+        TInt iVariantReadOnlyValues;
+
+        // If local variations are read
+        TBool iVariationsRead;
+
+        // Video quality frame rate configuration holder
+        TVtEngVideoQualityFrameRateConfig iVQFRConfig;
+        
+        // If default still image is defined
+        TBool iDefaultStillImageDefined;
+        
+        // CLI information of video call. 
+        TVtEngCLI iCLI;
+        
+        HBufC* iDataportInfo;
+    };
+
+#include    "CVtEngSettings.inl"
+
+#endif      // CVTENGSETTINGS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/CVtEngSettings.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* 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:  Settings inline methods
+*
+*/
+
+
+//Constants
+const TInt8 KVTEngMaxVolume = 10;
+const TInt8 KVTEngMinVolume = 0;
+
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetMinVolume
+// Return device min volume.
+// 
+// -----------------------------------------------------------------------------
+//
+inline TInt CVtEngSettings::MinVolume() const
+    { return KVTEngMinVolume; }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetMaxVolume
+// Return event manager.
+// 
+// -----------------------------------------------------------------------------
+//
+inline TInt CVtEngSettings::MaxVolume() const
+    { return KVTEngMaxVolume; }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ValidVolume
+// Checks if the volume is within allowed limits
+// 
+// -----------------------------------------------------------------------------
+//
+inline TInt CVtEngSettings::ValidVolume( const TInt aVolume ) const
+    {
+    if ( aVolume < KVTEngMinVolume )
+        {
+        return KVTEngMinVolume;
+        }
+    else if ( aVolume > KVTEngMaxVolume )
+        {
+        return KVTEngMaxVolume;
+        }
+    else
+        {
+        return aVolume;
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngAccessoryObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* 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:  Observer interface for indicating changes in accessories.
+*
+*/
+
+#ifndef MVTENGACCESSORYOBSERVER_H
+#define MVTENGACCESSORYOBSERVER_H
+
+//  INCLUDES
+#include    <e32std.h>
+#include    <accpolaccessorymode.h>
+
+// CLASS DECLARATION
+
+/**
+*  Interface to indicate changes in accessories.
+*
+*  @lib videoteleng
+*  @since 3.0
+*/
+class MVtEngAccessoryObserver
+    {
+    public:  // New functions
+
+        /**
+        * Callback to notify mode change in accessories.
+        * @param aMode new mode 
+        * @param aActivated audio is on 
+        */
+        virtual void AccessoryModeChanged( const TAccMode& aMode, 
+            const TBool aActivated ) = 0;
+    };
+
+#endif // MVTENGACCESSORYOBSERVER_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngCRSettingObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* 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:  Observer interface for indicating setting changes in Cent Rep
+*
+*/
+
+
+#ifndef MVTENGSETTINCRGOBSERVER_H
+#define MVTENGSETTINGCROBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Observer interface for indicating setting changes
+*
+*  @lib videoteleng.lib
+*  @since Series 60 3.0
+*/
+class MVtEngCRSettingObserver
+    {
+    public:  // New functions
+
+        /**
+        * Callback to notify changed setting
+        * @param aUid changed Uid
+        * @param aId changed id
+        * @param aNewValue new value
+        */
+        virtual void HandleNotifyInt( const TUid aUid, const TUint32 aId, 
+            TInt aNewValue ) = 0;
+
+        /**
+        * Callback to notify changed setting
+        * @param aUid changed Uid
+        * @param aId changed id
+        * @param aNewValue new value
+        */
+        virtual void HandleNotifyReal( const TUid aUid, const TUint32 aId, 
+            TReal aNewValue ) = 0;
+
+        /**
+        * Callback to notify changed setting
+        * @param aUid changed Uid
+        * @param aId changed id
+        * @param aNewValue new value
+        */
+        virtual void HandleNotifyString( const TUid aUid, const TUint32 aId, 
+            const TDesC16& aNewValue ) = 0;
+    };
+
+#endif      // MVTENGCRSETTINGOBSERVER_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngEventObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* 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:  Observer interface for video telephony events.
+*
+*/
+
+
+
+#ifndef MVTENGEVENTOBSERVER_H
+#define MVTENGEVENTOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Video telephony event observer interface.
+*
+*  @lib videlteleng
+*  @since 2.6
+*/
+class MVtEngEventObserver
+    {
+    public: // New functions        
+        
+        /**
+        * Handler method for events
+        * @param aEvent events defined in VtEngEvents.h
+        */
+        virtual void HandleVtEventL( 
+            TInt aEvent ) = 0;
+
+    };
+
+#endif      // MVTENGEVENTOBSERVER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngSettingObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* 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:  Observer interface for indicating setting changes
+*
+*/
+
+
+
+#ifndef MVTENGSETTINGOBSERVER_H
+#define MVTENGSETTINGOBSERVER_H
+
+//  INCLUDES
+#include "CVtEngSettings.h"
+
+// CLASS DECLARATION
+
+/**
+*  Observer interface for indicating setting changes
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class MVtEngSettingObserver
+    {
+    public:  // New functions
+
+        /**
+        * Handler for setting changed event
+        * @param aId id of setting
+        * @param aValue new value for the setting
+        */
+        virtual void HandleSettingChangedL( 
+            CVtEngSettings::TSettingId aId, 
+            const TDesC& aValue ) = 0;
+    };
+
+#endif      // MVTENGSETTINGOBSERVER_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/MVtEngSettingPSObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* 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:  Observer interface for indicating publish and subscribe 
+*                changes
+*
+*/
+
+
+
+#ifndef MVTENGSETTINGPSOBSERVER_H
+#define MVTENGSETTINGPSOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Observer interface for indicating P&S changes
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.8
+*/
+class MVtEngSettingPSObserver
+    {
+    public:  // New functions
+
+        /**
+        * Handler for changed event.
+        * @param aUid uid of setting 
+        * @param aKey id of setting
+        * @param aStatus status of completed AO operation
+        */
+        virtual void HandleNotifyPSL( const TUid aUid, const TInt& aKey, 
+            const TRequestStatus& aStatus ) = 0;
+    };
+
+#endif      // MVTENGSETTINGPSOBSERVER_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/TVtEngType.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* 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:  Base class for data types that can be identified by an
+*                identifier (extension id).
+*
+*/
+
+
+
+#ifndef TVTENGTTYPE_H
+#define TVTENGTTYPE_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// DATA TYPES
+
+enum TVtEngTypeId
+    {
+    EVtEngTypeV1 = 0,
+    EVtEngTypeDtmf
+    };
+
+// CLASS DECLARATION
+
+/**
+*  Base class for data types
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class TVtEngtType
+    {
+    public: // constructor
+
+        inline TInt TypeId() const;
+
+    protected: // constructors
+        /**
+        * C++ constructor that only for descendant classes may call.
+        */
+        inline TVtEngtType( TVtEngTypeId aTypeId );
+
+        /**
+        * copy constructor
+        */
+        inline TVtEngtType( const TVtEngtType& aType );
+
+    protected: // operators
+
+        inline TVtEngtType& operator=( const TVtEngtType& aType );
+
+    protected:
+        // Extension id
+        TInt  iTypeId;
+    };
+
+#include "TVtEngType.inl"
+
+#endif      // TVTENGTTYPE_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/TVtEngType.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* 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:  Inline methods for TVtEngtType.
+*
+*/
+
+
+inline TVtEngtType::TVtEngtType( TVtEngTypeId aTypeId ) 
+    : iTypeId( aTypeId ) {}
+
+inline TInt TVtEngtType::TypeId() const { return iTypeId; }
+
+inline TVtEngtType::TVtEngtType( const TVtEngtType& aType ) 
+    : iTypeId( aType.iTypeId ) {}
+
+inline TVtEngtType& TVtEngtType::operator=( const TVtEngtType& aType )
+    { iTypeId = aType.iTypeId;
+    return *this; }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngConstants.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* 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:  Constants for video telephony
+*
+*/
+
+
+
+#ifndef VTENGCONSTANTS_H
+#define VTENGCONSTANTS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <gdi.h>
+// CONSTANTS
+
+/**
+* Remote video default size.
+* QCIF where one pixel removed from left, top and right side.
+*/
+//const TSize KVtEngRemoteVideoDefaultSize( 174, 143 );
+
+/**
+* View finder default size.
+*/
+//const TSize KVtEngLocalVideoDefaultSize( 44, 36 );
+
+/**
+* Display mode
+*/
+//const TDisplayMode KVtEngDisplayMode( EColor64K );
+
+// MACROS
+
+
+#endif      // VTENGCONSTANTS_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngDefs.hrh	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* 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:  engine macro define
+*
+*/
+
+
+#ifndef VTDEFS_HRH
+#define VTDEFS_HRH
+
+
+// DATA TYPES
+// MACROS
+
+
+#if defined(_DEBUG) || defined(WINS)
+/**
+* Debugging enabled always in debug builds
+*/
+#define VTDEBUG
+#else
+/**
+* Define here for release builds (disabled by default)
+* Uncomment VTDEBUG below if you want to enable logging in UREL.
+*/
+//#define VTDEBUG
+#endif
+
+#ifdef VTDEBUG
+/** 
+* 0 = No logging
+* 1 = File logging
+* 2 = RDebug
+*/
+#if defined(__WINSCW) || defined(__WINS__) || defined (WINS)
+// In emulator log to output window
+#define VTLOGGING 1
+#else
+/**
+* In HW to which ever is desired (File (1) by default)
+* Change VTLOGGING to 1 (file) or 2 (RDebug) as desired.
+*/
+#define VTLOGGING 1
+#endif
+
+#else // !VTDEBUG
+
+// no logging
+#define VTLOGGING 0
+
+#endif //VTDEBUG
+
+#if VTLOGGING == 1
+#define VTFILELOGGING 1
+#else
+#define VTFILELOGGING 0
+#endif
+ 
+#endif // VTDEFS_HRH
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngEvents.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* 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:  Video telephony engine events
+*
+*/
+
+
+
+#ifndef VTENGEVENTS_H
+#define VTENGEVENTS_H
+
+//  INCLUDES
+#include <e32def.h>
+
+// CONSTANTS
+
+const TInt KVtEngEventNone = -1;
+
+const TInt KVtEngEventBase = 0;
+
+/**
+* Engine configuration events
+*/
+const TInt KVtEngConfigureEventBase     = KVtEngEventBase + 100; // 100
+const TInt KVtEngDurationSettingChanged = KVtEngConfigureEventBase + 1;
+const TInt KVtEngInitializationProblem  = KVtEngConfigureEventBase + 2;
+
+/**
+* Engine media events
+*/
+const TInt KVtEngMediaEventBase         = KVtEngConfigureEventBase + 100; // 200
+const TInt KVtEngCameraChanged          = KVtEngMediaEventBase + 1;
+const TInt KVtEngSourceChanged          = KVtEngMediaEventBase + 2;
+const TInt KVtEngRemoteVideoPaused      = KVtEngMediaEventBase + 3;
+const TInt KVtEngRemoteVideoResumed     = KVtEngMediaEventBase + 4;
+const TInt KVtEngRemoteAudioPaused      = KVtEngMediaEventBase + 5;
+const TInt KVtEngRemoteAudioResumed     = KVtEngMediaEventBase + 6;
+const TInt KVtEngAudioMuted             = KVtEngMediaEventBase + 7;
+const TInt KVtEngAudioUnmuted           = KVtEngMediaEventBase + 8;
+const TInt KVtEngRemoteVideoStarted     = KVtEngMediaEventBase + 10;
+const TInt KVtEngRemoteVideoStopped     = KVtEngMediaEventBase + 11;
+const TInt KVtEngRemoteAudioStarted     = KVtEngMediaEventBase + 12;
+const TInt KVtEngRemoteRenderingProblem = KVtEngMediaEventBase + 14;
+const TInt KVtEngLocalRenderingProblem  = KVtEngMediaEventBase + 15;
+const TInt KVtEngSourceCapsChanged      = KVtEngMediaEventBase + 16;
+const TInt KVtEngRemoteRenderStopped    = KVtEngMediaEventBase + 17;
+const TInt KVtEngViewFinderStopped      = KVtEngMediaEventBase + 18;
+const TInt KVtEngResolutionToSQCIF      = KVtEngMediaEventBase + 19;
+const TInt KVtEngResolutionToQCIF       = KVtEngMediaEventBase + 20;
+
+// Problems in starting negotiation with remote end
+const TInt KVtEngNegotiationProblem     = KVtEngMediaEventBase + 21;
+
+// Initializing media component failed
+const TInt KVtEngMediaInitFailure       = KVtEngMediaEventBase + 22;
+
+// Begin initialization of image sharing (convert, scale, etc.)
+const TInt KVtEngShareImageInitializeBegin = KVtEngMediaEventBase + 23;
+
+// End initialization of image sharing (convert, scale, etc.)
+const TInt KVtEngShareImageInitializeEnd   = KVtEngMediaEventBase + 24;
+
+// Informs status change in outgoing video channel.
+const TInt KVtEngMediaOutgoingVideoChannelStatusChanged =
+    KVtEngMediaEventBase + 25;
+
+// Informs status change in outgoing audio channel.
+const TInt KVtEngMediaOutgoingAudioChannelStatusChanged =
+    KVtEngMediaEventBase + 26;
+
+// Informs UI that decoding error happened during image share
+const TInt KVtEngShareImageDecodingError = KVtEngMediaEventBase + 27;
+
+// Informs UI that volume is already maximum
+const TInt KVtEngAudioVolumeMax = KVtEngMediaEventBase + 28;
+
+// Informs UI that volume is already minimum
+const TInt KVtEngAudioVolumeMin = KVtEngMediaEventBase + 29;
+
+// Informs UI that Locvid layoutchange has been done
+const TInt KVtEngLCHProviderSwitchDone =  KVtEngMediaEventBase + 30;
+
+/**
+* Engine audio events
+*/
+const TInt KVtEngAudioEventBase         = KVtEngMediaEventBase + 100; // 300
+const TInt KVtEngAudioOutputVolumeChanged = KVtEngAudioEventBase + 1;
+const TInt KVtEngAudioRoutingChanged    = KVtEngAudioEventBase + 2;
+const TInt KVtEngAudioRoutingAvailabilityChanged = KVtEngAudioEventBase + 3;
+const TInt KVtEngAudioRoutingIHFActivated = KVtEngAudioEventBase + 4;
+const TInt KVtEngAudioRoutingIHFDeactivated = KVtEngAudioEventBase + 5;
+
+/**
+* Engine session events
+*/
+const TInt KVtEngSessionEventBase       = KVtEngAudioEventBase + 100; // 400
+const TInt KVtEngSessionStateChanged    = KVtEngSessionEventBase + 1;
+const TInt KVtEngSessionAnswerPossible  = KVtEngSessionEventBase + 2;
+const TInt KVtEngSessionWaitingCallActive  = KVtEngSessionEventBase + 3;
+const TInt KVtEngSessionWaitingCallInactive = KVtEngSessionEventBase + 4;
+const TInt KVtEngCLIAvailable           = KVtEngSessionEventBase + 5;
+
+/**
+* General events
+*/
+const TInt KVtEngGeneralEventBase       = KVtEngSessionEventBase + 100; // 500
+const TInt KVtEngResourceMemAllocFailure = KVtEngGeneralEventBase + 1;
+const TInt KVtEngDtmfFailure            = KVtEngGeneralEventBase + 2;
+/**
+* Remote supports UII DTMF.
+*/
+const TInt KVtEngRemoteUIIDtmfSupport           = KVtEngGeneralEventBase + 13;
+/**
+* Remote supports UII basic string.
+*/
+const TInt KVtEngRemoteUIIBasicStringSupport = KVtEngGeneralEventBase + 14;
+/**
+* Remote supports UII IA5 string.
+*/
+const TInt KVtEngRemoteUIIIA5StringSupport   = KVtEngGeneralEventBase + 15;
+/**
+* Remote supports UII general string.
+*/
+const TInt KVtEngRemoteUIIGeneralStringSupport = KVtEngGeneralEventBase + 6;
+
+
+// Device is locked or unlocked (autolock feature)
+const TInt KVtEngDeviceLockOn           = KVtEngGeneralEventBase + 3;
+const TInt KVtEngDeviceLockOff          = KVtEngGeneralEventBase + 4;
+
+// Remote disconnected
+const TInt KVtEngRemoteDisconnect          = KVtEngGeneralEventBase + 5;
+
+#endif      // VTENGEVENTS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngPanic.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* 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:  Panic definitions for video telephone engine.
+*
+*/
+
+
+
+#ifndef CVTENGPANIC_H
+#define CVTENGPANIC_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+_LIT( KVtEngPanicCategory, "VTENG" );
+
+// DATA TYPES
+enum TVtEngPanic
+    {
+    EVtEngPanicInvalidInitializationEntry,      /** 0 */
+    EVtEngPanicInvalidInitializationState,      /** 1 */
+    EVtEngPanicIncorrectUtility,                /** 2 */
+    EVtEngPanicTlsPanic,                        /** 3 */
+    EVtEngPanicNoVideoProvider,                 /** 4 */
+    EVtEngPanicInvalidSessionState,             /** 5 */
+    EVtEngPanicMediaHandlerOpStateFailure,      /** 6 */
+    EVtEngPanicInvalidFlag,                     /** 7 */
+    EVtEngPanicInvalidPointer,                  /** 8 */
+    EVtEngPanicInvalidAudioPointer,             /** 9 */
+    EVtEngPanicCommsDestructOnInvalidState,     /** 10 */
+    EVtEngPanicUnInitIncorrectOperation,        /** 11 */
+    EVtEngPanicDisconnectTimerExpired,          /** 12 */
+    EVtEngPanicInvalidDtmfState,                /** 13 */
+    EVtEngPanicInvalidBitmapHandle,             /** 14 */
+    EVtEngPanicInvalidPortRead,                 /** 15 */
+    /** Too many asynchronous events pending in queue */
+    EVtEngPanicInvalidTooManyPendingEvents,     /** 16 */
+    /** VT variation cenrep file is missing or corrupt */
+    EVtEngPanicVtCenrepVariation,               /** 17 */
+    /** VT configuration cenrep file is missing or corrupt */
+    EVtEngPanicVtCenrepConfiguration,           /** 18 */
+    EVtEngPanicInvalidVideoQualityValue,         /** 19 */
+    EVtEngPanicWrongMediatorSenderState         /** 20 */
+    };
+
+// FUNCTION PROTOTYPES
+void Panic( TVtEngPanic aPanic );
+
+#endif // CVTENGPANIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngUtils.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,200 @@
+/*
+* 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:  Video telephony engine TLS container.
+*
+*/
+
+
+
+#ifndef VTENGUTILS_H
+#define VTENGUTILS_H
+
+//  INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class CVtEngInitializer;
+class CVtEngHandlerContainer;
+class CVtEngDebug;
+class CVtEngStateManager;
+class CVtEngSettings;
+class CVtEngEventManager;
+class CVtEngCRProxy;
+class CVtEngAccessoryHandler;
+class CVtEngSATClient;
+class CVtEngDeviceLockMonitor;
+class CVtEngExtensions;
+class CVtEngMdtrMessageListener;
+class CVtEngMdtrCommandSender;
+
+// CLASS DECLARATION
+
+/**
+*  TLS container for pointers to essential objects.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngUtility ) : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CVtEngUtility* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngUtility();
+
+    public: // New functions
+    
+        /**
+        * Creates SAT listener for updates.
+        */
+        void StartSATListenL();
+        
+        /**
+        * Returns engine initializer.
+        * @return initializer
+        */
+        inline CVtEngInitializer& Initializer() const;
+
+        /**
+        * Returns engine utility.
+        * @return utility
+        */
+        static CVtEngUtility* EngineUtils();
+
+        /**
+        * Returns state manager.
+        * @return state manager
+        */
+        static CVtEngStateManager* StateManager();
+
+        /**
+        * Returns event manager.
+        * @return event manager
+        */
+        static CVtEngEventManager& EventManager();
+
+        /**
+        * Returns Central repository proxy.
+        * @return ref to CR proxy
+        */
+        static CVtEngCRProxy& CRProxy();
+
+        /**
+        * Returns accessory listener.
+        * @return accessory handler
+        */
+        static CVtEngAccessoryHandler& AccessoryHandler();
+
+        /**
+        * Returns settings.
+        * @return ref to settings
+        */
+        static CVtEngSettings& Settings();
+        
+        /**
+        * Returns mediator command sender.
+        * @return ref to command sender
+        */
+        static CVtEngMdtrCommandSender& MediatorCommands();
+
+        /**
+        * Prepares the utility
+        * @param aHandlers handler container
+        * @param aStateManagerPtr state manager pointer ref
+        * @param aEventManagerPtr event manager pointer ref
+        * @param aExtensionPtr extension container pointer
+        */
+        void PrepareL( 
+            CVtEngHandlerContainer& aHandlers,
+            CVtEngStateManager*& aStateManagerPtr,
+            CVtEngEventManager*& aEventManagerPtr,
+            CVtEngExtensions* aExtensionPtr );
+
+        /**
+        * Notifies device lock to UI.
+        */
+        void NotifyLockState();
+        
+        /**
+        * Returns Extension container.
+        * @since S60 v3.2
+        * @return pointer to extensions
+        */
+        static CVtEngExtensions* Extensions();
+        /**
+        * Starts listening mediator messages.
+        */
+        void StartMediatorListenerL();
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngUtility();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+    private:    // Data
+
+        // Initializater for the engine
+        CVtEngInitializer*   iEngineInit;
+
+        // State manager pointer
+        CVtEngStateManager** iStateManager;
+
+        // Settigs
+        CVtEngSettings*      iSettings;
+
+        // Event manager pointer
+        CVtEngEventManager** iEventManager;
+
+        // Central repository interface
+        CVtEngCRProxy*       iCRProxy;
+
+        // Accessory handler
+        CVtEngAccessoryHandler* iAccessoryHandler;
+        
+        // SAT refresh listener
+        CVtEngSATClient* iSATClient;
+        
+        // Monitor for device lock state
+        CVtEngDeviceLockMonitor* iLockMonitor;
+        
+        // Extension pointer
+        CVtEngExtensions* iExtensions;
+        // For receiving Mediator commands and events        
+        CVtEngMdtrMessageListener* iMdtrMessageListener;
+
+        // For sending Mediator commands
+        CVtEngMdtrCommandSender*   iMdtrCommandSender;
+        
+    };
+
+#include "VtEngUtils.inl"
+
+#endif      // VTENGUTILS_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/VtEngUtils.inl	Mon Nov 23 14:47:47 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:  Video telephony engine TLS container.
+*
+*/
+
+
+// MEMBER FUNCTIONS
+
+inline CVtEngInitializer& CVtEngUtility::Initializer() const
+    {
+    return *iEngineInit;
+    }
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/cvtengincomingcallmonitor.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* 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:  Monitor for incoming call
+*
+*/
+
+
+
+#ifndef C_VTENGINCOMINGCALLMONITOR_H
+#define C_VTENGINCOMINGCALLMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "MVtEngSettingPSObserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngPubSubsListener;
+
+// CLASS DECLARATION
+/**
+*  Monitor for incoming call state.
+*
+*  @lib videoteleng
+*  @since S60 v3.2
+*/
+NONSHARABLE_CLASS( CVtEngIncomingCallMonitor ) : public CBase, public MVtEngSettingPSObserver
+    {
+public:  // Constructors and destructor
+        
+    static CVtEngIncomingCallMonitor* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVtEngIncomingCallMonitor();
+
+public: // New functions
+        
+	/**
+	 * Sends event to UI of current incoming call state
+     */
+    void NotifyState() const;
+
+public: // From MVtEngSettingPSObserver
+	
+	/**
+  	 * @see MVtEngSettingPSObserver::HandleNotifyPSL
+     */
+    void HandleNotifyPSL( const TUid aUid, const TInt& aKey, 
+    	const TRequestStatus& aStatus );
+
+private:
+    /**
+     * C++ constructor.
+     */
+    CVtEngIncomingCallMonitor();
+
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+        
+private:
+        
+     // Listener for incoming call state
+    CVtEngPubSubsListener* iIncomingCallListener;
+    };
+
+#endif      // C_VTENGINCOMINGCALLMONITOR_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/cvtengmdtrcommandsender.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 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:  Sender class for mediator commands
+*
+*/
+
+
+#ifndef C_VTENGMDTRCOMMANDSENDER_H
+#define C_VTENGMDTRCOMMANDSENDER_H
+
+//  INCLUDES
+
+#include <e32cmn.h>
+#include <mediatorcommandinitiator.h>
+#include "MVtEngEventObserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngUtility;
+class CVtEngOperation;
+class CVtEngMdtrCommandSender;
+class TVtMdtrStateIdle;
+// CLASS DECLARATION
+
+/**
+*  Mediator command sender 
+*
+*  @lib videoteleng
+*  @since 5.0
+*/
+NONSHARABLE_CLASS( CVtEngMdtrCommandSender ) :
+    public CBase, 
+    public MMediatorCommandResponseObserver,
+    public MVtEngEventObserver
+    {
+public: // constructor and destructors
+
+    /**
+    * two-phase constructor
+    */
+    static CVtEngMdtrCommandSender* NewL( CVtEngUtility& aUtils );
+    
+    // Destructor
+    ~CVtEngMdtrCommandSender();
+
+public: // new methods
+
+    /**
+     * Requests telephony to end video call
+     */
+    void EndCall();
+
+    /**
+     * Requests telephony to fallback to voice call 
+     */
+    void VoiceFallback();
+    
+    /**
+     * Requests telephony to make voice call 
+     */
+    void SwitchToVoiceL( CVtEngOperation& aOperation );
+    
+    /**
+     * Notifies telephony about outgoing audio state change
+     */
+    void NotifyOutgoingAudioState( const TBool aMicEnabled );
+    
+    void SetSenderState( TVtMdtrStateIdle& aNewState );
+        
+    
+public: // from MMediatorCommandResponseObserver
+
+        // responses are not handled but required by mediator api
+    virtual void CommandResponseL( TUid aDomain,
+           TUid aCategory, 
+           TInt aCommandId,
+           TInt aStatus, 
+           const TDesC8& aData );
+
+public: // from MVtEngEventObserver
+
+    // handles event accordint to ongoing operation
+    virtual void HandleVtEventL( TInt aEvent );
+                         
+private: // constructors
+
+    CVtEngMdtrCommandSender( CVtEngUtility& aUtils );
+    
+    void ConstructL();
+
+private:
+    // for switch to voice operation, signaled when mediator command is issued.
+    CVtEngOperation* iOperation;
+        
+    // for mediator command reception
+    CMediatorCommandInitiator* iMediatorInitiator;
+    
+    CVtEngUtility& iUtils;
+    
+    TVtMdtrStateIdle* iSenderState;
+    };
+
+#endif // C_VTENGMDTRCOMMANDSENDER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/cvtengmdtrmessagelistener.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 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:  Listener class for mediator commands
+*
+*/
+
+
+#ifndef C_VTENGMDTRMESSAGELISTENER_H
+#define C_VTENGMDTRMESSAGELISTENER_H
+
+//  INCLUDES
+
+//#include <e32cmn.h>
+#include <mediatorcommandresponder.h>
+#include <mediatoreventconsumer.h>
+#include "MVtEngEventObserver.h"
+#include  "CVtEngStateManager.h"
+#include  "MVtEngSessionInfo.h"
+
+// FORWARD DECLARATIONS
+class CMediatorCommandResponder;
+class CVtEngUtility;
+
+// CLASS DECLARATION
+
+/**
+*  Mediator command and event listener 
+*
+*  @lib videoteleng
+*  @since 5.0
+*/
+NONSHARABLE_CLASS( CVtEngMdtrMessageListener ) : 
+    public CBase, 
+    private MMediatorCommandObserver,
+    private MMediatorEventObserver,
+    private MVtEngEventObserver
+    
+    {
+public: // constructor and destructors
+
+    /**
+    * two-phase constructor
+    */
+    static CVtEngMdtrMessageListener* NewL( CVtEngUtility& aUtils );
+    
+    // Destructor
+    ~CVtEngMdtrMessageListener();
+
+public: // from MMediatorCommandObserver
+
+    virtual void MediatorCommandL( TUid aDomain,
+         TUid aCategory, 
+         TInt aCommandId,
+         TVersion aVersion, 
+         const TDesC8& aData );
+
+    virtual void CancelMediatorCommand( TUid aDomain,
+         TUid aCategory, 
+         TInt aCommandId );
+
+public: // from MMediatorEventObserver
+
+    virtual void MediatorEventL( TUid aDomain,
+        TUid aCategory, 
+        TInt aEventId, 
+        const TDesC8& aData );       
+            
+public: // from MVtEngEventObserver
+
+    // handles deferred CLI event dispatching
+    virtual void HandleVtEventL( TInt aEvent );
+                                  
+private: // constructors
+
+    CVtEngMdtrMessageListener( CVtEngUtility& aUtils );
+    
+    void ConstructL();
+
+private: // new functions
+
+    void HandleCLIEventL( const TDesC8& aData );
+    
+    TBool IsReadyForCLIEvent() const;
+    
+private:    
+    CVtEngUtility& iUtils;
+    
+    // for mediator command reception
+    CMediatorCommandResponder* iMediatorResponder;  
+    
+    CMediatorEventConsumer* iMediatorEvents;
+    
+    // supported mediator commands
+    MediatorService::RCommandList iCommandList;
+    };
+
+#endif // C_VTENGMDTRMESSAGELISTENER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Base/cvtengmediatorservice.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 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:  Handles commands received via Mediator
+*
+*/
+
+
+#ifndef C_VTENGMEDIATORSERVICE_H
+#define C_VTENGMEDIATORSERVICE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "mvtengoperationobserver.h"
+#include "MVtEngEventObserver.h"
+#include "vtengcommands.h"
+
+// FORWARD DECLARATIONS
+class CMediatorCommandResponder;
+class CVtEngOperation;
+class CVtEngInternalOperation;
+class CVtEngUtility;
+
+// CLASS DECLARATION
+
+/**
+*  Handles shutdown and audio commands from mediator. Deletes itself
+*  after service is completed.
+*
+*  @lib videoteleng
+*  @since 5.0
+*/
+NONSHARABLE_CLASS( CVtEngMediatorService ) : 
+    public CBase, 
+    private MVtEngOperationObserver,
+    private MVtEngEventObserver
+    {
+public: // constructor and destructors
+
+    /**
+     * Starts requested service.
+     * @param aResponder target for mediator response
+     * @param aUtils engine internal utility
+     * @param aCommandId service to start
+     */
+    static void StartLD( 
+        CMediatorCommandResponder& aResponder,
+        CVtEngUtility& aUtils,
+        const TUid aCategory,
+        const TInt aCommandId );
+    
+    ~CVtEngMediatorService();
+    
+public: // from MVtEngOperationObserver
+
+    /**
+    * @see MVtEngOperationObserver
+    */
+    virtual void SetOperation( CVtEngOperation* aActiveOp );
+    
+    /**
+    * @see MVtEngOperationObserver
+    */
+    virtual void CommandCompleteL(
+        const TVtEngCommandId aCommand,
+        const TInt aResult );
+
+public: // from MVtEngEventObserver
+
+    // handles event according to ongoing operation
+    virtual void HandleVtEventL( TInt aEvent );
+
+private: // c++ constructor
+
+    CVtEngMediatorService( 
+        CMediatorCommandResponder& aResponder,
+        CVtEngUtility& aUtils,
+        const TUid aCategory, 
+        const TInt aCommandId );
+    
+private:
+    
+    // prepares and starts requested operation
+    void ConstructAndDoServiceL();
+    
+    // sends response to shutdown command if shutdown already ongoing
+    TBool IsShuttingDown() const;
+    
+    void StartOperationL( const TVtEngCommandId aCommand );
+        
+    // Sends mediator response for shutdown or audio mute/unmute commands.
+    // deletes itself if not waiting internal command response.
+    void SendMediatorResponseD( const TBool aDeleteThis );
+    
+private:
+    CMediatorCommandResponder& iResponder;
+
+    CVtEngInternalOperation* iOperation;
+    
+    CVtEngUtility& iUtils;
+    
+    // mediator Category [KCatVideotelInternalCommands, KCatPhoneToVideotelCommands]
+    TUid iCategory;
+    
+    // mediator command [shutdown, mute mic, unmute mic]
+    TInt iCommandId;
+    
+    // this is used for controlling 
+    TInt iServiceStatus;
+    };
+
+#endif // T_VTENGMEDIATORSERVICE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/CVtEngCommandHandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* 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:  Command handler of the engine.
+*
+*/
+
+
+
+#ifndef CVTENGCOMMANDHANDLER_H
+#define CVTENGCOMMANDHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "MVtEngCommandHandler.h"
+#include "mvtengoperationobserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngHandlerContainer;
+class CVtEngOperation;
+
+// CLASS DECLARATION
+
+/**
+*  Handler for commands from client.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngCommandHandler ) : public CBase,
+    public MVtEngCommandHandler,
+    public MVtEngOperationObserver
+    {
+    public: // constructor and destructors
+
+        static CVtEngCommandHandler* NewL( 
+            CVtEngHandlerContainer& aHandlers );
+
+        virtual ~CVtEngCommandHandler();
+
+    public: // from MVtEngCommandHandler
+
+        /**
+        * @see MVtEngCommandHandler
+        */        
+        virtual void ExecuteL( 
+            const TVtEngCommandId aCommand,
+            TDesC8* aParams );
+
+        /**
+        * @see MVtEngCommandHandler        
+        */
+        virtual TInt CancelCommand( const TVtEngCommandId aCommandId );
+
+        /**
+        * @see MVtEngCommandHandler        
+        */
+        virtual TInt GetCommandCaps( 
+            const TVtEngCommandId aCommand );
+
+        /**
+        * @see MVtEngCommandHandler        
+        */
+        virtual TVtEngCommandId PendingCommand();
+
+        /**
+        * @see MVtEngCommandHandler        
+        */
+        virtual void AddObserverL( MVtEngCommandObserver& aObserver );
+
+        /**
+        * @see MVtEngCommandHandler        
+        */
+        virtual void RemoveObserver( MVtEngCommandObserver& aObserver );
+
+    public: // from MVtEngOperationObserver
+
+        /**
+        * Handles command completion.
+        * @param aCommand command id
+        * @param aResult Symbian OS error code.
+        */
+        virtual void CommandCompleteL( 
+            const TVtEngCommandId aCommand, 
+            const TInt aResult );
+
+        /**
+        * Sets pending asynch operation
+        * @param aActiveOp pending operation or NULL.
+        */
+        virtual void SetOperation( CVtEngOperation* aActiveOp );
+
+    private: // constructors
+
+        /**
+        * Second phase constructor
+        */
+        void ConstructL();
+
+        /**
+        * c++ constructor
+        */
+        CVtEngCommandHandler( CVtEngHandlerContainer& aHandlers );
+
+    private:
+
+        void AddToPoolL( TVtEngCommandId aCommand );
+
+        /**
+        * Validates command
+        */
+        void ValidateL( 
+            const TVtEngCommandId aCommandId,
+            TDesC8* aParams );
+
+        /**
+        * Check if command is async.        
+        */
+        void CheckAsynchronity( 
+            const TVtEngCommandId aCommandId, 
+            TInt& aCaps );
+
+        /**
+        * Check if command is supported.
+        */
+        void CheckSupport( 
+            const TVtEngCommandId aCommandId, 
+            TInt& aCaps );
+            
+        /**
+        * Check if command is applicable in current state.
+        */
+        void CheckState( 
+            const TVtEngCommandId aCommandId, 
+            TInt& aCaps );
+
+    private: // command pool
+
+        struct TVtOpItem
+            {
+            TVtEngCommandId  iId;
+            CVtEngOperation* iOperation;
+            };
+        /**
+        * Command pool for commands instantiated at construction
+        * time to guarantee certain operations.
+        */
+        NONSHARABLE_CLASS( CVtEngCmdPool ): public CArrayPtrFlat<CVtEngOperation>
+            {
+            public: // constructor and destructor
+
+                // Constructor
+                CVtEngCmdPool( TInt aGranularity );
+
+                // Destructor
+                ~CVtEngCmdPool();
+
+            public: // data structures
+                
+                
+            public: // new methods
+
+                /**
+                * Returns operation stored in the pool.
+                * @param aId command id
+                * @return operation or NULL if not found.
+                */
+                CVtEngOperation* Get( const TVtEngCommandId aId );
+                
+            };
+
+    private: // Data members
+
+        RPointerArray<MVtEngCommandObserver> iObservers;
+        CVtEngHandlerContainer&              iHandlers;
+        CVtEngOperation*                     iActiveOp;
+        CVtEngCmdPool*                       iCommandPool;
+
+    };
+
+#endif //CVTENGCOMMANDHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/CVtEngOperation.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* 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:  Operation base class.
+*
+*/
+
+
+
+#ifndef CVTENGOPERATION_H
+#define CVTENGOPERATION_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+
+// FORWARD DECLARATIONS
+class CVtEngCommandHandler;
+class CVtEngHandlerContainer;
+class MVtEngOperationObserver;
+
+/**
+*  Operation base class.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngOperation ) : public CBase
+    {
+    public: // constructor and destructors
+
+        /**
+        * two-phase constructor
+        * @param aCommandId command id
+        * @param aHandlers handler container
+        * @param aObserver observer called back when operation is completed
+        * @param aDelete if ETrue command deletes itself after completion
+        */
+        static CVtEngOperation* NewL(
+            TVtEngCommandId aCommandId,
+            CVtEngHandlerContainer& aHandlers,
+            MVtEngOperationObserver& aObserver,
+            TBool aDelete = ETrue );
+
+        /**
+        * Destructor
+        */
+        ~CVtEngOperation( );
+
+    public: // new functions
+
+        /**
+        * Performs operations.
+        * @return ETrue is operation is complete (i.e. sync).
+        */
+        virtual TBool ExecuteL( TDesC8* aParams );
+
+        /**
+        * Cancels pending command.
+        * @return ETrue if cancelled was succesfull or there
+        * is nothing to cancel.
+        */
+        TBool Cancel();
+
+        /**
+        * Returns command identifier.
+        * @return command identifier
+        */
+        inline TVtEngCommandId Command() const;
+
+        /**
+        * Returns command parameter buffer.
+        * @return parameter buffer
+        */
+        inline const TDesC8* Parameters() const;
+
+        /**
+        * Notifies observer on completion.
+        * @param aResult Symbian OS error code
+        */
+        virtual void HandleOpComplete( const TInt aResult );
+
+    protected: // new functions
+
+        /**
+        *
+        */
+        TBool OfferExecuteSyncL( TDesC8* aParams );
+
+    protected:
+        /**
+        * c++ constructor
+        */
+        CVtEngOperation(
+            TVtEngCommandId aCommandId,
+            CVtEngHandlerContainer& aHandlers,
+            MVtEngOperationObserver& aCommandHandler,
+            TBool aDelete );
+	
+		/**
+        * Handles asynchronous operation complete
+        */
+    	static TInt ASyncHandleOpComplete( TAny* aPtr );
+
+    protected:
+
+        // Command identifier
+        const TVtEngCommandId   iCommand;
+
+        // Handler container
+        CVtEngHandlerContainer& iHandlers;
+
+        // observer for command response
+        MVtEngOperationObserver&   iObserver;
+
+        // Parameter
+        TDesC8*                 iParams;
+
+        // Delete command when complete
+        TBool                   iDelete;
+		
+		// Pointer to asynchronous callback
+        CAsyncCallBack*         iAsyncCallback;
+
+		// Asynchronous callback error identifier
+        TInt                    iAsyncErr;
+    };
+
+/**
+* Utility class for unpacking data type with descriptor data.
+* @lib videoteleng
+* @since 2.6
+*/
+template <class T>
+class TVtEngOpParamUtil
+    {
+    public:
+        /**
+        * Sets parameter in aDes to aRef.
+        */
+        inline void static Set( T& aRef , const CVtEngOperation& aOp );
+    };
+
+#include    "CVtEngOperation.inl"
+
+#endif      // CVTENGOPERATION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/CVtEngOperation.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* 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:  Operation inline methods 
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::Command
+// -----------------------------------------------------------------------------
+inline TVtEngCommandId CVtEngOperation::Command() const { return iCommand; }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::Parameters
+// -----------------------------------------------------------------------------
+inline const TDesC8* CVtEngOperation::Parameters() const { return iParams; }
+
+// -----------------------------------------------------------------------------
+// TVtEngOpParamUtil::Set
+// -----------------------------------------------------------------------------
+template <class T>
+inline void TVtEngOpParamUtil<T>::Set( 
+    T& aRef,
+    const CVtEngOperation& aOp ) 
+    { 
+    TPckgC<T> pckg( aRef );
+    pckg.Set( *aOp.Parameters() );
+    aRef = pckg();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/MVtEngCommandHandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* 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:  Command handler interface of the engine.
+*
+*/
+
+
+
+#ifndef MVTENGCOMMANDHANDLER_H
+#define MVTENGCOMMANDHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+class MVtEngCommandObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Handler for commands from client.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class MVtEngCommandHandler
+    {
+    public:        
+
+        /**
+        * EAttribAsync
+        *  command is asynchronous. 
+        * EAttribEnabled
+        *  Command can be executed at the moment.
+        * EAttribSupported
+        *  Command is supported by the engine.
+        */
+        enum TCommandCaps 
+            { 
+            EAttribAsync      = 0x00000001,
+            EAttribEnabled    = 0x00000002,
+            EAttribSupported  = 0x00000004
+            };
+
+        /**
+        * Excecutes a command. This function leaves KErrNotReady
+        * if engine is in such a state that command cannot be
+        * executed.
+        * 
+        * @param aCommandId command to be executed.
+        * @param aParams command parameters, NULL if command
+        * does not require any.
+        */
+        virtual void ExecuteL( 
+            const TVtEngCommandId aCommandId,
+            TDesC8* aParams ) = 0;
+
+        /**
+        * Cancels a command.
+        * @param aCommandId command to cancel. 
+        * @return KErrNotFound if command is not pending.
+        */
+        virtual TInt CancelCommand( const TVtEngCommandId aCommandId ) = 0;
+
+        /**
+        * Returns capabilities of a command.
+        * @return command caps
+        */
+        virtual TInt GetCommandCaps( 
+            const TVtEngCommandId aCommand ) = 0;
+
+        /**
+        * Returns pending command.
+        * @return pending command
+        */
+        virtual TVtEngCommandId PendingCommand() = 0;
+
+        /**
+        * Sets command observer. First call on this is guaranteed
+        * to succeed.
+        * @param aObserver command observer.
+        */
+        virtual void AddObserverL( MVtEngCommandObserver& aObserver ) = 0;
+
+        /**
+        * Removes a command observer or if non-op if specified observer
+        * is not found.
+        * @param aObserver command observer to be removed.
+        */
+        virtual void RemoveObserver( MVtEngCommandObserver& aObserver ) = 0;
+    };
+
+#endif //MVTENGCOMMANDHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/MVtEngCommandObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* 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:  Observer for asynchronous commands.
+*
+*/
+
+
+
+#ifndef MVTENGCOMMANDOBSERVER_H
+#define MVTENGCOMMANDOBSERVER_H
+
+//  INCLUDES
+#include <vtengcommands.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+* Observer for asynchronous commands.
+*
+* @since 2.6
+*/
+class MVtEngCommandObserver
+    {
+    public: // new functions
+
+        /**
+        * Callback for command completion.
+        * @param aCommand completed command. This is
+        * same instance as passed in MVtEngCommandHandler::ExecuteL.
+        * Client may delete the command.
+        * @param aError Symbian OS error code.
+        */
+        virtual void HandleVTCommandPerformedL( 
+            TVtEngCommandId aCommand,
+            const TInt aError ) = 0;
+    };
+
+#endif      // MVTENGCOMMANDOBSERVER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/TVtEngOperationUtils.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* 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:  Handler utili
+*                
+*
+*/
+
+
+
+#ifndef TVTENGOPERATIONUTILS
+#define TVTENGOPERATIONUTILS
+
+//  INCLUDES
+#include <e32std.h>
+#include "vtengcommands.h"
+
+
+// FORWARD DECLARATIONS
+class CVtEngHandlerContainer;
+class CVtEngOperation;
+// CLASS DECLARATION
+
+/**
+*  Handles rendering operation
+* 
+*  @lib videoteleng
+*  @since 2.6
+*/
+class TVtEngRenderUtil
+    {
+    public:
+        
+        static void HandleL( 
+            CVtEngOperation& aOperation,
+            CVtEngHandlerContainer& aHandlers );
+        
+        static void Cancel(             
+            CVtEngOperation& aOperation,
+            CVtEngHandlerContainer& aHandlers );        
+    };
+
+/**
+*  Handles audio routing operation.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class TVtEngAudioRoutingUtil
+    {
+    public:
+        
+        /**
+        * 
+        * @param aOperation operation
+        */
+        static void HandleL( 
+            CVtEngOperation& aOperation );
+    };
+
+
+/**
+*  Handles audio playback operation.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class TVtEngAudioPlaybackUtil
+    {
+    public:
+        
+        static void HandleL( 
+            CVtEngOperation& aOperation,
+            CVtEngHandlerContainer& aHandlers );
+    };
+
+/**
+*  Handles media transport operation like pausing/resuming.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class TVtEngMediaTransportUtil
+    {
+    public:
+        
+        static void HandleL( 
+            CVtEngOperation& aOperation,
+            CVtEngHandlerContainer& aHandlers );
+    };
+
+/**
+*  
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class TVtEngViewFinderConfigureUtil
+    {
+    public:
+        
+        static void HandleL( 
+            CVtEngOperation& aOperation,
+            CVtEngHandlerContainer& aHandlers );
+    };
+
+/**
+*  
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class TVtEngCameraConfigUtil
+    {
+    public:
+        
+        static void HandleL( 
+            CVtEngOperation& aOperation,
+            CVtEngHandlerContainer& aHandlers );
+    };
+
+/**
+*  Handles engine initialization.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class TVtEngEngineInitUtil
+    {
+    public:
+        
+        static void HandleL( 
+            CVtEngOperation& aOperation,
+            CVtEngHandlerContainer& aHandlers );
+
+        static void Cancel( CVtEngOperation& aOperation );
+    };
+    
+  
+/**
+*  Handles extension operations.
+*
+*  @lib videoteleng
+*  @since S60 v3.2
+*/
+class TVtEngExtensionUtil
+    {
+    public:
+        
+        /**
+        * Handles extension operations
+        * @param aOperation operation
+        */
+        static void HandleL( 
+            CVtEngOperation& aOperation );
+    };
+#endif      // TVTENGOPERATIONUTILS
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/cvtenginternaloperation.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 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:  Operation class for commands not originated by UI but
+*                engine itself.
+*
+*/
+
+
+#ifndef C_VTENGINTERNALOPERATION_H
+#define C_VTENGINTERNALOPERATION_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "CVtEngOperation.h"
+
+// FORWARD DECLARATIONS
+class CVtEngCommandHandler;
+class CVtEngHandlerContainer;
+
+/**
+*  Class for handling operation (command) originated engine itself.
+*  Deviation from base class behavior: does not set itself as "active
+*  operation" in command handler (observer of the operation). Also
+*  response is given in synchronous manner.
+*
+*  @lib videoteleng
+*  @since S60 5.0
+*/
+NONSHARABLE_CLASS( CVtEngInternalOperation ) : public CVtEngOperation
+    {
+public: // constructor and destructors
+
+    /**
+    * two-phase constructor
+    * @param aCommandId command id
+    * @param aHandlers handler container
+    * @param aCommandHandler command handler
+    * @param aDelete if ETrue command deletes itself after completion
+    * @return internal operation
+    */
+    static CVtEngInternalOperation* NewL(
+        TVtEngCommandId aCommandId,
+        CVtEngHandlerContainer& aHandlers,
+        MVtEngOperationObserver& aObserver,
+        TBool aDelete = ETrue );
+
+    /**
+    * Destructor
+    */
+    ~CVtEngInternalOperation( );
+
+public: // from CVtEngOperation
+
+    /**
+    * @see CVtEngOperation
+    */
+    virtual TBool ExecuteL();
+
+    /**
+    * @see CVtEngOperation
+    */
+    virtual void HandleOpComplete( const TInt aResult );
+
+private:
+    /**
+    * c++ constructor
+    */
+    CVtEngInternalOperation(
+        TVtEngCommandId aCommandId,
+        CVtEngHandlerContainer& aHandlers,
+        MVtEngOperationObserver& aObserver,
+        TBool aDelete );
+    };
+
+#endif  // C_VTENGINTERNALOPERATION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/mvtengoperationobserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 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:  Observer interface for engine operations
+*
+*/
+
+
+#ifndef M_VTENGOPERATIONOBSERVER_H
+#define M_VTENGOPERATIONOBSERVER_H
+
+//  INCLUDES
+#include <e32def.h>
+#include "vtengcommands.h"
+
+// FORWARD DECLARATIONS
+class CVtEngOperation;
+
+// CLASS DECLARATION
+
+/**
+*  Interface for setting active operation and responding to commands
+*
+*  @lib videoteleng
+*  @since 5.0
+*/
+class MVtEngOperationObserver
+    {
+public:
+
+    virtual void SetOperation( CVtEngOperation* aActiveOp ) = 0;
+    
+    virtual void CommandCompleteL(
+        const TVtEngCommandId aCommand,
+        const TInt aResult ) = 0;
+    };
+
+#endif // M_VTENGOPERATIONOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Commands/vtengcommands.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,300 @@
+/*
+* 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:  Video telephony engine command identifiers.
+*
+*/
+
+
+
+#ifndef CVTENGCOMMANDS_H
+#define CVTENGCOMMANDS_H
+
+//  INCLUDES
+#include <e32def.h>
+
+//  DATA TYPES
+typedef TInt TVtEngCommandId;
+
+// CONSTANTS
+
+
+const TInt KVtEngCommandNone = -1;
+
+const TInt KVtEngCommandBase = 0;
+
+/**
+* Configuration commands
+*/
+const TInt KVtEngConfigureCommandBase = KVtEngCommandBase + 100;
+
+// Allocates essential resources when application starts up
+const TInt KVtEngInitializeEngine     = KVtEngConfigureCommandBase + 1;
+
+// Resets engine. Use when all video calls are ended.
+const TInt KVtEngResetEngine          = KVtEngConfigureCommandBase + 2;
+
+/**
+* Makes voice call to existing peer.
+*/
+const TInt KVtEngSwitchToVoice        = KVtEngConfigureCommandBase + 4;
+
+// Allocates essential resources when application starts up - TEST MODE
+const TInt KVtEngInitializeEngineDiag     = KVtEngConfigureCommandBase + 50;
+
+// Allocates essential resources when application starts up - TEST MODE
+const TInt KVtEngInitializeEngineTest     = KVtEngConfigureCommandBase + 51;
+//
+
+/**
+* Media commands for controlling local display and sending
+* of media (audio/video) to the peer.
+*/
+const TInt KVtEngMediaCommandBase   = KVtEngConfigureCommandBase + 100;      // 200
+
+// Actual commands
+
+/**
+* Selects source,
+* @see MVtEngMedia::TMediaSource for command parameters.
+*/
+const TInt KVtEngSetSource            = KVtEngMediaCommandBase + 1;
+
+/**
+* Async
+* Initializes default or selected camera.
+* Does not take parameters. See KVtEngSetSource command parameters.
+*/
+const TInt KVtEngPrepareCamera        = KVtEngMediaCommandBase + 2;
+
+/**
+* prepares engine to pass view finder frames to UI
+* @see MVtEngMedia::TVtEngViewFinderConfig for command parameters.
+*/
+const TInt KVtEngPrepareViewFinder    = KVtEngMediaCommandBase + 3;
+
+/**
+* Sync
+* prepares engine to render view finder frames using DSA
+* @see MVtEngMedia::TRenderingOptionsDSA for command parameters.
+*/
+const TInt KVtEngPrepareViewFinderDSA = KVtEngMediaCommandBase + 4;
+
+/**
+* Async
+* Starts view finder
+* @see MVtEngMedia::TRenderingOptionsDSA for command parameters.
+*/
+const TInt KVtEngStartViewFinder      = KVtEngMediaCommandBase + 5;
+
+/**
+* Async
+* View finder control commands, do not take parameters.
+*/
+const TInt KVtEngPauseViewFinder      = KVtEngMediaCommandBase + 6;
+const TInt KVtEngStopViewFinder       = KVtEngMediaCommandBase + 7;
+
+/**
+* Prepares engine for rendering video (with DSA) from peer
+* @see MVtEngMedia::TRenderingOptionsDSA for command parameters.
+*/
+const TInt KVtEngPrepareRemoteRenderDSA  = KVtEngMediaCommandBase + 8;
+
+/**
+* Prepares engine for rendering video from peer
+* @see MVtEngMedia::TVtEngViewFinderConfig for command parameters.
+*/
+const TInt KVtEngPrepareRemoteRender  = KVtEngMediaCommandBase + 9;
+
+/**
+* Remote video rendering commands, do not take parameters.
+*/
+const TInt KVtEngStartRenderRemote    = KVtEngMediaCommandBase + 10;
+const TInt KVtEngPauseRenderRemote    = KVtEngMediaCommandBase + 11;
+const TInt KVtEngStopRenderRemote     = KVtEngMediaCommandBase + 12;
+
+/**
+* Media transport control commands, do not take parameters.
+*/
+// Audio
+const TInt KVtEngMuteOutgoingAudio     = KVtEngMediaCommandBase + 13;
+const TInt KVtEngUnmuteOutgoingAudio    = KVtEngMediaCommandBase + 14;
+const TInt KVtEngPauseIncomigAudio      = KVtEngMediaCommandBase + 15;
+const TInt KVtEngResumeIncomigAudio     = KVtEngMediaCommandBase + 16;
+
+/**
+* Sync.
+* Sets video source provider zoom step.
+* Parameter is TInt from zero to maximum zoom step.
+* @see MVtEngMedia::GetMaxZoomStep.
+*/
+const TInt KVtEngSetZoomStep            = KVtEngMediaCommandBase + 17;
+
+/**
+* Sync
+* Sets size of remote video, parameter is of type TSize
+*/
+const TInt KVtEngSetRemoteVideoSize       = KVtEngMediaCommandBase + 18;
+
+/**
+* Sets UI foreground state (ETrue or EFalse)
+*/
+const TInt KVtEngSetUIForeground            = KVtEngMediaCommandBase + 19;
+
+/**
+* Freeze provider video.
+*/
+const TInt KVtEngFreeze                     = KVtEngMediaCommandBase + 20;
+
+/**
+* Unfreeze provider video.
+*/
+const TInt KVtEngUnfreeze                   = KVtEngMediaCommandBase + 21;
+
+/**
+* Adjusts video quality.
+*/
+const TInt KVtEngSetVideoQuality            = KVtEngMediaCommandBase + 22;
+
+/**
+* Initialize image sharing.
+*/
+const TInt KVtEngInitializeShareImage       = KVtEngMediaCommandBase + 23;
+
+/**
+* Start image sharing (must be initialized first).
+*/
+const TInt KVtEngStartShareImage            = KVtEngMediaCommandBase + 24;
+
+/**
+* Stop image sharing.
+*/
+const TInt KVtEngStopShareImage             = KVtEngMediaCommandBase + 25;
+
+/**
+* Sync
+* prepares engine to render view finder frames using DP
+* @see MVtEngMedia::TRenderingOptionsDP for command parameters.
+*/
+const TInt KVtEngPrepareViewFinderDP        = KVtEngMediaCommandBase + 26;
+
+/**
+* Prepares engine for rendering video (with DP) from peer
+* @see MVtEngMedia::TRenderingOptionsDP for command parameters.
+*/
+const TInt KVtEngPrepareRemoteRenderDP      = KVtEngMediaCommandBase + 27;
+
+/**
+* Engine reintializes camera instance when layout change happens and active
+* provider is onboard camera. If anyother provider is selected, then nothing
+* will be done by the engine.
+*/
+const TInt KVtEngHandleLayoutChange         = KVtEngMediaCommandBase + 28;
+
+/**
+ * Sync
+ * Request update last remote video frame through MVtEngFrameObserver::vtSetFrame 
+ */
+const TInt KVtEngRequestLastRemoteFrame  = KVtEngMediaCommandBase + 29;
+
+
+const TInt KVtEngPrepareRemoteRenderNGA      = KVtEngMediaCommandBase + 30;
+
+/**
+* Audio control
+*/
+const TInt KVtEngAudioCommandBase       = KVtEngMediaCommandBase + 100; // 300
+
+// Actual commands
+
+/**
+* Sets output volume level [1..10] for active audio device
+*/
+const TInt KVtEngSetAudioVolume         = KVtEngAudioCommandBase + 1;
+
+/**
+* Audiorouting command
+*/
+const TInt KVtEngSetAudioRouting        = KVtEngAudioCommandBase + 2;
+
+/**
+* Increase volume by one step.
+*/
+const TInt KVtEngIncreaseAudioVolume    = KVtEngAudioCommandBase + 3;
+
+/**
+* Decrease volume by one step.
+*/
+const TInt KVtEngDecreaseAudioVolume    = KVtEngAudioCommandBase + 4;
+
+/**
+* Session commands
+*/
+const TInt KVtEngSessionCommandBase     = KVtEngAudioCommandBase + 100;
+
+// Actual commands
+
+/**
+* Terminates session and tears down connection
+*/
+const TInt KVtEngTerminateSession       = KVtEngSessionCommandBase + 1;
+
+const TInt KVtEngSendDtmf               = KVtEngSessionCommandBase + 2;
+
+/**
+* Starts sending a DTMF tone. Takes TChar parameter. Sync
+*/
+const TInt KVtEngStartDtmfTone          = KVtEngSessionCommandBase + 3;
+
+/**
+* Stops previously started tone. Does not take parametners. Sync
+*/
+const TInt KVtEngStopDtmfTone           = KVtEngSessionCommandBase + 4;
+
+/**
+* Remote supports UII DTMF.
+*/
+const TInt KVtEngSetUIIDtmfSupport           = KVtEngSessionCommandBase + 5;
+
+/**
+* Remote supports UII basic string.
+*/
+const TInt KVtEngSetUIIBasicStringSupport = KVtEngSessionCommandBase + 6;
+
+/**
+* Remote supports UII IA5 string.
+*/
+const TInt KVtEngSetUIIIA5StringSupport   = KVtEngSessionCommandBase + 7;
+
+/**
+* Remote supports UII general string.
+*/
+const TInt KVtEngSetUIIGeneralStringSupport = KVtEngSessionCommandBase + 8;
+
+
+/**
+* Extension commands.
+*/
+const TInt KVtEngExtensionCommandBase   = KVtEngSessionCommandBase + 100; //500
+const TInt KVtEngSetContrast            = KVtEngExtensionCommandBase + 1;
+const TInt KVtEngSetBrightness          = KVtEngExtensionCommandBase + 2;
+const TInt KVtEngSetWhiteBalance        = KVtEngExtensionCommandBase + 3;
+const TInt KVtEngSetColorTone           = KVtEngExtensionCommandBase + 4;
+#if defined ( RD_VT_RTF )
+const TInt KVtEngStartRecord			= KVtEngExtensionCommandBase + 5;
+const TInt KVtEngStopRecord				= KVtEngExtensionCommandBase + 6;
+#endif // RD_VT_RTF
+
+#endif      // CVTENGCOMMANDS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/CVtEngCameraPreferences.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* 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:  Videoteleng Camera Preferences extension 
+*
+*/
+
+
+#ifndef CVTENGCAMERAPREFERENCES_H
+#define CVTENGCAMERAPREFERENCES_H
+
+//  INCLUDES
+#include "VtEngPanic.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "CVtEngOperation.h"
+
+#include <cvtlogger.h>
+#include <e32base.h>
+
+#include <mvtengcamerapreferences.h>
+#include "CVtEngExtensionBase.h"
+
+// FORWARD DECLARATIONS
+class CVSDataProvider;
+class MVtEngCameraPreferencesObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Videoteleng extension base class.
+*
+*  @lib videoteleng.lib
+*  @since S60 v3.2
+*/
+NONSHARABLE_CLASS ( CVtEngCameraPreferences ): public CVtEngExtensionBase,
+											 public MVtEngCameraPreferences
+    {
+    public: //Constructor and destructor.
+        
+        /**
+        * Symbian two-phase constructor.
+        * @return engine extension instance
+        */
+        static CVtEngCameraPreferences* NewL();
+
+        /**
+        * Destructor.
+        */
+        ~CVtEngCameraPreferences();
+        
+    public: // from base class CVtEngExtensionBase
+        
+       	/**
+        * @see CVtEngExtensionBase::GetInterface
+        */
+        virtual TAny* GetInterface();
+        
+       	/**
+        * @see CVtEngExtensionBase::HandleL
+        */
+        virtual TBool HandleL( CVtEngOperation* aOp );
+        
+        /**
+        * @see CVtEngExtensionBase::ValidateCommand
+        */
+        virtual TBool ValidateCommand( const TVtEngCommandId aCommandId );
+        
+    public: // from base class MVtEngCameraPreferences
+        
+        /**
+        * @see MVtEngCameraPreferences::GetColorTone
+        */
+        virtual TInt GetColorTone( 
+        	MVtEngCameraPreferences::TColorTone& aColortone ) const; 
+        
+        /**
+        * @see MVtEngCameraPreferences::GetSupportedColorTones
+        */
+        virtual TInt GetSupportedColorTones( 
+        	TUint32& aSupportedColorTones ) const;
+        
+        /**
+        * @see MVtEngCameraPreferences::GetWhiteBalance
+        */
+        virtual TInt GetWhiteBalance( 
+        	MVtEngCameraPreferences::TWhiteBalance& aWhiteBalance ) const;     
+        
+        /**
+        * @see MVtEngCameraPreferences::GetSupportedWhiteBalanceModes
+        */
+        virtual TInt GetSupportedWhiteBalanceModes( 
+        	TUint32& aWhiteBalance ) const; 
+        
+        /**
+        * @see MVtEngCameraPreferences::GetBrightness
+        */  
+        virtual TInt GetBrightness( TInt& aBrightness) const; 
+        
+        /**
+        * @see MVtEngCameraPreferences::GetContrast
+        */  
+        virtual TInt GetContrast( TInt& aContrast ) const;
+    
+    public:
+           
+        /**
+        * Sets data provider to camera prefefrences
+        * @param aProvider pointer to current active data provider
+        * @param aObserver reference to observer
+        */
+        virtual void SetProvider( CVSDataProvider* aProvider,
+            MVtEngCameraPreferencesObserver& aObserver );
+
+        /**
+        * Detaches observer from preference instance.
+        * @param aObserver reference to observer
+        */
+        void Detach( MVtEngCameraPreferencesObserver& aObserver );
+
+    private:
+    
+        /*
+        * C++ default constructor.
+        */        
+        CVtEngCameraPreferences();
+        
+        /**
+        * Symbian two-phase constructor.
+        */
+        void ConstructL();
+    
+    private:
+        
+        // Video source data provider pointer
+        CVSDataProvider* iProvider;
+            
+        // Preference observer pointer
+        MVtEngCameraPreferencesObserver* iObserver;
+
+    };
+        
+#endif //CVTENGCAMERAPREFERENCES_H    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/CVtEngExtensionBase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* 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:  Videoteleng extension base class 
+*
+*/
+
+
+#ifndef CVTENGEXTENSIONSBASE_H
+#define CVTENGEXTENSIONSBASE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+
+// FORWARD DECLARATIONS
+class CVtEngOperation;
+
+// CLASS DECLARATION
+
+/**
+*  Videoteleng extension base class.
+*
+*  @lib videoteleng.lib
+*  @since S60 v3.2
+*/
+NONSHARABLE_CLASS ( CVtEngExtensionBase ): public CBase
+    
+    {
+    public: // pure virtuals.
+        
+        /**
+        * Returns extension API interface 
+        * @return API IF as TAny pointer
+        */
+        virtual TAny* GetInterface() = 0;
+        
+        /**
+        * Handles requested extension operation
+        * @param aOp requested operation pointer
+        * @return TBool if operation succeed or not 
+        */
+        virtual TBool HandleL( CVtEngOperation* aOp ) = 0;
+        
+        /**
+        * Validates requested extension command
+        * @param aCommandId requested command identifier (TInt)
+        * @return TBool if command is valid or not 
+        */
+        virtual TBool ValidateCommand( const TVtEngCommandId aCommandId ) = 0;
+        
+        /**
+        * Gets extension UID
+        * @return extension UID
+        */
+        const TUid& Uid() const;
+        
+    protected:// Constructor.
+        /*
+        * C++ default constructor.
+        */        
+        CVtEngExtensionBase( TUid aExtensionUid );
+    
+    private:
+        
+        // Extension UID 
+        const TUid iExtensionUid;
+    };
+        
+#endif //CVTENGEXTENSIONSBASE_H    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/CVtEngExtensions.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* 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:  Videoteleng API extension configuration
+*
+*/
+
+
+#ifndef CVTENGEXTENSIONS_H
+#define CVTENGEXTENSIONS_H
+
+// INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+
+// CONSTANTS AND MACROS
+const TInt KExtensionGranularity = 1;
+
+// FORWARD DECLARATIONS
+class CVtEngExtensionBase;
+class CVtEngCameraPreferences;
+class CVtEngOperation;
+class CVtEngMediaHandler;
+
+// CLASS DECLARATION
+
+/**
+*  Video telephony extension handling.
+*
+*  @lib videoteleng.lib
+*  @since S60 v3.2
+*/
+NONSHARABLE_CLASS(CVtEngExtensions): public CBase
+    
+    {
+    public: // Constructor and destructor.
+
+        /**
+        * Symbian two-phase constructor.
+        * @return engine extension instance
+        */
+        static CVtEngExtensions* NewL();
+
+        /**
+        * Destructor.
+        */
+        ~CVtEngExtensions();
+
+    public: 
+        
+        /**
+        * Gets client interface from certain extension
+        * @param aInterfacePtr a pointer to client IF pointer
+        * @param aUid requested client IF extension UID
+        * @param aHandler a handle to media handler 
+        */
+        TInt GetClientInterface( TAny** aInterfacePtr, 
+        	const TUid& aUid , CVtEngMediaHandler& aHandler );
+        
+        /**
+        * Offers operation for extensions
+        * @param aOp operation pointer
+        * @return TBool value indicating if any of exsisting extension
+        * was able to handle operation 
+        */
+        TBool OfferOperationL( CVtEngOperation* aOp );
+        
+        /**
+        * Validates extension command 
+        * @param aCommandId command ID (TInt)
+        * @return TBool value indicating if any of exsisting extension
+        * was able to validate operation 
+        */
+        TBool ValidateCommand( const TVtEngCommandId aCommandId );
+        
+    private: 
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngExtensions();
+
+        /**
+        * Symbian constructor that may leave.
+        */
+        void ConstructL();
+        
+        /**
+        * Creates certain extension 
+        */
+        CVtEngExtensionBase* CreateExtensionsL( const TUid& aUid, 
+        	CVtEngMediaHandler& aHandler );
+        
+        /**
+        * Search extensions using UID 
+        */
+        TInt LookupExtensions( const TUid& aUid) const;
+    
+    private:
+        
+        // Extension handle container
+        RPointerArray <CVtEngExtensionBase> iExtensionArray;        
+        
+    };
+
+#endif //CVTENGEXTENSIONS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/MVtEngCameraPreferences.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* 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:  Videoteleng Camera Preferences extension API
+*
+*/
+
+
+#ifndef MVTENGCAMERAPREFERENCES_H
+#define MVTENGCAMERAPREFERENCES_H
+
+//	INCLUDES
+#include <ecam.h>
+#include <ecamimageprocessing.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// CONSTANTS
+const TUid KVtEngExtensionCameraPreferences = {0x10282814};
+
+/**
+*  Camera preferences extension API class.
+*
+*  @lib videoteleng.lib
+*  @since S60 v3.2
+*/
+
+class MVtEngCameraPreferences
+    {
+    public:
+
+        enum TColorTone
+        	{
+    		/** Normal colors. */
+            ENormal 	= CCamera::CCameraImageProcessing::EEffectNone,
+            /** Sepial. */
+            ESepia  	= CCamera::CCameraImageProcessing::EEffectSepia,
+            /** Black and White. */
+            EGrayscale 	= CCamera::CCameraImageProcessing::EEffectMonochrome,
+            /** Inverted colors. */
+            ENegative 	= CCamera::CCameraImageProcessing::EEffectNegative
+            };
+
+        enum TWhiteBalance
+    		{
+    		/** Automatically adjusted. */
+    		EAuto 			= CCamera::EWBAuto,
+    		/** Normal daylight. */
+    		EDaylight		= CCamera::EWBDaylight,
+    		/** Overcast daylight. */
+    		ECloudy			= CCamera::EWBCloudy,
+    		/** Tungsten filament lighting. */
+    		ETungsten		= CCamera::EWBTungsten,
+    		/** Fluorescent bulb lighting. */
+    		EFluorescent 	= CCamera::EWBFluorescent,
+    		/** Flash lighting. */
+    		EFlash			= CCamera::EWBFlash,
+    		/** High contrast daylight primarily snowy. */
+    		ESnow 			= CCamera::EWBSnow,
+    		/** High contrast daylight primarily near the sea. */
+    		EBeach 			= CCamera::EWBBeach,
+    		/** User configurable mode. */
+    		EManual 		= CCamera::EWBManual,
+    		/** Shade. */
+     		EShade			= CCamera::EWBShade
+            };
+
+        enum TBrightness
+        	{
+        	/** Automatically set brightness value*/
+            EAutomaticBrightness = KMinTInt
+            };
+
+        enum TContrasts
+        	{
+        	/** Automatically set contrast value*/
+            EAutomaticContrast = KMinTInt
+            };
+
+        /**
+        * Gets current color tone value from camera
+        * @param aColortone reference value for current color tone
+        * @return Symbian error code
+        */
+        virtual TInt GetColorTone( TColorTone& aColortone ) const = 0;
+
+        /**
+        * Gets all suported color tone values from camera
+        * @param aSupportedColorTones reference value for supported colortone
+        * values (a bit field)
+        * @return Symbian error code
+        */
+        virtual TInt GetSupportedColorTones(
+        	TUint32& aSupportedColorTones ) const = 0;
+
+        /**
+        * Gets current whitebalance value from camera
+        * @param aWhiteBalance reference value for current whitebalance
+        * @return Symbian error code
+        */
+        virtual TInt GetWhiteBalance(
+        	TWhiteBalance& aWhiteBalance ) const = 0;
+
+        /**
+        * Gets all suported whitebalance values from camera
+        * @param aWhiteBalance reference value for supported whitebalance
+        * values (a bit field)
+        * @return Symbian error code
+        */
+        virtual TInt GetSupportedWhiteBalanceModes(
+        	TUint32& aWhiteBalance ) const = 0;
+
+        /**
+        * Gets current brightness value from camera
+        * @param aBrightness reference value for current brightness
+        * @return Symbian error code
+        */
+        virtual TInt GetBrightness( TInt& aBrightness) const = 0;
+
+        /**
+        * Gets current contrast value from camera
+        * @param aContrast reference value for current brightness
+        * @return Symbian error code
+        */
+        virtual TInt GetContrast( TInt& aContrast ) const = 0;
+
+    };
+
+#endif //MVTENGCAMERAPREFERENCES_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/cvtengr2ftoneplayer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* 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:  Plays video start/stop sounds. 
+*
+*/
+
+
+#ifndef CVTENGR2FTONEPLAYER_H
+#define CVTENGR2FTONEPLAYER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mdaaudiosampleplayer.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Plays video start/stop sounds.
+* @since s60 v5.0
+*/
+NONSHARABLE_CLASS ( CVtEngR2FTonePlayer ) : public CBase,
+                         public MMdaAudioPlayerCallback 
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CVtEngR2FTonePlayer* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngR2FTonePlayer();
+
+    public: // New functions
+        /**
+        * Play a sound with given id.
+        * @param aSound identifies which sound to play
+        *        (see r_ccor_sound_list in resources).
+        * @return Symbian error code. 
+        */
+        TInt PlaySound( TInt aSound );
+        
+        /**
+        * Stop any ongoing sound.
+        */
+        void StopSound();
+
+    private: // Functions from base classes
+        /**
+        * From MMdaAudioPlayerCallback.
+        */
+        void MapcInitComplete( TInt aError, 
+            const TTimeIntervalMicroSeconds& aDuration );
+
+        /**
+        * From MMdaAudioPlayerCallback.
+        */
+        void MapcPlayComplete( TInt aError );
+
+    private: // New functions
+        /**
+        * C++ constructor.
+        */
+        CVtEngR2FTonePlayer();
+
+        /**
+        * Symbian OS 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        TBool iOpenFileInProgress;
+        TBool iSoundInProgress;
+        CMdaAudioPlayerUtility* iAudioPlayer; // owned
+
+        HBufC* iVideoStartSound;              // owned
+        HBufC* iVideoStopSound;               // owned
+    
+    public:
+       	
+       	/**
+    	*	Enum for tone player sound ID's
+    	*/
+  		enum TVtR2FSoundId
+			{
+			/** Video record start sound*/
+     		EVtR2FVideoStartSoundId = 1,
+     		/** Video record stopt sound*/
+     		EVtR2FVideoStopSoundId  
+     		};    
+    };
+
+#endif //CVTENGR2FTONEPLAYER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/cvtengrecord2file.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* 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:  Videoteleng Camera Preferences extension 
+*
+*/
+
+
+#ifndef CVTENGRECORD2FILE_H
+#define CVTENGRECORD2FILE_H
+
+//  INCLUDES
+#include "VtEngPanic.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include "CVtEngOperation.h"
+
+#include "cvtengr2ftoneplayer.h"
+
+#include <cvtlogger.h>
+#include <e32base.h>
+
+#include <mvtengrecord2file.h>
+#include "CVtEngExtensionBase.h"
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CVtEngR2FTonePlayer;
+/**
+*  Videoteleng extension base class.
+*
+*  @lib videoteleng.lib
+*  @since S60 v3.2
+*/
+NONSHARABLE_CLASS ( CVtEngRecord2File ): public CVtEngExtensionBase,
+											 public MVtEngRecord2File
+    {
+    public: //Constructor and destructor.
+        
+        /**
+        * Symbian two-phase constructor.
+        * @return engine extension instance
+        */
+        static CVtEngRecord2File* NewL();
+
+        /**
+        * Destructor.
+        */
+        ~CVtEngRecord2File();
+        
+    public: // from base class CVtEngExtensionBase
+        
+       	/**
+        * @see CVtEngExtensionBase::GetInterface
+        */
+        virtual TAny* GetInterface();
+        
+       	/**
+        * @see CVtEngExtensionBase::HandleL
+        */
+        virtual TBool HandleL( CVtEngOperation* aOp );
+        
+        /**
+        * @see CVtEngExtensionBase::ValidateCommand
+        */
+        virtual TBool ValidateCommand( const TVtEngCommandId aCommandId );
+        
+    public: // from base class MVtEngRecord2File
+    
+    	/**
+    	* For testin puposes only
+        * @see MVtEngRecord2File::IsTonePlaySupported
+        */  
+		virtual TInt IsTonePlaySupported( TBool& aSupported) const;
+           
+        
+    private:
+    
+        /**
+        * C++ default constructor.
+        */        
+        CVtEngRecord2File();
+        
+        /**
+        * Symbian two-phase constructor.
+        */
+        void ConstructL();
+    
+    public: // data
+    
+    private: // data
+        CVtEngR2FTonePlayer* iTonePlayer;
+    };
+        
+#endif //CVTENGRECORD2FILE_H    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/mvtengcamerapreferencesobserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 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:  Videoteleng Camera Preferences extension Observer
+*
+*/
+
+
+#ifndef MVTENGCAMERAPREFERENCESOBSERVER_H
+#define MVTENGCAMERAPREFERENCESOBSERVER_H
+
+//	INCLUDES
+#include <mvtengcamerapreferences.h>
+
+/**
+*  Camera preferences extension observer.
+*
+*  @lib videoteleng.lib
+*  @since S60 v5.0
+*/
+class MVtEngCameraPreferencesObserver
+    {
+
+public:
+
+    /**
+    * Called when observer is attached to camera preferences instance.
+    * @param aCamPrefs Reference to camera preferences instance this observer
+    * was attached to.
+    */
+    virtual void Attach( MVtEngCameraPreferences& aCamPrefs ) = 0;
+
+    /**
+    * Called when color tone is updated.
+    * @param aColorTone New color tone value.
+    */
+    virtual void ColorToneUpdated(
+        MVtEngCameraPreferences::TColorTone aColorTone ) = 0;
+
+    /**
+    * Called when white balance is updated.
+    * @param aWhiteBalance New white balance value.
+    */
+    virtual void WhiteBalanceUpdated(
+        MVtEngCameraPreferences::TWhiteBalance aWhiteBalance ) = 0;
+
+    /**
+    * Called when brightness is updated.
+    * @param aBrightness New brightness value set.
+    */
+    virtual void BrightnessUpdated( TInt aBrightness ) = 0;
+
+    /**
+    * Called when contrast is updated.
+    * @param aContrast New contrast value set.
+    */
+    virtual void ContrastUpdated( TInt aContrast ) = 0;
+
+    /**
+    * Called when observer is detached from camera preferences instance.
+    * @param aCamPrefs Reference to camera preferences instance this observer
+    * was detached from.
+    */
+    virtual void Detach( MVtEngCameraPreferences& aCamPrefs ) = 0;
+
+    };
+
+#endif // MVTENGCAMERAPREFERENCESOBSERVER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Extensions/mvtengrecord2file.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* 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:  Videoteleng Record to file extension API
+*
+*/
+
+
+#ifndef MVTENGRECORD2FILE_H
+#define MVTENGRECORD2FILE_H
+
+//	INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// CONSTANTS
+const TUid KVtEngExtensionRecord2File = {0x10283156}; 
+
+/**
+*  Record to file extension API class.
+*
+*  @lib videoteleng.lib
+*  @since S60 v5.0
+*/
+
+class MVtEngRecord2File
+    {
+    public:
+ 
+        /**
+        * For testin puposes only REMOVE
+        * @param  aSupported boolean for tone play support
+        * @return Symbian error code  
+        */
+        virtual TInt IsTonePlaySupported( TBool& aSupported) const = 0;
+    };    
+#endif //MVTENGRECORD2FILE_H    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngDrawDP.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,509 @@
+/*
+* Copyright (c) 2004-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:  Remote video handling class.
+*
+*/
+
+
+
+#ifndef CVTENGDRAWDP_H
+#define CVTENGDRAWDP_H
+
+//  INCLUDES
+
+#include "CVtEngRemoteVideo.h"
+#include "TVtEngRenderConfigDP.h"
+
+#include <cvtimagescaler.h>
+
+// FORWARDS
+
+class TDisplaySinkParamsDP;
+class CVtImageBitmap;
+class CVtImageScaler;
+
+// CONSTANTS AND MACROS
+
+const TInt KVtEngMaxBuffers = 2;
+
+// CLASSES
+
+/**
+*  Buffer waiter observer API
+*
+*  @lib videoteleng.lib
+*  @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( MVtEngBufferWaiterObserver )
+    {
+    public: // New methods
+
+        /**
+        * Buffer fetched without errors.
+        * @param aBuffer Pointer to fetched buffer.
+        */
+        virtual void BufferReady(
+            CPostingSurface::TPostingBuff* aBuffer ) = 0;
+
+        /**
+        * Buffer fetch error.
+        * @param aError Error code.
+        */
+        virtual void FetchError( TInt aError ) = 0;
+    };
+
+/**
+*  Display Posting drawer
+*
+*  @lib videoteleng.lib
+*  @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( CVtEngDrawDP ) : public CVtEngRemoteVideo::CVtEngDraw,
+    public MVtEngBufferWaiterObserver,
+    public MVtImageScalerObserver
+
+    {
+    public: // constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aObserver call back interface to Display Sink
+        * @return instance of CVtEngDrawDP
+        */
+        static CVtEngDrawDP* NewL( MDisplaySinkObserver* aObserver );
+
+        // Destructor
+        ~CVtEngDrawDP();
+
+    private:
+
+        /**
+        * C++ constructor as private.
+        * @param aObserver callback interface for Display Sink
+        */
+        CVtEngDrawDP( MDisplaySinkObserver* aObserver );
+
+    private: // from MVtEngDraw
+
+         /**
+        * @see CVtEngDraw::BaseConstructL
+        */
+        void BaseConstructL();
+
+        /**
+        * @see CVtEngDraw::CreateSinkL
+        */
+        MDisplaySink* CreateSinkL();
+
+        /**
+        * @see CVtEngDraw::BaseRefreshL
+        */
+        void BaseRefreshL();
+
+        /**
+        * @see CVtEngDraw::BaseRefreshBitmapsL
+        */
+        void BaseRefreshBitmapsL();
+
+        /**
+        * @see CVtEngDraw::BaseDoCancel
+        */
+        void BaseDoCancel();
+
+        /**
+        * @see CVtEngDraw::BaseVerifyConfigL
+        */
+        void BaseVerifyConfigL();
+
+        /**
+        * @see CVtEngDraw::BaseRestartL
+        */
+        void BaseRestartL();
+
+        /**
+        * @see CVtEngDraw::BaseAbortNow
+        */
+        void BaseAbortNow();
+
+        /**
+        * @see CVtEngDraw::BaseStartDrawL
+        */
+        void BaseStartDrawL();
+
+        /**
+        * @see CVtEngDraw::BaseStopDraw
+        */
+        void BaseStopDraw();
+
+        /**
+        * @see CVtEngDraw::BaseSetConfigL
+        */
+        void BaseSetConfigL( const TVtEngRenderConfig& aConfig );
+
+        /**
+        * @see CVtEngDraw::BaseSetUIForegroundL
+        */
+        void BaseSetUIForegroundL( TBool aForeground );
+
+        /**
+        * @see CVtEngDraw::BaseVideoFrameSizeChangedL
+        */
+        void BaseVideoFrameSizeChangedL( const TSize& aTo );
+
+        /**
+        * @see CVtEngDraw::BaseRequestLastFrame
+        */
+        void BaseRequestLastFrame();
+        
+        /**
+        * @see CVtEngDraw::Config
+        */
+        TVtEngRenderConfig& Config();
+
+    private: // new methods
+
+        /**
+        * Handles all delayed calls.
+        */
+        void HandleDelayedCallsL();
+
+        /**
+        * Base construct implementation
+        */
+        void DoBaseConstructL();
+
+        /**
+        * Base start drawing implementation
+        */
+        void DoBaseStartDrawL();
+
+        /**
+        * Initialize posting surface implementation
+        */
+        void DoInitializePostingSurfaceL();
+
+        /**
+        * Update sink params implementation.
+        */
+        void DoUpdateSinkParamsL();
+
+        /**
+        * Updates sink params.
+        */
+        void UpdateSinkParamsL();
+
+        /**
+        * Checks if the alpha has been trashed on screen buffer (ETrue if it
+        * has been trashed, EFalse otherwise).
+        */
+        TBool IsAlphaTrashed() const;
+
+        /**
+        * Sets clipping region (read from DSA).
+        */
+        void SetClipRegionL();
+
+        /**
+        * Initializes DP.
+        */
+        void InitializePostingSurfaceL();
+
+        /**
+        * Fills posting source params structure.
+        */
+        void GetPostingSourceParams(
+            CPostingSurface::TPostingSourceParams& aParams ) const;
+
+        /**
+        * Fills posting params structure.
+        */
+        void GetPostingParams(
+            CPostingSurface::TPostingParams& aParams ) const;
+
+        /**
+        * Returns ETrue if given format is supported, EFalse otherwise.
+        */
+        TBool SupportsFormat(
+            const CPostingSurface::TPostingFormat& aFormat ) const;
+
+        /**
+        * Returns ETrue if given size is supported, EFalse otherwise.
+        */
+        TBool SupportsSize( const TSize& aSize ) const;
+
+        /**
+        * Returns ETrue if given rotation is supported,
+        * EFalse otherwise.
+        */
+        TBool SupportsRotation(
+            CPostingSurface::TRotationType aRotation ) const;
+
+        /**
+        * Returns ETrue if mirroring is supported, EFalse otherwise.
+        */
+        TBool SupportsMirroring() const;
+
+        /**
+        * Returns ETrue if scaling is supported, EFalse otherwise.
+        */
+        TBool SupportsScaling() const;
+
+        /**
+        * Returns ETrue if brightness controlling is supported,
+        * EFalse otherwise.
+        */
+        TBool SupportsBrightness() const;
+
+        /**
+        * Returns ETrue if contrast controlling is supported,
+        * EFalse otherwise.
+        */
+        TBool SupportsContrast() const;
+
+        /**
+        * Returns buffer size in bytes for given size and current posting
+        * format.
+        */
+        TInt GetFrameBufferSize( const TSize& aTo ) const;
+
+        /**
+        * Recreates clipregion. May leave with KErrNoMemory.
+        */
+        void RecalculateClipRegionL();
+
+        /**
+        * Fixes rect for DP.
+        */
+        void FixRectForDP( TRect& aRect ) const;
+
+        /**
+        * Fills sink parameters.
+        */
+        void GetSinkParams( TDisplaySinkParamsDP& aSinkParams );
+
+        /**
+        * Returns reference to sink.
+        */
+        MDisplaySink& DisplaySink();
+
+        /**
+        * Stores given frame buffer.
+        */
+        void StoreFrameBuffer( CPostingSurface::TPostingBuff* aPostingBuffer );
+
+        /**
+        * Creates frame buffer.
+        */
+        void CreateFrameBufferL( const TSize& aSize );
+
+        /**
+        * Async draw callback.
+        */
+        static TInt CallBack( TAny* aPtr );
+
+        /**
+        * Sets given buffer available to display sink.
+        */
+        void SetAvailableToSink( CPostingSurface::TPostingBuff* aBuffer );
+
+        /**
+        * Creates instance of posting surface.
+        */
+        CPostingSurface* CreatePostingSurfaceL();
+
+        /**
+        * Close the DP API library and free the allocated instance.
+        */
+        void CloseDPLibrary();
+
+        /**
+        * Loads DP API library.
+        */
+        void LoadDPLibraryL();
+
+        /**
+        * Converts YUV420 image to bitmap.
+        */
+        void Convert420ToVtImg( HBufC8* aSource, CVtImageBitmap& aTarget );
+
+        /**
+        * Converts YUV422 image to bitmap.
+        */
+        void Convert422ToVtImg( HBufC8* aSource, CVtImageBitmap& aTarget );
+
+        /**
+        * Updates Vt frame to frame observer.
+        */
+        void UpdateVtFrame();
+
+    public: // From MVtImageScalerObserver.
+
+        /**
+        * @ see MVtImageScalerObserver.
+        */
+        virtual void ScalingFinished( TInt aError );
+
+
+    private: // from CActive
+
+        /**
+        * Handles prepared bitmap from display sink.
+        * @see CActive::RunL
+        */
+        void RunL();
+
+    private: // from MVtEngBufferWaiterObserver
+
+        /**
+        * @see MVtEngBufferWaiterObserver::BufferReady
+        */
+        void BufferReady( CPostingSurface::TPostingBuff* aBuffer );
+
+        /**
+        * @see MVtEngBufferWaiterObserver::FetchError
+        */
+        void FetchError( TInt aError );
+
+    private: // inner classes
+
+        // Buffer class for storing buffer.
+        NONSHARABLE_CLASS( TVtEngBuffer )
+            {
+            public:
+
+                /**
+                * C++ constructor
+                */
+                TVtEngBuffer();
+
+                /**
+                * Sets buffer
+                */
+                void Set( CPostingSurface::TPostingBuff* aBuffer );
+
+                /**
+                * Unsets buffer
+                */
+                void UnSet();
+
+                /**
+                * Returns ETrue if buffer is set
+                */
+                TBool IsSet() const;
+
+                /**
+                * Returns pointer reference to stored buffer.
+                */
+                CPostingSurface::TPostingBuff*& Buffer();
+
+            private:
+
+                // Pointer's pointer to buffer
+                CPostingSurface::TPostingBuff* iBuffer;
+            };
+
+        // Waiter class for asynchronous events.
+        NONSHARABLE_CLASS( CVtEngBufferWaiter ) : public CActive
+            {
+            public:
+
+                /**
+                * C++ constructor.
+                */
+                CVtEngBufferWaiter( CPostingSurface& aPostingSurface,
+                    MVtEngBufferWaiterObserver& aObserver );
+
+                /**
+                * Destructor, frees all resources allocated by this instance.
+                */
+                ~CVtEngBufferWaiter();
+
+                /**
+                * Fetch new buffer (also activates listening).
+                */
+                TInt FetchBuffer();
+
+            private: // new methods
+
+                /**
+                * Activate buffer listening (also calls CActive::SetActive()).
+                */
+                void Activate();
+
+            private: // from CActive
+
+                /**
+                * @see CActive::RunL()
+                */
+                void RunL();
+
+                /**
+                * @see CActive::DoCancel()
+                */
+                void DoCancel();
+
+            private: // data
+
+                // Posting surface instance (not owned)
+                CPostingSurface* iPostingSurface;
+
+                // BufferWaiter observer who gets informed about buffers
+                MVtEngBufferWaiterObserver* iObserver;
+            };
+
+    private: // data
+
+        // Posting surface instance
+        CPostingSurface* iPostingSurface;
+
+        // Posting capabilities
+        CPostingSurface::TPostingCapab iPostingCaps;
+
+        // Posting buffers
+        TVtEngBuffer
+            iBuffers[ MDisplaySink::EFirstBitmap + KVtEngMaxBuffers ];
+
+        // Buffer waiter instance
+        CVtEngBufferWaiter* iBufferWaiter;
+
+        // Rendering configuration
+        TVtEngRenderConfigDP iConfig;
+
+        // Clipping region
+        RRegion iClipRegion;
+
+        // Frame buffer
+        HBufC8* iFrameBuffer;
+
+        // Selected posting format
+        CPostingSurface::TPostingFormat iPostingFormat;
+
+        // DP API DLL
+        RLibrary* iDPLib;
+
+        // Source image contains converted YUV frame
+        CVtImageBitmap* iSource;
+
+        // Target image contains scaled bitmap
+        CVtImageBitmap* iTarget;
+
+        // Image scaler instance
+        CVtImageScaler* iImageScaler;
+
+        // Clip region updated
+        TBool iClipRegionUpdated;
+
+    };
+
+#endif // CVTENGDRAWDP_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngDrawDSA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,189 @@
+/*
+* 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:  Remote video handling class.
+*
+*/
+
+
+
+#ifndef CVTENGDRAWDSA_H
+#define CVTENGDRAWDSA_H
+
+//  INCLUDES
+
+#include "CVtEngRemoteVideo.h"
+#include "TVtEngRenderConfigDSA.h"
+
+// FORWARDS
+
+class TDisplaySinkParamsDSA;
+
+/**
+*  Direct Screen Access drawer
+*
+*  @lib videoteleng.lib
+*  @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( CVtEngDrawDSA ) : public CVtEngRemoteVideo::CVtEngDraw,
+    public MVtEngScalerObserver
+    {
+    public: // constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aObserver call back interface to Display Sink
+        * @return instance of CVtEngDrawDSA
+        */
+        static CVtEngDrawDSA* NewL( MDisplaySinkObserver* aObserver );
+
+        // Destructor
+        ~CVtEngDrawDSA();
+
+    private: // construction
+
+        /**
+        * C++ constructor as private.
+        * @param aObserver callback interface for Display Sink
+        */
+        CVtEngDrawDSA( MDisplaySinkObserver* aObserver );
+
+    private: // from CVtEngDraw
+
+        /**
+        * @see CVtEngDraw::BaseConstructL
+        */
+        void BaseConstructL();
+
+        /**
+        * @see CVtEngDraw::CreateSinkL
+        */
+        MDisplaySink* CreateSinkL();
+
+        /**
+        * @see CVtEngDraw::BaseRefreshL
+        */
+        void BaseRefreshL();
+
+        /**
+        * @see CVtEngDraw::BaseRefreshBitmapsL
+        */
+        void BaseRefreshBitmapsL();
+
+        /**
+        * @see CVtEngDraw::BaseDoCancel
+        */
+        void BaseDoCancel();
+
+        /**
+        * @see CVtEngDraw::BaseVerifyConfigL
+        */
+        void BaseVerifyConfigL();
+
+        /**
+        * @see CVtEngDraw::BaseRestartL
+        */
+        void BaseRestartL();
+
+        /**
+        * @see CVtEngDraw::BaseAbortNow
+        */
+        void BaseAbortNow();
+
+        /**
+        * @see CVtEngDraw::BaseStartDrawL
+        */
+        void BaseStartDrawL();
+
+        /**
+        * @see CVtEngDraw::BaseStopDraw
+        */
+        void BaseStopDraw();
+
+        /**
+        * @see CVtEngDraw::BaseSetConfigL
+        */
+        void BaseSetConfigL( const TVtEngRenderConfig& aConfig );
+
+        /**
+        * @see CVtEngDraw::BaseSetUIForegroundL
+        */
+        void BaseSetUIForegroundL( TBool aForeground );
+
+        /**
+        * @see CVtEngDraw::BaseVideoFrameSizeChangedL
+        */
+        void BaseVideoFrameSizeChangedL( const TSize& );
+
+        /**
+        * @see CVtEngDraw::BaseRequestLastFrame
+        */        
+        void BaseRequestLastFrame();
+        
+        /**
+        * @see CVtEngDraw::Config
+        */
+        TVtEngRenderConfig& Config();
+
+    private: // from CActive
+
+        /**
+        * Handles prepared bitmap from display sink.
+        * @see CActive::RunL
+        */
+        void RunL();
+
+     public: // from MVtEngScalerObserver
+
+        /**
+        * From MVtEngScalerObserver, this method is called when
+        * scaling is finished.
+        * @see MVtEngScalerObserver::ScalingCompleted
+        */
+        virtual void ScalingCompleted(
+            CFbsBitmap* aBitmap, TInt aError );
+
+    private: // New functions
+
+        /**
+        * Does the drawing.
+        * @param aBitmap a bitmap to draw
+        */
+        void DrawBitmap( CFbsBitmap& aBitmap );
+
+        /**
+        * Fills TDisplaySinkParamsDSA struct
+        */
+        void GetSinkParams( TDisplaySinkParamsDSA& aSinkParams );
+
+    private: // data
+
+        // Bitmapts for remote video (double buffering).
+        CFbsBitmap*          iBitmap1;
+        CFbsBitmap*          iBitmap2;
+
+        // Bitmap indexes indicating which.
+        // bitmap was provided.
+        MDisplaySink::TBitmapNo iBitmapNo;
+
+        // If a bitmap has been set available.
+        TBool                iBitmapSetAvail;
+
+        // VT image scaler
+        MVtEngImageScaler*   iImageScaler;
+
+        // DSA configuration
+        TVtEngRenderConfigDSA iConfig;
+    };
+
+#endif // CVTENGDRAWDSA_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngDrawNGA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,453 @@
+/*
+* 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:  Class for NGA Drawer.
+*
+*/
+
+
+#ifndef CVTENGDRAWNGA_H
+#define CVTENGDRAWNGA_H
+
+//  INCLUDES
+//#include <videorenderer.h>
+#include <posting_surface.h>
+#include <posting_surface_factory.h>
+#include <pixelformats.h>
+//#include <videoframebuffer.h>
+// GCE Surface
+#include "graphics/surfacemanager.h"
+#include "graphics/surface.h"
+#include "graphics/surfaceupdateclient.h"
+
+#include "CVtEngRemoteVideo.h"
+#include "TVtEngRenderConfigNGA.h"
+
+// FORWARDS
+
+class TDisplaySinkParamsNGA;
+
+// CONSTANTS AND MACROS
+const TInt KVtEngMaxSurfaceBuffers = 2;
+
+NONSHARABLE_CLASS( TVTSurfaceBuffer )
+    {
+    public:
+
+    /**
+    * C++ constructor
+    */
+    TVTSurfaceBuffer( TUint8* aBuffer = NULL, TInt aSurfaceNo = KErrNotFound );
+               
+    /**
+    * Returns pointer reference to stored buffer.
+    */
+    TUint8* &Buffer();
+                
+    /**
+    * Returns surface no..
+    */
+    TInt SurfaceNo();
+    
+    void Set( TUint8* aBuffer, TInt aSurfaceNo );
+    
+    void UnSet();
+                       
+    private:
+
+    // Pointer's pointer to buffer
+    TUint8* iBuffer;
+    TInt iSurfaceBufferNo;
+    };    
+
+/**
+*  Buffer waiter observer API
+*
+*  @lib videoteleng.lib
+*  @since Series 60 MCL
+*/
+NONSHARABLE_CLASS( MVtEngNGABufferWaiterObserver )
+    {
+    public: // New methods
+
+        /**
+        * Buffer fetched without errors.
+        * @param aBuffer Pointer to fetched buffer.
+        */
+        virtual void BufferReadyL(
+                TVTSurfaceBuffer* aBuffer ) = 0;
+
+        /**
+        * Buffer fetch error.
+        * @param aError Error code.
+        */
+        virtual void FetchError( TInt aError ) = 0;
+    };
+
+
+/**
+*  DNGA drawer
+*
+*  @lib videoteleng.lib
+*  @since Series 60 MCL
+*/
+NONSHARABLE_CLASS( CVtEngDrawNGA ) : 
+    public CVtEngRemoteVideo::CVtEngDraw,
+    public MVtEngNGABufferWaiterObserver
+    {
+    
+    public: // constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aObserver call back interface to Display Sink
+        * @return instance of CVtEngDrawDSA
+        */
+        static CVtEngDrawNGA* NewL( MDisplaySinkObserver* aObserver );
+
+        // Destructor
+        ~CVtEngDrawNGA();
+
+    private: // construction
+
+        /**
+        * C++ constructor as private.
+        * @param aObserver callback interface for Display Sink
+        */
+        CVtEngDrawNGA( MDisplaySinkObserver* aObserver );
+
+    private: // from CVtEngDraw
+
+        /**
+        * @see CVtEngDraw::BaseConstructL
+        */
+        void BaseConstructL();
+
+        /**
+        * @see CVtEngDraw::CreateSinkL
+        */
+        MDisplaySink* CreateSinkL();
+
+        /**
+        * @see CVtEngDraw::BaseRefreshL
+        */
+        void BaseRefreshL();
+
+        /**
+        * @see CVtEngDraw::BaseRefreshBitmapsL
+        */
+        void BaseRefreshBitmapsL();
+
+        /**
+        * @see CVtEngDraw::BaseDoCancel
+        */
+        void BaseDoCancel();
+
+        /**
+        * @see CVtEngDraw::BaseVerifyConfigL
+        */
+        void BaseVerifyConfigL();
+
+        /**
+        * @see CVtEngDraw::BaseRestartL
+        */
+        void BaseRestartL();
+
+        /**
+        * @see CVtEngDraw::BaseAbortNow
+        */
+        void BaseAbortNow();
+
+        /**
+        * @see CVtEngDraw::BaseStartDrawL
+        */
+        void BaseStartDrawL();
+
+        /**
+        * @see CVtEngDraw::BaseStopDraw
+        */
+        void BaseStopDraw();
+
+        /**
+        * @see CVtEngDraw::BaseSetConfigL
+        */
+        void BaseSetConfigL( const TVtEngRenderConfig& aConfig );
+
+        /**
+        * @see CVtEngDraw::BaseSetUIForegroundL
+        */
+        void BaseSetUIForegroundL( TBool aForeground );
+
+        /**
+        * @see CVtEngDraw::BaseVideoFrameSizeChangedL
+        */
+        void BaseVideoFrameSizeChangedL( const TSize& );
+
+        /**
+        * @see CVtEngDraw::BaseRequestLastFrame
+        */        
+        void BaseRequestLastFrame();
+        
+        /**
+        * @see CVtEngDraw::Config
+        */
+        TVtEngRenderConfig& Config();
+        
+    private: // New mothod
+       
+        /**
+        * Returns reference to sink.
+        */
+        MDisplaySink& DisplaySink();     
+               
+        /**
+        * Base construct implementation
+        */
+        void DoBaseConstructL();
+        
+        /**
+        * Base start drawing implementation
+        */
+        void DoBaseStartDrawL();             
+    
+        /**
+        * Sets given buffer available to display sink.
+        */
+        void SetAvailableToSink( TVTSurfaceBuffer* aBuffer );     
+        
+        /**
+        * Update sink params implementation.
+        */
+        void DoUpdateSinkParamsL();
+
+        /**
+        * Updates sink params.
+        */
+        void UpdateSinkParamsL();   
+
+        /**
+        * Create surface
+        */        
+        void CreateSurfaceL();
+        
+        /**
+        * Create surface implementation
+        */        
+        void DoCreateSurfaceL();        
+        
+        static TInt SurfaceBuffer0Ready(TAny* aAny);
+        
+        static TInt SurfaceBuffer1Ready(TAny* aAny);
+     
+        TBool DoSurfaceBuffer0Ready();
+        
+        TBool DoSurfaceBuffer1Ready();
+   
+    public: //from MVtEngNGABufferWaiterObserver
+    
+        /**
+        * @see MVtEngNGABufferWaiterObserver::BufferReadyL
+        */
+        void BufferReadyL( TVTSurfaceBuffer* aBuffer );
+
+        /**
+        * @see MVtEngNGABufferWaiterObserver::FetchError
+        */
+        void FetchError( TInt aError );
+    
+        
+    private:
+        /**
+        *  @see CActive::RunL
+        */       
+        void RunL();
+        
+    private: // New functions
+        /**
+        * Fills TDisplaySinkParamsNGA struct
+        */
+        void GetSinkParams( TDisplaySinkParamsNGA& aSinkParams );
+        
+    private: //inner class
+        
+        // Buffer class for storing buffer.
+        NONSHARABLE_CLASS( TVtEngBuffer )
+            {
+            public:
+
+                /**
+                * C++ constructor
+                */
+                TVtEngBuffer();
+
+                /**
+                * Sets buffer
+                */
+                void Set( TVTSurfaceBuffer* aBuffer );                
+
+                /**
+                * Unsets buffer
+                */
+                void UnSet();
+
+                /**
+                * Returns ETrue if buffer is set
+                */
+                TBool IsSet() const;
+
+                /**
+                * Returns pointer reference to stored buffer.
+                */
+                TVTSurfaceBuffer* &SurfaceBuffer();
+                
+                /**
+                * Returns pointer reference to stored buffer.
+                */
+                TUint8* &Buffer();
+                                
+            private:
+
+                // Pointer's pointer to buffer
+                TUint8* iBuffer;
+                TVTSurfaceBuffer* iSurfaceBuffer;
+            };    
+            
+        // Waiter class for asynchronous events.
+        NONSHARABLE_CLASS( CVtEngBufferWaiter ) : public CActive
+            {
+            public:
+
+                /**
+                * C++ constructor.
+                */
+                CVtEngBufferWaiter( //CVideoRenderer& aVideoRenderer,
+                    MVtEngNGABufferWaiterObserver& aObserver );
+
+                /**
+                * Destructor, frees all resources allocated by this instance.
+                */
+                ~CVtEngBufferWaiter();
+
+                /**
+                * Fetch new buffer (also activates listening).
+                */
+                TInt FetchBuffer();
+                
+                /**
+                * One SurfaceBuffer is available
+                */
+                void BufferAvailable(TVTSurfaceBuffer& aBuffer); 
+
+            private: // new methods
+
+                /**
+                * Activate buffer listening (also calls CActive::SetActive()).
+                */
+                void Activate();
+
+            private: // from CActive
+
+                /**
+                * @see CActive::RunL()
+                */
+                void RunL();
+
+                /**
+                * @see CActive::DoCancel()
+                */
+                void DoCancel();
+
+            private: // data
+
+                // Video frame renderer (not owned)
+                //CVideoRenderer* iVideoRenderer;
+
+                // BufferWaiter observer who gets informed about buffers
+                MVtEngNGABufferWaiterObserver* iObserver;      
+                
+                //Avaiable surface buffers
+                TVTSurfaceBuffer* iBuffers[KVtEngMaxSurfaceBuffers];         
+                
+            };
+            
+        // Surface Buffer Active Call back.
+        NONSHARABLE_CLASS( CActiveCallBack ) : public CActive
+            {
+            public:
+                CActiveCallBack( TCallBack aCallBack, TInt aPriority): CActive(aPriority), iCallBack(aCallBack) 
+                    {};
+                CActiveCallBack();
+                           
+            public: // Functions from base classes
+                void SetActive() 
+                    { 
+                    CActive::SetActive();
+                    }; 
+                void RunL() 
+                    { 
+                    iCallBack.CallBack();
+                    };
+                void DoCancel() 
+                    {};
+                           
+            private: // Data
+                TCallBack iCallBack;
+            };
+
+    private: // data        
+    
+        //Video frame renderer
+        //CVideoRenderer *iVideoRenderer;
+        RSurfaceManager* iSurfaceManager;
+        RSurfaceUpdateSession iSurfaceUpdateSession;
+        //Surface pixel format
+        TUidPixelFormat iSurfaceFormat;
+        
+        RChunk* iSurfaceChunk;
+        
+        TInt8* iChunkBuffer0;
+        
+        TInt8* iChunkBuffer1;
+        
+        TVTSurfaceBuffer iSurfaceBuffer0;
+        
+        TVTSurfaceBuffer iSurfaceBuffer1;
+        
+        //CActiveCallBack* iSurfaceBufferAo0; 
+        
+        //CActiveCallBack* iSurfaceBufferAo1;
+        
+        CActiveCallBack* iCallBackTable[KVtEngMaxSurfaceBuffers];
+        
+        //NGA surface id
+        TSurfaceId iSurfaceId;
+        
+        //NGA surface has created
+        TBool	iSurfaceCreated;        
+               
+        // Buffer waiter instance
+        CVtEngBufferWaiter* iBufferWaiter;              
+        
+        // Surface buffers
+        TVtEngBuffer
+            iSurfaceBuffers[ MDisplaySink::EFirstBitmap + KVtEngMaxSurfaceBuffers ];   
+        
+        TSglQue<TVtEngBuffer> iWaitingBuffers; // buffers waiting to be submitted
+        TBool iSubmitPending;
+
+        //configuration
+        TVtEngRenderConfigNGA iConfig;
+        
+    };
+
+#endif // CVTENGDRAWDSA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngDtmfHandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,174 @@
+/*
+* 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:  DTMF handler
+*
+*/
+
+
+
+#ifndef CVTENGDTMFHANDLER_H
+#define CVTENGDTMFHANDLER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <mvtprotocolhandler.h>
+#include "CVtEngDtmfState.h"
+#include "CVtEngOperation.h"
+#include "MVtEngDtmfHandler.h"
+
+// FORWARD DECLARATIONS
+class MVTUserInput;
+
+// CLASS DECLARATION
+
+/**
+*  Base class for data types
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfHandler ) : public CBase, public MVtEngDtmfHandler
+    {
+    public: // Data structures
+        enum TUIISupport
+            {
+            EBasicString    = 2,
+            EIA5String      = 4,
+            EGeneralString  = 8,
+            EDTMFString     = 16
+            };
+
+    public: // constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aH324Config H324 configure interface
+        * @return dtmf handler
+        */
+        static CVtEngDtmfHandler* NewL( 
+            MVtH324ConfigCommand& aH324Config );
+
+        /**
+        * Destructor
+        */
+        ~CVtEngDtmfHandler();
+
+    public: // from MVtEngDtmfHandler
+
+        /**
+        * @see MVtEngDtmfHandler
+        */
+        virtual void HandleL( CVtEngOperation& aOp );
+
+        /**
+        * @see MVtEngDtmfHandler
+        */
+        virtual CVtEngDtmfState& ActivateState( 
+            MVtEngDtmfHandler::TVtEngDtmfState aNewState );
+
+        /**
+        * @see MVtEngDtmfHandler
+        */
+        virtual void SendComplete( TInt aError );
+
+        /**
+        * @see MVtEngDtmfHandler
+        */
+        virtual MVTUserInput& ReserveProtoDtmfL(
+            const TVtEngDtmfTone& aTone  );
+
+        /**
+        * @see MVtEngDtmfHandler
+        */
+        virtual void ReleaseProtoDtmf();
+
+		/**
+        * @see MVtEngDtmfHandler
+        */
+		virtual TBool CheckCommandId( TInt aCheckCommandId ) const;
+
+		/**
+        * @see MVtEngDtmfHandler       
+        */
+		virtual void StoreCommandId( TInt aStoreCommandId );
+
+
+    public: // Protocol DTMF Support
+
+        /**
+        * Specifies the UII support
+        * @param aValue the support to be used
+        */
+        void SetUIISupport( TUIISupport aValue );
+
+        /**
+        * Gets the current UII support
+        * @return UII support
+        */
+        TUIISupport GetUIISupport() const;
+
+    private: // constructors
+
+        /**
+        * C++ constructor
+        */
+        CVtEngDtmfHandler( MVtH324ConfigCommand& aH324Config );
+
+        /**
+        * 2nd phase constructor
+        */
+        void ConstructL();
+
+    private: // new functions
+
+        /**
+        * Handles completion of DTMF sending, leavable method.
+        */
+        void HandleSendCompleteL( TInt aError );
+
+        /**
+        * Creates a state instance
+        * @param EVtDtmfStateIdle, EVtDtmfStateSending or EVtDtmfStateBuffered
+        */
+        void CreateStateL( TInt aState );
+
+    private: // member data
+
+        // DTMF states
+        CArrayPtrFlat<CVtEngDtmfState>* iDtmfStates;
+
+        // current state index
+        TVtEngDtmfState                 iCurrentState;
+
+        // protocol tone
+		MVTUserInput*        iProtoDtmf;
+
+        // H324 interface
+        MVtH324ConfigCommand&        iH324Config;
+
+        // Indicates supported UII type: 
+        // 16 DTMF
+        // 8 General String
+        // 4 IA5 String
+        // 2 Basic string
+        TUIISupport iUIISupport;
+
+		// DTMF command ID returned by H324 interface for last tone		
+		TInt iIssuedDtmfCommandId;
+    };
+
+
+#endif      CVTENGDTMFHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngImageScaler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* 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:  Scaler for bitmaps.
+*
+*/
+
+
+
+#ifndef CVTENGIMAGESCALER_H
+#define CVTENGIMAGESCALER_H
+
+//  INCLUDES
+#include "MVtEngImageScaler.h"
+#include <cvtimagescaler.h>
+
+// FORWARD DECLARATIONS
+class MVtEngScalerObserver;
+class CVtImageScaler;
+class CVtImageBitmap;
+
+/**
+* Image scaler implementation class.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.8
+*/
+NONSHARABLE_CLASS( CVtEngImageScaler ) : public CBase,
+    public MVtImageScalerObserver,
+    public MVtEngImageScaler
+    {
+    public: // constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aObserver scaling finished callback.
+        * @return scaler
+        */
+        static MVtEngImageScaler* NewL(
+            MVtEngScalerObserver& aObserver );
+
+        /**
+        * Destructor
+        */
+        virtual ~CVtEngImageScaler();
+
+    private: // constructor
+        
+        /**
+        * C++ constructor.
+        * @param aObserver scaling finished callback.
+        */
+        CVtEngImageScaler(
+            MVtEngScalerObserver& aObserver );
+
+
+        /**
+        * Symbian constructor that may leave.
+        */
+        void ConstructL();
+
+    public: // From MVtEngImageScaler.
+
+        /**
+        * @see MVtEngImageScaler.
+        */
+        virtual void ScaleL(
+            TInt aSourceIndex );
+
+        /**
+        * @see MVtEngImageScaler
+        */
+        virtual TBool ConfigureL(
+            TDisplayMode aDisplayMode,
+            TSize aSize, 
+            TInt aSourceHandle1,
+            TInt aSourceHandle2 );
+
+        /**
+        * @see MVtEngImageScaler.
+        */
+        virtual void Release();
+
+        /**
+        * @see MVtEngImageScaler.
+        */
+        virtual TInt Cancel();
+
+    public: // From MVtImageScalerObserver.
+
+        /**
+        * @ see MVtImageScalerObserver.
+        */
+        virtual void ScalingFinished( TInt aError );
+
+    private:
+        /**
+        * EFirstBitmap 
+        *  Use the first bitmap.
+        * ESecondBitmap 
+        *  Use the second bitmap.
+        */
+        enum 
+	        {
+            EFirstBitmap  = 0,
+            ESecondBitmap = 1
+            };
+
+        /**
+        * Fetches the used scaling method from locally.
+        * variated properties, and stores it into iScalingMethod.
+        */
+        void GetScalingMethodL();
+
+    private:
+
+        // Observer receiving scaled bitmaps.
+        MVtEngScalerObserver& iObserver;
+
+        // Actual component doing the scaling.
+        CVtImageScaler* iVtScaler;
+
+        // Target bitmaps.
+        RPointerArray<CVtImageBitmap> iTargets;
+
+        // Source bitmaps.
+        RPointerArray<CVtImageBitmap> iSources;
+
+        // Bitmap index in targets.
+        TInt                iTargetBitmapInUse;
+
+        // Display mode.
+        TDisplayMode        iMode;
+
+        // Scaled size.
+        TSize               iSize;
+
+        // Method of scaling
+        CVtImageScaler::TQuality    iScalingMethod;
+    };
+
+#endif  // CVTENGIMAGESCALER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngLocalVideo.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1475 @@
+/*
+* Copyright (c) 2004-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:  Local video handler.
+*
+*/
+
+
+#ifndef CVTENGLOCALVIDEO_H
+#define CVTENGLOCALVIDEO_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <capivideosource.h>
+#include "TVtEngRendering.h"
+#include "TVtEngRenderingDSA.h"
+#include "TVtEngRenderingDP.h"
+#include "TVtEngRenderingNGA.h"
+#include "VtEngEvents.h"
+#include "MVtEngMedia.h" //TMediaSource
+#include "MVtEngSettingPSObserver.h"
+#include "CVTEngPubSubsListener.h"
+#include "mvtengcamerapreferencesobserver.h"
+
+// FORWARD DECLARATIONS
+class CVSDataProvider;
+class CVtEngMediaHandler;
+class CVtEngCameraPreferences;
+
+// CLASS DECLARATION
+
+/**
+*  Local (uplink) video handling.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngLocalVideo ) :
+    public CActive,
+    public MVSDataProviderObserver,
+    public MVSDataSourceObserver,
+    public MVSControllerObserver,
+	public MVtEngSettingPSObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Symbian two-phase constructor.
+        * @param aObserver callback interface to Media Handler
+        * @return local video instance
+        */
+        static CVtEngLocalVideo* NewL(
+            CVtEngMediaHandler& aObserver );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngLocalVideo();
+
+    public: // Public data structures
+        enum TVtEngProviderType
+            {
+            KVtEngProviderUndefined  = -1,
+            /** Blank imnage provider */
+            KVtEngProviderNone       = 0,
+            /** Primary camera provider */
+            KVtEngProviderCam1,
+            /** Secondary camera provider */
+            KVtEngProviderCam2,
+            /** GS image provider */
+            KVtEngProviderImage,
+            /** ? */
+            KVtEngProviderTempImage,
+            /** Still share provider */
+            KVtEngProviderShareImage,
+            /** Video share provider */
+            KVtEngProviderShareVideoClip,
+            /** Default image provider */
+            KVtEngProviderDefaultStillImage
+            };
+
+    public: // from MVSDataProviderObserver
+
+        /**
+        * @see MVSDataProviderObserver::vsProviderError
+        */
+        virtual void vsProviderError( TInt aError );
+
+        /**
+        * @see MVSDataProviderObserver::vsProviderReady
+        */
+        virtual void vsProviderReady();
+
+        /**
+        * @see MVSDataProviderObserver::vsViewFinderFrameReady
+        */
+        virtual void vsViewFinderFrameReady( CFbsBitmap& aFrame );
+
+    public: // from MVSDataSourceObserver
+
+        /**
+        * @see MVSDataSourceObserver::vsProviderSwitchDone
+        */
+        virtual void vsProviderSwitchDone( CVSDataProvider* aOldProvider );
+
+    public: // from MVSControllerObserver
+
+        /**
+        * @see MVSControllerObserver::vsProvidersChanged
+        */
+        void vsProvidersChanged( TBool aAttached );
+
+    public: // From MVtEngSettingPSObserver.
+
+        /** @see MVtEngSettingPSObserver */
+        virtual void HandleNotifyPSL( const TUid aUid,
+                const TInt& aKey, const TRequestStatus& aStatus );
+
+    public:  // New functions
+
+        /**
+        * Pauses frame sending from video source (this method is called when
+        * VT is initializing and video source has not yet been added to stack)
+        *
+        */
+        void PauseVideoSending();
+
+        /**
+        * Resumes frame sending from video source.
+        *
+        */
+        void ResumeVideoSending();
+
+        /**
+        * Tells if the provider has started viewfinder.
+        * @return ETrue if started
+        */
+        TBool ViewFinderStarted() const;
+
+        /**
+        * Tells if the provider has been frozen.
+        * @return ETrue if frozen
+        */
+        TBool IsFrozen() const;
+
+        /**
+        * Creates an audio source.
+        * @return an error code
+        */
+        TInt CreateAudioSource();
+
+        /**
+        * Sets configuration for view finder.
+        * @param aParams view finder configuration
+        */
+        void SetViewFinderParameters( const TVtEngRenderingOptions& aParams );
+
+        /**
+        * Sets DSA configuration for view finder.
+        * @param aDSA DSA configuration
+        */
+        void SetViewFinderParameters( const TVtEngRenderingOptionsDSA& aDSA );
+
+        /**
+        * Sets DP configuration for view finder.
+        * @param aDP DP configuration
+        */
+        void SetViewFinderParameters( const TVtEngRenderingOptionsDP& aDP );
+
+        /**
+        * Sets default still image.
+        */
+        void SetDefaultStillImageL();
+
+        /**
+        * Sets still image or none.
+        * @param aSetAsActive sets as active provider
+        */
+        void SetStillImageL( TBool aSetAsActive );
+
+        /**
+        * Initializes default blank provider.
+        */
+        void InitializeL();
+
+        /**
+        * Selects camera1, camera2, still image or none as source.
+        * @param aSource video source
+        * @return ETrue if selecting started
+        */
+        TBool SelectSourceL( TVtEngProviderType aSource );
+
+        /**
+        * Returns currently active video provider.
+        * @return provider type
+        */
+        TVtEngProviderType ActiveProvider( ) const;
+
+        /**
+        * Starts view finder if it was started earlier and current state is
+        * ELocReady.
+        */
+        void StartViewFinderIfWasStartedL();
+
+        /**
+        * Starts view finder. Uses either DSA or WS depending on
+        * which configuration is active.
+        * @param aClientRequest request issued by user
+        */
+        void StartViewFinderL( TBool aClientRequest = EFalse );
+
+        /**
+        * Stops view finder.
+        * @param aClientRequest request issued by user
+        */
+        void StopViewFinder( TBool aClientRequest = EFalse );
+
+        /**
+        * Freeze video sending (i.e. start sending last frame only).
+        */
+        void FreezeL();
+
+        /**
+        * Unfreeze video sending (i.e. resume sending).
+        */
+        void UnfreezeL();
+
+        /**
+        * Checks that all other providers don't have
+        * view finder active and stops if found.
+        * @param aProvider provider that should not be stopped
+        */
+        void CheckOthersStopped( const CVSDataProvider& aProvider );
+
+        /**
+        * Returns video source.
+        * @return video source
+        */
+        MVTVideoSource* Source() const;
+
+        /**
+        * Returns audio source.
+        * @return audio source
+        */
+        MVTAudioSource* AudioSource() const;
+
+        /**
+        * Gets media state.
+        * @param aActiveMedia returns active TMediaType
+        * @return Symbian OS error code
+        */
+        TInt GetMediaState( TInt& aActiveMedia );
+
+        /**
+        * Gets source type.
+        * @return media source type
+        */
+        MVtEngMedia::TMediaSource GetMediaSource();
+
+        /**
+        * Gets source capabilities.
+        * @param aCaps capability of providers
+        * @return Symbian OS error code
+        */
+        TInt GetSourceCaps( TInt& aCaps );
+
+        /**
+        * Sets boolean to indicate if the provider is to be initialized only.
+        * Selected camera is not necessary activated. If current media is
+        * other than camera, initialization can be done on the background.
+        * @param aInitOnly boolean value stating if to initialize only
+        */
+        void InitializeOnly( TBool aInitOnly = ETrue );
+
+        /**
+        * Sets boolean to indicate if the provider is to be initialized only.
+        * @param aInitOnly boolean value stating if to initialize only
+        */
+        void InitializeOnlyEx( TBool aInitOnly = ETrue );
+
+        /**
+        * Indicates if camera provider is initialized.
+        * @param aId provider ID
+        * @param aInitialized
+        * @return Symbian OS error code
+        */
+        TInt IsInitialized( MVtEngMedia::TCameraId aId, TBool& aInitialized );
+
+        /**
+        * Gets camera info.
+        * @param TCameraId camera ID
+        * @param aInfo camera info
+        * @return Symbian OS error code
+        */
+        TInt GetCameraInfo( MVtEngMedia::TCameraId aId,
+            MVtEngMedia::TCameraInfo& aInfo );
+
+        /**
+        * Gets current digital zoom step (Factor in VS camera terminology).
+        * @param aCurrentStep current zoom step
+        * @return Symbian OS error code
+        */
+        TInt GetDigitalZoomFactor( TInt& aCurrentStep );
+
+        /**
+        * Gets maximum digital zoom value that may be passed to camera.
+        * @param aMaxZoomStep maximum zoom step
+        * @return Symbian OS error code
+        */
+        TInt GetMaxDigitalZoomStep( TInt& aMaxZoomStep );
+
+        /**
+        * Gets number of major zoom level leaps.
+        * One to maximum digital zoom steps plus one.
+        * Less than or equal to maximum digital zoom steps plus one.
+        * @param aCount number of leaps
+        * @param aProviderSupplied use original or mapped
+        * @return Symbian OS error code
+        */
+        TInt GetMajorDigitalZoomStepCount( TInt& aCount,
+            TBool aProviderSupplied = EFalse );
+
+        /**
+        * Maps major zoom leap step to corresponding step index.
+        * @param aIndex major zoom step
+        * @param aStep zoom step
+        */
+        void GetMajorDigitalZoomStep( const TInt aIndex, TInt& aStep );
+
+        /**
+        * Sets video provider's digital zoom step.
+        * @param aDigitalZoomFactor step
+        */
+        void SetDigitalZoomFactorL( TInt aDigitalZoomFactor );
+
+        /**
+        * Gets video provider's freeze support.
+        * @param aFreezeSupported Freeze support status
+        * @return KErrNotReady if provider not initialized.
+        */
+        TInt GetFreezeSupported( TBool& aFreezeSupported ) const;
+
+        /**
+        * Returns ETrue if it is ok to freeze provider.
+        */
+        TBool OkToFreeze() const;
+
+        /**
+        * Returns ETrue if it is ok to unfreeze provider.
+        */
+        TBool OkToUnfreeze() const;
+
+        /**
+        * Sets audio as muted.
+        */
+        void Mute();
+
+        /**
+        * Resumes audio output.
+        */
+        void UnMute();
+
+        /**
+        * Sets UI foreground state (i.e. is the Application
+        * current active application or not).
+        * @param aForeground ETrue if the VT application is
+        * in foreground, EFalse otherwise.
+        */
+        void SetUIForeground( TBool aForeground );
+
+        /**
+        * Gets current media object sharing state. Only local video related
+        * checks do here. Connection issues have been checked by
+        * the caller.
+        * @param aObjectSharingState On return contains current media object
+        * sharing state. @see MVtEngMedia::TShareObjectState.
+        */
+        void GetObjectSharingState(
+            MVtEngMedia::TShareObjectState& aObjectSharingState ) const;
+
+        /**
+        * Start Image sharing initialization.
+        */
+        void InitializeShareImageL(
+            const MVtEngMedia::TShareObjectImageParameters& aParameters,
+            TBool& aFirstTime );
+
+        /**
+        * Cancel Image sharing initialization.
+        */        
+        void CancelInitializeShareImage();
+
+        /**
+        * Start Image sharing.
+        */
+        void StartShareImageL();
+
+        /**
+        * Stop Image sharing.
+        */
+        void StopShareImageL();
+
+        /**
+        * Report error.
+        */
+        void ShareError( TInt aError );
+
+        /**
+        * Returns share's stored media source.
+        */
+        TVtEngProviderType ShareStoredSource() const;
+
+        /**
+        * General settings changed.
+        */
+        void SettingsChanged();
+
+        /**
+        * Creates camera preferences extension
+        * @since S60 v3.2
+        * @return pointer to extension
+        * @exeption Leaves if creation fails
+        */
+        CVtEngCameraPreferences* CreateCameraPreferencesL();
+
+        /**
+        * Called when prepare camera has been handled in media handler.
+        */
+        void SetIsPrepareCameraCalled( TBool aCalled );
+
+        /**
+        * Returns ETrue if prepare camera has been handled in media handler,
+        * EFalse otherwise.
+        */
+        TBool IsPrepareCameraCalled() const;
+
+        /**
+        * Reinitializes camera if onboard camera is being used as a provider.
+        */
+        void HandleLayoutChangeL();
+
+        /**
+        * Returns ETrue if delayed select is pending.
+        */
+        TBool IsDelayedSelectPending() const;
+
+        /**
+        * Completes operation to mediahandler.
+        */
+        void CompleteOperation( const TInt aResult );
+
+        /**
+        * Called when video channel is opened.
+        */
+        void VideoChannelOpenedL();
+
+     private: // constructors
+
+        /**
+        * C++ constructor.
+        * @param aObserver callback interface to Media Handler
+        */
+        CVtEngLocalVideo(
+            CVtEngMediaHandler& aObserver );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+
+        /**
+        * Async callback method
+        */
+        static TInt CallBackFunc( TAny* aPtr );
+
+        /**
+        * Returns result.
+        */
+        TInt Result() const;
+
+        /**
+        * Sets result.
+        */
+        void SetResult( const TInt aResult );
+
+    private:  // Rendering configuration
+
+        /**
+        * Options for window server rendering.
+        *   iObserver callback interface
+        *   iSize VF image size
+        */
+        struct TOptions
+            {
+            MVtEngFrameObserver* iObserver;
+            TSize iSize;
+            };
+
+        /**
+        * Direct screen access options.
+        *   iWsSession windor server session
+        *   iWsSD screen device
+        *   iWindow handle to server based window
+        *   iRect iRect window size
+        *   iClipRect drawing size
+        */
+        struct TDsaOptions
+            {
+            RWsSession*      iWs;
+            CWsScreenDevice* iWsSD;
+            RWindowBase*     iWindow;
+            TRect            iRect;
+            TRect            iClipRect;
+            };
+
+        /**
+        * Internal state of a video provider.
+        */
+        enum TProviderState
+            {
+            /** initial state */
+            EUndefined = KErrNone,
+            /** never deleted */
+            EPermanent,
+            /** to be deleted when another provider selected */
+            EFading,
+            /** waiting for blank provider switch */
+            EWaiting,
+            /** changing still image */
+            ERefreshing
+            };
+
+        /**
+        * Provider information.
+        */
+        NONSHARABLE_CLASS( TProviderItem ) :
+            public MVtEngCameraPreferencesObserver
+            {
+            public:
+
+                /**
+                * C++ constructor
+                */
+                TProviderItem();
+
+                /**
+                * Destructor
+                */
+                ~TProviderItem();
+
+                /**
+                * Sets zoom factor to resetted state.
+                */
+                void ResetStoredValues();
+
+                /**
+                * Tries to restore preferences.
+                */
+                TInt RestoreZoomFactor();
+
+                /**
+                * Tries to restore preferences.
+                */
+                TInt RestorePreferences();
+
+            public:
+                // pointer to provider
+                CVSDataProvider*   iProvider;
+
+                // provider type
+                TVtEngProviderType iType;
+
+                // provider initialized
+                TBool              iInitialized;
+
+                // provider has errors
+                TInt               iErrorCode;
+
+                // state of a provider
+                TProviderState     iProviderState;
+
+                // Stored zoom value
+                TInt               iStoredZoomFactor;
+
+                // Error code setting zoom factor
+                TInt iZFErr;
+
+            public: // MVtEngCameraPreferencesObserver
+
+                /**
+                * @see MVtEngCameraPreferencesObserver::Attach
+                */
+                void Attach( MVtEngCameraPreferences& aCamPrefs );
+
+                /**
+                * @see MVtEngCameraPreferencesObserver::ColorToneUpdated
+                */
+                void ColorToneUpdated(
+                    MVtEngCameraPreferences::TColorTone aColorTone );
+
+                /**
+                * @see MVtEngCameraPreferencesObserver::WhiteBalanceUpdated
+                */
+                void WhiteBalanceUpdated(
+                    MVtEngCameraPreferences::TWhiteBalance aWhiteBalance );
+
+                /**
+                * @see MVtEngCameraPreferencesObserver::BrightnessUpdated
+                */
+                void BrightnessUpdated( TInt aBrightness );
+
+                /**
+                * @see MVtEngCameraPreferencesObserver::ContrastUpdated
+                */
+                void ContrastUpdated( TInt aContrast );
+
+                /**
+                * @see MVtEngCameraPreferencesObserver::Detach
+                */
+                void Detach( MVtEngCameraPreferences& aCamPrefs );
+
+            public:
+
+                /**
+                * Detach from preference and reset pointer.
+                */
+                void DetachFromCameraPreferences();
+
+            private:
+
+                // Pointer to camera preferences object this provider item is
+                // attached to
+                MVtEngCameraPreferences* iCamPrefs;
+
+                // Stored color tone value
+                MVtEngCameraPreferences::TColorTone iColorTone;
+
+                // Error code reading color tone value
+                TInt iCtErr;
+
+                // Stored white balance
+                MVtEngCameraPreferences::TWhiteBalance iWhiteBalance;
+
+                // Error code reading white balance value
+                TInt iWbErr;
+
+                // Stored brightness
+                TInt iBrightness;
+
+                // Error code reading brightness value
+                TInt iBrErr;
+
+                // Stored contrast
+                TInt iContrast;
+
+                // Error code reading contrast value
+                TInt iCrErr;
+
+                // ETrue if Attach is called first time
+                TBool iFirstTime;
+
+            };
+
+    /**
+    * Inner class for hiding image sharing details.
+    */
+    NONSHARABLE_CLASS( CVtEngShareImage ) : public CBase
+        {
+        private: // enumerations
+
+            /**
+            * Media object sharing internal state.
+            */
+            enum TState
+                {
+                EStopped,
+                EInitializing,
+                ESharing
+                };
+
+        public: // New public methods
+
+            /**
+            * Constructor.
+            */
+            static CVtEngShareImage* NewL( CVtEngLocalVideo& aLocalVideo );
+
+            /**
+            * C++ destructor.
+            */
+            ~CVtEngShareImage();
+
+            /**
+            * Start initialization of image sharing.
+            * @param aParameters Image sharing parameters (from UI)
+            * @param aCurrent Currently active provider's type.
+            * @param aFirstTime After call ETrue if this call was first to
+            * share initialize, EFalse otherwise.
+            * @exception May leave with KErrNotReady already initializing. May
+            * also leave with system wide error code if something goes wrong
+            * during provider initialization.
+            */
+            void InitializeL(
+                const MVtEngMedia::TShareObjectImageParameters& aParameters,
+                TVtEngProviderType aCurrent,
+                TBool& aFirstTime );
+
+            /**
+            * Cancel sharing initialized image.
+            */            
+            void CancelInitialize();
+
+            /**
+            * Start sharing initialized image.
+            * @exception May leave with KErrNotReady if not initialized. May
+            * also leave with system wide error code if something goes wrong
+            * during provider swap.
+            */
+            void ShareL();
+
+            /**
+            * Stop sharing image.
+            * @exception May leave with KErrNotReady if not sharing. May also
+            * leave with system wide error code if something goes wrong during
+            * provider swap.
+            */
+            void StopL();
+
+            /**
+            * An error happened during initialization, sharing or stopping.
+            * @param aError Error reason.
+            */
+            void Error( TInt aError );
+
+            /**
+            * Returns stored source from sharer.
+            * @return Stored source (source that was selected before share).
+            */
+            TVtEngProviderType StoredSource() const;
+
+            /**
+            * Get sharing state.
+            * @param aObjectSharingState On return contains current object
+            * sharing state.
+            */
+            void GetObjectSharingState(
+                MVtEngMedia::TShareObjectState& aObjectSharingState ) const;
+
+            /**
+            * Check whether share is being initialized or not.
+            * @return ETrue if share is being initialized EFalse otherwise.
+            */
+            TBool IsInitializingShare() const;
+
+            /**
+            * Called when General settings have been changed.
+            */
+            void SettingsChanged();
+
+            /**
+            * Called when vsProviderSwitchDone() is called to local video.
+            */
+            void ProviderSwitchDone( CVSDataProvider* aOldProvider );
+
+            /**
+            * Called when camera change event is received from PS.
+            */
+            void NotifyCameraChanged( const TVtEngProviderType& aProviderType );
+
+        private: // New private methods
+
+            /**
+            * C++ constructor.
+            */
+            CVtEngShareImage( CVtEngLocalVideo& aLocalVideo );
+
+            /**
+            * 2nd constructor, may leave.
+            */
+            void ConstructL();
+
+            /**
+            * Get image sharing parameters.
+            * @return Constant reference to image sharing parameters.
+            */
+            const MVtEngMedia::TShareObjectImageParameters& Parameters() const;
+
+            /**
+            * Get initialization state.
+            * @return ETrue if sharing is being initialized, EFalse otherwise.
+            */
+            TBool IsInitializing() const;
+
+            /**
+            * Set sharing state.
+            * @param aNewState New image sharing state.
+            */
+            void SetState( const TState aNewState );
+
+            /**
+            * Fetches next available provider item pointer.
+            * @return Pointer to next available provider item or NULL if none
+            * could be found.
+            */
+            TProviderItem* FetchProviderItem() const;
+
+            /**
+            * Creates provider.
+            */
+            void CreateProviderL( TProviderItem& aProviderItem );
+
+            /**
+            * Initializes provider.
+            */
+            void InitializeProviderL( TProviderItem& aProviderItem );
+
+            /**
+            * Deletes provider.
+            */
+            void DeleteProvider( TVtEngProviderType aProviderType );
+
+            /**
+            * Deletes all precreated providers.
+            */
+            void DeleteProviders();
+
+        private: // Data
+
+            // Pointer to local video instance
+            CVtEngLocalVideo* iLocalVideo;
+
+            // Current state
+            TState iState;
+
+            // Previous state
+            TState iPreviousState;
+
+            // Copy of image sharing parameters
+            MVtEngMedia::TShareObjectImageParameters iParameters;
+
+            // Type of provider that was active before image sharing
+            TVtEngProviderType iStoredType;
+
+            // Type of provider that was originally active before image sharing
+            // This is needed because iStoredType may change according to PS
+            // events.
+            TVtEngProviderType iOriginalStoredType;
+
+            // Currently active provider
+            TProviderItem* iActiveProvider;
+
+            // Currently initialized provider
+            TProviderItem* iInitializingProvider;
+
+            // Buffered items
+            RPointerArray< TProviderItem > iBuffered;
+
+            // General settings were changed while sharing
+            TBool iSettingsChanged;
+        };
+
+    /**
+    * Inner class for handling delayed provider switches (e.g. PS signalled
+    * camera changes)
+    */
+    NONSHARABLE_CLASS( TVtEngDelayedSelect )
+        {
+    public:
+
+        /**
+        * Constructor
+        */
+        TVtEngDelayedSelect();
+
+       /**
+        * Called when camera change event is received from PS.
+        */
+        void NotifyDelayedSelect( const TVtEngProviderType& aProviderType );
+
+        /**
+        * Returns ETrue if delayed select is pending, EFalse otherwise.
+        */
+        TBool IsDelayedSelectPending() const;
+
+        /**
+        * Returns delayed select target and resets stored value.
+        */
+        TVtEngProviderType DelayedSelectTarget();
+
+    private: // data
+
+        TVtEngProviderType iDelayedProviderType;
+        };
+
+    /**
+    * Inner class for handling layout change reinitialization.
+    */
+    NONSHARABLE_CLASS( TVtEngLayoutChangeHandler )
+        {
+
+    public:
+
+        /**
+        * Constructor
+        */
+        TVtEngLayoutChangeHandler( CVtEngLocalVideo& aLocalVideo );
+
+        /**
+        * Called when layout change has happened
+        */
+        void HandleLayoutChangeL();
+
+        /**
+        * Called when layout change needs to be cancelled
+        */
+        void CancelHandleLayoutChange();
+
+        /**
+        * Called when provider is unfrozen.
+        * @return ETrue if unfreeze was handled by the layout change handler,
+        * EFalse otherwise.
+        */
+        TBool UnfreezeL();
+
+        /**
+        * Called by the local video when provider error happens.
+        * @param aError Type of error
+        * @return ETrue If error was handled by the layout change handler
+        */
+        TBool ProviderError( TInt aError );
+
+        /**
+        * Called by the local video when provider is ready after initialization.
+        * @return ETrue If callback was handled by the layout change handler.
+        */
+        TBool ProviderReady();
+
+        /**
+        * Called by the local video when provider has been switched.
+        * @param CVSDataProvider Pointer of old provider instance.
+        * @return ETrue If callback was handled by the layout change handler.
+        */
+        TBool ProviderSwitchDone( CVSDataProvider* aOldProvider );
+
+    private:
+
+        /**
+        * 2nd constructor
+        */
+        void ConstructL();
+
+        /**
+        * Does the layout change handling.
+        */
+        void DoHandleLayoutChangeL();
+
+        /**
+        * Call to CompleteL() that is trapped.
+        */
+        TInt Complete( const TInt aError );
+
+        /**
+        * Completes handling and resets state to EIdle.
+        */
+        void CompleteL( const TInt aError );
+
+        /**
+        * Completes asynchronous request.
+        */
+        void CompleteOperation( const TInt aError );
+
+    private: // data
+
+        // Pointer to local video instance
+        CVtEngLocalVideo* iLocalVideo;
+
+        /**
+        * Layout change handler internal state.
+        */
+        enum TState
+            {
+            /** Layout change handler is ready to be called */
+            EIdle,
+            /** Layout change handler has been called, but layout update is
+                pending */
+            ELayoutChangePending,
+            /** Layout change handler is switching blank provider */
+            ESwitchingBlank,
+            /** Layout change handler is initializing camera provider */
+            EInitializingCamera,
+            /** Layout change handler is switching camera provider */
+            ESwitchingCamera
+            };
+
+        // Handler's internal state
+        TState iState;
+
+        // Stored provider type
+        TVtEngProviderType iStored;
+
+        };
+
+        private:
+
+        /**
+        * Rendering method.
+        */
+        enum TRenderingMethod
+            {
+            // Unspecified
+            EUnspecified,
+            // Through window server
+            EWindowServer,
+            // Direct screen access
+            EDSA,
+            // Display posting
+            EDP
+            };
+
+        /**
+        * View finder state.
+        */
+        enum TViewFinderState
+            {
+            // View finder not active.
+            EVFNone,
+            // View finder started to reveive bitmaps.
+            EVFReceivingBitmaps,
+            // View finder started to render with DSA.
+            EVFRenderingDsa
+            };
+
+        /**
+        * Internal state.
+        */
+        enum TState
+            {
+            // Initial and state when error occurred.
+            ELocNone,
+            // Provider initialization ongoing.
+            ELocInitializing,
+            // Switch to another provider ongoing.
+            ELocSwichingProvider,
+            // Provider initialization or switch completed.
+            ELocReady
+            };
+
+    public:
+
+        /**
+        * Deletes provider.
+        * @param aItem provider to delete
+        */
+        void DeleteProvider( TProviderItem& aItem );
+
+        /**
+        * Deletes provider.
+        * @param aType type of provider to delete.
+        */
+        void DeleteProvider( TVtEngProviderType aType );
+
+        /**
+        * Resets local video after a video call.
+        */
+        void Reset();
+
+    private:  // New functions
+
+        /**
+        * Sets current camera id.
+        */
+        void SetCurrentCameraId( MVtEngMedia::TCameraId aCamId );
+
+    	/**
+    	 * Configures provider item for outwards camera in
+    	 * construction phase.
+    	 */
+    	void ConfigureOutwardsCameraItem(
+    		TProviderItem& aItem,
+    		const TInt aCurrentIndex );
+
+        /**
+        * Calculater digital zoom steps.
+        * @param aProvider the used provider in counting
+        * @return amount of major zoom steps
+        */
+        TInt CalculateMajorDigitalZoomStepCount(
+            CVSDataProvider* aProvider );
+
+        /**
+        * Calculater digital zoom steps.
+        * @param aInfo provider info structure from which zoom steps will be
+        * calculated
+        * @return amount of major zoom steps
+        */
+        TInt CalculateMajorDigitalZoomStepCount(
+            const TVSDataProviderInfo& aInfo ) const;
+
+        /**
+        * Deletes audio source.
+        */
+        void DeleteAudioSource();
+
+        /**
+        * Gets a provider for a given type.
+        * @param aType type to search for
+        * @param aItem returned provider item
+        * @return index in provider array or KErrNotFound
+        */
+        TInt GetProviderByType(
+            TVtEngProviderType aType, TProviderItem& aItem );
+
+        /**
+        * Gets a provider for a given type.
+        * @param aType type to search for
+        * @param aItem returned provider item
+        * @return index in provider array or KErrNotFound
+        */
+        TInt GetProviderByType(
+            TVtEngProviderType aType, TProviderItem*& aItem );
+
+        /**
+        * Gets a provider for a given provider instance.
+        * @param aInstance Instance to search for
+        * @param aItem returned provider item
+        * @return index in provider array or KErrNotFound
+        */
+        TInt GetProviderByInstance(
+            const CVSDataProvider* aInstance,
+            TProviderItem*& aItem ) const;
+
+        /**
+        * Initializes provider.
+        * @param aProviderItem provider
+        */
+        void InitializeProviderL( TProviderItem& aProviderItem );
+
+        /**
+        * Initializes provider for sharing.
+        */
+        void InitializeShareProviderL( TProviderItem& aProviderItem,
+            const TDesC8& aParams );
+
+        /**
+        * Re-creates provider. First deletes old instance inside provider
+        * item structure and then creates a new instance, using given
+        * provider type.
+        * @param aProviderItem Provider to be recreated.
+        * @param aType Type of the new provider to be created.
+        */
+        void ReCreateProviderL(
+            TProviderItem& aProviderItem, const TVtEngProviderType aType );
+
+        /**
+        * Provider index by provider type.
+        * @param aType Type of provider
+        */
+        TInt ProviderIndex( TVtEngProviderType aType ) const;
+
+        /**
+        * Gets a provider index by state.
+        * @param aState state of returned provider
+        * @return Index of provider
+        */
+        TInt ProviderIndexByState( TProviderState aState ) const;
+
+        /**
+        * Gets a provider index by provider instance.
+        * @param aInstance instance of provider to be found
+        * @return Index of provider or KErrNotFound if given provider item
+        * is not found
+        */
+        TInt ProviderIndexByInstance( const CVSDataProvider* aInstance ) const;
+
+        /**
+        * Creates VideoSource provider by type.
+        * @param aType Engine provider type
+        * @return CVSDataProvider pointer
+        */
+        CVSDataProvider* CreateDataProviderL( TVtEngProviderType aType );
+
+        /**
+        * Maps camera orientation to provider type.
+        * @param aOrientation camera orientation
+        * @return provider type
+        */
+        static TVtEngProviderType
+            OrientationToType( TCameraInfo::TCameraOrientation aOrientation );
+
+        /**
+        * Maps camera ID to provider type.
+        * @param aId camera ID
+        * @return provider type
+        */
+        static TVtEngProviderType CameraIdToType( MVtEngMedia::TCameraId aId );
+
+        /**
+        * Creates blank still image provider.
+        * @param aIndex index of still image provider
+        */
+        void CreateBlankProviderL( const TInt aIndex );
+
+        /**
+        * Creates default still image provider.
+        * @param aIndex index of default still image provider
+        */
+        void CreateDefaultStillImageProviderL( const TInt aIndex );
+
+        /**
+        * Updates available camera providers.
+        * @return primary provider
+        */
+        TVtEngProviderType UpdateAvailableProvidersL();
+
+        /**
+        * Switches to active provider.
+        */
+        void SwitchProvider( TProviderItem* aProviderItem );
+
+        /**
+        * Overloaded SwitchProvider() that takes new provider as a parameter.
+        */
+        void SwitchProvider( TProviderItem& aProviderItem );
+
+        /**
+        * Uninitializes non-permanent provider.
+        */
+        void UninitializeProviderL();
+
+        /**
+        * Updates iState if view finder is active.
+        */
+        void UpdateState();
+
+        /**
+        * Checks if initialization or provider switch is pending.
+        * @return ETrue if either one is pending
+        */
+        TBool InitializingOrSwitching() const;
+
+        /**
+        * Resets provider info index variables.
+        */
+        void ResetIndices();
+
+        /**
+        * Sets active camera tracking.
+        * @param aProviderIndex current camera in use
+        * @return error code
+        */
+        TInt SetCameraTrackingL( TInt& aProviderIndex );
+
+        /**
+        * Maps pubsub provided camera id to internal indexes.
+        * @param aCameraId id to map
+        * @return internally mapped id
+        */
+        MVtEngMedia::TCameraId MapCameraInternally( TInt aCameraId );
+
+        /**
+        * Checks if desired camera is available.
+        * @param aType provider type to return
+        */
+        void CameraAvailable( CVtEngLocalVideo::TVtEngProviderType &aType );
+
+        /**
+        * checks if given provider type is already waiting for initialization
+        * or switch.
+        * @param aType Provider type.
+        * @return ETrue if given provider type is in waiting state, EFalse
+        * otherwise.
+        */
+        TBool IsProviderWaiting( TVtEngProviderType aType ) const;
+
+        /**
+        * Returns highest provider type which is available for selection.
+        * Priority is following:
+        *    KVtEngProviderCam1         << highest
+        *    KVtEngProviderCam2
+        *    KVtEngProviderImage
+        *    KVtEngProviderNone
+        * If eg. cam2 is designated as preferred, possible returns values are
+        * Cam2, Image and None.
+        *
+        * @param aType in/out argument. In  => preferred provider which
+        *        caller of the method wishes to select
+        *                               Out => highest available provider
+        * @return ETrue if preferred == highest i.e. aPreferred is intact
+        *
+        */
+        TBool GetHighestSelectableProvider( TVtEngProviderType& aPreferred ) const;
+
+        /**
+        * checks if given provider type is acitven
+        * @param aType Provider type.
+        * @return ETrue if given provider is already active, EFalse
+        * otherwise.
+        */
+        TBool IsActiveProvider( TVtEngProviderType aType ) const;
+
+
+    private: // From CActive.
+
+        /**
+        * Handles sync operations as async.
+        * @see CActive::RunL
+        */
+        virtual void RunL();
+
+        /**
+        * @see CActive::DoCancel()
+        */
+        virtual void DoCancel();
+
+    private:
+
+        // Local video flags
+        enum TVtEngLocalVideoFlags
+            {
+            // Camera 1 is available (inwards)
+            EFlagCamera1Available = 0x00000001,
+            // Camera 2 is available (outwards)
+            EFlagCamera2Available = 0x00000002,
+            // video call ongoing
+            EFlagInitialized      = 0x00000004,
+            // view finder enabled from UI
+            EFlagVFEnabled        = 0x00000008,
+            // Non-user orginated switch
+            EFlagAutomaticSwitchCallback = 0x00000010,
+            // Audio muted
+            EFlagAudioMuted       = 0x00000020,
+            // Only initialize a provider (no switch when initialized)
+            EFlagInitializeOnly   = 0x00000040,
+            // Signal observer when switch is complete
+            EFlagSignalSourceSelection = 0x00000080,
+            // Provider event received while switch ongoing.
+            // When this is set and switch completes it
+            // is checked if revert to previous is needed.
+            EFlagCheckRevertToPrevious = 0x00000100,
+            // Avoid calculating the step count by using flag.
+            EFlagZoomStepCountNeedsMapping = 0x00000200,
+            // VT application foreground state
+            EFlagUIForeground           = 0x00000400,
+            // VT application background state ( notification purpose)
+            EFlagUIBackground           = 0x00000800,
+            // Provider is frozen
+            EFlagFrozen                 = 0x00001000
+            };
+
+        /**
+        * Sets a flag on.
+        * @param aFlag flag to set
+        */
+        void SetFlag( const TInt aFlag );
+
+        /**
+        * Removes a flag.
+        * @param aFlag flag to remove
+        */
+        void ClearFlag( const TInt aFlag );
+
+        /**
+        * Checks if a flag has been set.
+        * @param aFlag flag to check
+        * @return ETsrue if set
+        */
+        TBool IsFlag( const TInt aFlag ) const;
+
+    private:    // Data
+
+        // Options for window server rendering.
+        TOptions                iOptions;
+
+        // Options for DSA rendering.
+        TDsaOptions             iDsaOptions;
+
+        // Video source controller.
+        CVSController*          iSourceController;
+
+        // Video source.
+        CVSDataSource*          iSource;
+
+        // Audio source.
+        MVTAudioSource*          iAudioSource;
+
+        // Video providers (cameras and still image).
+        CArrayFixFlat<TProviderItem>* iVideoProviders;
+
+        // Currently active provider.
+        TProviderItem*          iActiveProvider;
+
+        // Provider item we're switching away from.
+        TProviderItem*          iFadingProvider;
+
+        // Provider that is selected as next one and
+        // is initializing or switching.
+        TProviderItem*          iSelectedProvider;
+
+        // DSA or window server.
+        TRenderingMethod        iRenderingMethod;
+
+        // Local video status.
+        TState                  iState;
+
+        // View finder state.
+        TViewFinderState        iViewFinderState;
+
+        // Callback interface to Media Handler.
+        CVtEngMediaHandler&     iObserver;
+
+        // Still image file name.
+        TFileName               iStillImage;
+
+        // Local video state flags.
+        TInt                    iFlags;
+
+        // Friend declaration provides extended access.
+        friend class TProviderItem;
+
+        // Member variables to use in referencing to
+        // provider information
+        TInt iProviderInfoIndexCam1;
+        TInt iProviderInfoIndexCam2;
+        TInt iProviderInfoIndexStill;
+
+        // Used for default camera notifications.
+        CVtEngPubSubsListener* iCameraListener;
+
+        // Camera received from pubsub.
+        MVtEngMedia::TCameraId iCurrentCamera;
+
+        // Contains logics for image sharing.
+        CVtEngShareImage* iShareImage;
+
+        // Pointer to camera preferences extension
+        CVtEngCameraPreferences* iCameraPref;
+
+        // Logics for delayed provider selection
+        TVtEngDelayedSelect iDelayedSelect;
+
+        // Active provider's info
+        TVSDataProviderInfo iProviderInfo;
+
+        // ETrue if prepare camera has been handled in media handler
+        TBool iPrepareCameraCalled;
+
+        // Layout change handler
+        TVtEngLayoutChangeHandler iLayoutChangeHandler;
+
+        // ASync callback
+        CAsyncCallBack* iAsyncCallBack;
+
+        // Result
+        TInt iResult;
+
+        // Pointer to provider item that is being initialized
+        TProviderItem* iInitializingProvider;
+
+        // Number of cameras in the device
+        TInt iNumSupportedCameras;
+    };
+
+#endif      // CVTENGLOCALVIDEO_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngMediaHandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1299 @@
+/*
+* Copyright (c) 2004-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:  Video session interface.
+*
+*/
+
+
+
+#ifndef CVTENGMEDIAHANDLER_H
+#define CVTENGMEDIAHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <mvtprotocolhandler.h>
+#include "MVtEngMedia.h"
+#include "vtengcommands.h"
+#include "CVtEngLocalVideo.h"
+#include "MVtEngSettingObserver.h"
+
+// FORWARD DECLARATIONS
+class CVtEngLocalVideo;
+class CVtEngRemoteVideo;
+class MVtEngFrameObserver;
+class CVtEngOperation;
+class CVtEngExtensionBase;
+
+// CLASS DECLARATION
+
+/**
+*  Media control.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngMediaHandler ) :
+    public CBase,
+    public MVtEngMedia,
+    public MVtEngSettingObserver,
+    public MVtProtocolHandler
+    {
+    public: // Constructor and destructor.
+
+        /**
+        * Symbian two-phase constructor.
+        * @return media handler instance
+        */
+        static CVtEngMediaHandler* NewL();
+
+        /**
+        * Destructor.
+        */
+        ~CVtEngMediaHandler();
+
+    public: // From MVtEngMedia.
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetMediaState(
+            const TMediaDirection aMediaDirection,
+            TInt& aActiveMedia ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TBool RenderingStarted(
+            const TMediaDirection
+            aDirection ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetSource( TMediaSource& aSource ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetSourcesCaps( TInt& aCaps ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetCurrentCameraId( TCameraId& aId ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetCameraInfo(
+            const TCameraId aId,
+            TCameraInfo& aInfo ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetCurrentZoomStep( TInt& aCurrentStep );
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetMaxZoomStep( TInt& aMaxZoomStep );
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetMajorZoomStepCount( TInt& aCount );
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual void GetMajorZoomStep( TInt aIndex, TInt& aStep );
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetFreezeSupported( TBool& aFreezeSupported ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetFreezeState( TBool& aFrozen ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TInt GetDsaState(
+            const TMediaDirection aMediaDirection,
+            TBool& aActive ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual TBool VideoCallConnected () const;
+        
+        /**
+        * @see MVtEngMedia
+        */
+        virtual void GetVideoQuality( TVideoQuality& aVideoQuality ) const;
+
+        /**
+        * @see MVtEngMedia
+        */
+        virtual void GetObjectSharingState(
+            TShareObjectState& aObjectSharingState ) const;
+
+        /**
+        * @ see MVtEngMedia
+        */
+        virtual void GetCameraOrientations(
+            TCameraOrientation& aPrimaryCameraOrientation,
+            TCameraOrientation& aSecondaryCameraOrientation ) const;
+
+public: // New functions.
+
+        /**
+        * Tells if the Protocol initialization has completed.
+        * @return ETrue if initialized
+        */
+        TBool ProtoInitialized() const;
+
+        /**
+        * Performs an operation in the handler.
+        * @param operation to be performed on the handler
+        */
+        virtual void HandleL( CVtEngOperation& aOperation );
+
+        /**
+        * Returns if command can be performed by media handler.
+        * @return KErrNone if a command can be perfomed
+        *         KErrNotReady if not in appropriate state
+        *         KErrNotSupported if command is not for media handler
+        */
+        TInt ValidateCommand( const TVtEngCommandId aCommand ) const;
+
+        /**
+        * Returns ETrue if video channel is closed.
+        */
+        TBool IsVideoChannelClosed() const;
+        
+        /**
+         * Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+         */
+        void RequestLastRemoteFrame();        
+
+    public: // from MVtProtocolHandler
+
+        /**
+        * Handles callback from protocol.
+        * @param aResponse response
+        */
+        virtual void HandleSessionCommandEventL(const TVtCommandResponse& aResponse);
+
+    public: // From MVtProtocolHandler.
+
+        /**
+        * Handles callback from protocol audiocontroller.
+        * @param aId which command
+        * @param aCmd which audio command
+        * @param aContextData any additional data
+        * @param aStatus how did it end up with
+        */
+        virtual void HandleAudioOutputControlCommandComplete(TInt aId,
+            TVtAudioOutputControlCommand aCmd,
+            TAny *aContextData,
+            TInt aStatus);
+
+    public: // From MVtProtocolHandler.
+
+        /**
+        * Handles event from protocol.
+        * @param aEvent event
+        */
+        virtual void HandleSessionInformationalEventL(
+            const TVtIndicationEvent& aEvent);
+
+    public: // from MVtProtocolHandler
+
+        /**
+        * Handles error event from protocol.
+        * @param aEvent error event
+        */
+        virtual void HandleSessionErrorEventL(const TVtErrorEvent& aEvent);
+
+    public: // from MVtEngSettingObserver
+
+        /**
+        * Handles shared data setting change.
+        * @param aId setting id
+        * @param aValue setting value
+        */
+        virtual void HandleSettingChangedL(
+            CVtEngSettings::TSettingId aId,
+            const TDesC& aValue );
+
+    public: // From MVtProtocolHandler.
+
+        /**
+        * @see MVtProtocolHandler.
+        */
+        void HandleVideoEncoderCommandCompletedL(
+            const TVtCommandResponse& aResponse );
+
+        /**
+        * @see MVtProtocolHandler.
+        */
+        void HandleVideoEncoderInformationalEventL(
+            const TVtIndicationEvent& aEvent);
+
+    public: // From MVtProtocolHandler
+
+        /**
+        * @see MVtProtocolHandler.
+        * @since 3.1
+        */
+        void HandleH324MConfigCommandCompletedL( const TVtCommandResponse& aResponse );
+
+        /**
+        * @see MVtProtocolHandler.
+        * @since 3.1
+        */
+        void HandleH324MConfigInformationalEventL(
+            const TVtIndicationEvent& aEvent );
+
+    public: // New functions.
+
+        /**
+        * Initializes media handler.
+        * @param aStatus signaling handle
+        */
+        void InitializeL( TRequestStatus& aStatus );
+
+        /**
+        * Cancels media handler initialization.
+        */
+        void CancelInitialize();
+
+        /**
+        * Initializes default blank provider.
+        * @param aStatus signaling handle
+        */
+        void InitializeProviderL( TRequestStatus& aStatus );
+
+        /**
+        * Cancel Image sharing initialization.         
+        */        
+        void CancelInitializeShareImage();
+        
+        /**
+        * Sets protocol interface.
+        * aProto2Way protocol interface
+        */
+        void SetSessionCommand( MVtSessionCommand* aProto2Way );
+
+        /**
+        * Unitializes media handler.
+        * @param aStatus request semaphore to complete
+        * when uninitialization is complete
+        */
+        void Uninitialize( TRequestStatus& aStatus );
+
+        /**
+        * Goes to next step of uninitialization process, it can
+        * be one of following
+        * - Cancel all Protocol commands
+        * - Protocol disconnect
+        * - Protocol reset
+        * - Switch blank provider.
+        */
+        void UninitializeNextStep();
+
+        /**
+        * Sets selected camera ID.
+        * @param aId camera ID (primary or secondary)
+        * @param aUpdateRequired if ETrue switch could not be performed
+        *        Switch will be done when engine has been initialized.
+        */
+        void SetSelectedCameraId(
+            const TCameraId aId,
+            TBool aUpdateRequired = EFalse );
+
+        /**
+        * Handles source initialization or switch.
+        * @param aResult Symbian OS error code
+        */
+        void HandleLocalVideoOperationCompleteL( const TInt aResult );
+
+        /**
+        * SDK init info.
+        * @return Protocol initialization info
+        */
+        TVtInitInfo& SdkInitInfo();
+
+        /**
+        * Returns protocol state maintained by VTEngine, not by Protocol.
+        * @return state
+        */
+        MVtProtocolCommand::TVtProtocolState ProtoState();
+
+        /**
+        * Sets up video connection to remote terminal.
+        * @return Symbian OS error code
+        */
+        TInt Connect();
+
+        /**
+        * Disconnects session.
+        * @return Symbian OS error code
+        */
+        TInt Disconnect();
+
+        /**
+        * Adds video data source to protocol engine.
+		* @param Video channel logical channel ID number.
+        * @return Symbian OS error code
+        */
+        TInt AddVideoSource( TUint aChannelId );
+
+        /**
+        * Adds audio data source to protocol engine.
+		* @param Audio channel logical channel ID number.
+        * @return Symbian OS error code
+        */
+        TInt AddAudioSource( TUint aChannelId );
+
+        /**
+        * Adds video sink.
+		* @param Video channel logical channel ID number.
+        * @return Symbian OS error code
+        */
+        TInt AddVideoSink( TUint aChannelId );
+
+        /**
+        * Adds audio sink.
+		* @param Audio channel logical channel ID number.
+        * @return Symbian OS error code
+        */
+        TInt AddAudioSink( TUint aChannelId );
+
+        /**
+        * Sets the output volume for Protocol.
+        * @param aVolume the level of the volume
+        * @return Symbian OS error code
+        */
+        TInt SetVolume( const TInt aVolume,
+            CVtEngOperation* aOperation = NULL );
+
+        /**
+        * Enables video when primary camera becomes available.
+        * @param aEnable do we enable or disable
+        * @return Symbian OS error code
+        */
+        TInt AutoEnableVideo( TBool aEnable = ETrue );
+
+        /**
+        * Deletes protocol instance and associated Protocol interfaces.
+        */
+        void FinalizeUninitialization();
+
+        /**
+        * Creates extension according to API Uid.
+        * @since S60 v3.2
+        * @param aUid extension API Uid.
+        * @return Extension pointer
+        * @exeption Leaves if creation fails
+        *
+        */
+        CVtEngExtensionBase* CreateExtensionsL( const TUid& aUid );
+        
+        /**
+        * Checks if there is already an operation pending.
+        * @return KVtEngCommandNone if no operation is pending or Command identifier
+        */
+        TVtEngCommandId GetPendingCommand();
+
+    private: // new functions
+
+        /**
+        * Sends a sync message to Protocol after provider switch.
+        */
+        void RequestFrame( );
+
+        /**
+        * Sets video quality
+        */
+        void SetVideoQualityL(
+            const TVideoQuality aVideoQuality,
+            const TBool aSetPeerVideoQuality );
+
+        /**
+        * Sets peer video quality
+        */
+        void SetPeerVideoQuality( const TVideoQuality aVideoQuality );
+
+        /**
+        * Check's flag's validity. If not valid, panic's in debug mode.
+        * @param aFlag flag to check.
+        */
+        void AssertFlag( const TInt aFlag ) const;
+
+        /**
+        * Gets the version information from SysUtil
+        * and sets it into Protocol.
+        */
+        void SetVersionInfoL();
+
+        /**
+        * Sets supported resolutions to Protocol.
+        */
+        void SetSupportedResolutions();
+
+		/**
+        * Sets used call setup enhancement parameters.
+        */
+		void SetFastCsupOptions();
+
+        /**
+        * Does Protocol reset.
+        */
+        void ResetProtoL();
+
+        /**
+        * Does the actual disconnecting with Protocol.
+        */
+        void DisconnectProtoL();
+
+        /**
+        * Sets the defaults for volumes.
+        */
+        void InitializeVolume();
+
+        /**
+        * Checks if a flag in iProtoInitFlags is set.
+        * @return ETrue if flag is set
+        */
+        TBool IsFlag( const TInt aFlag ) const;
+
+        /**
+        * Sets a flag in iProtoInitFlags.
+        * @param aFlag flag to set
+        */
+        inline void SetFlag( const TInt aFlag );
+
+        /**
+        * Clears a flag in iProtoInitFlags.
+        * @param aFlag flag to clear
+        */
+        inline void ClearFlag( const TInt aFlag );
+
+        /**
+        * Requests the volume controller.
+        * @return ETrue if retrieved ok
+        */
+        TBool RequestAudioControllerL();
+
+        /**
+        * Spatial trade off indication handling method. Indication is
+        * sent by the peer every time when its spatial trade off is updated.
+        * @param aLogicalChannelId Indication's logical channel Id.
+        * @param aTradeOff Indication trade off value.
+        */
+        void HandleSpatialTradeoffIndication(
+            const TUint16 aLogicalChannelId, const TUint8 aTradeOff );
+
+        /**
+        * Spatial trade off command handling method. Spatial trade off
+        * command is sent by the peer whenever peer wants to adjust our
+        * video quality.
+        * @param aLogicalChannelId Command's logical channel Id.
+        * @param aTradeOff New trade off value.
+        */
+        void HandleSpatialTradeoffCommandL(
+            const TUint16 aLogicalChannelId, const TUint8 aTradeOff );
+
+    private: // constructor and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CVtEngMediaHandler();
+
+        /**
+        * Symbian constructor that may leave.
+        */
+        void ConstructL();
+
+    private:
+        /**
+        * Operation values
+        */
+        enum TOperation
+            {
+            /**
+            * No-op.
+            * 0
+            */
+            ENone,
+
+            /**
+            * Add video source to protocol.
+            * 1
+            */
+            EAddVideoSource,
+
+            /**
+            * Add video source to protocol.
+            * 2
+            */
+            EAddVideoSink,
+
+            /**
+            * Add audio source to protocol.
+            * 3
+            */
+            EAddAudioSource,
+
+            /**
+            * Add audio source to protocol.
+            * 4
+            */
+            EAddAudioSink,
+
+            /**
+            * Connect protocol.
+            * 5
+            */
+            EConnectProto,
+
+            /**
+            * Mute audio.
+            * 6
+            */
+            EMuteAudio,
+
+            /**
+            * Resume audio sending.
+            * 7
+            */
+            EUnmuteAudio,
+
+            /**
+            * Enable video for peer.
+            * 8
+            */
+            EEnableVideo,
+
+            /**
+            * Disable video for peer.
+            * 9
+            */
+            EDisableVideo,
+
+            /**
+            * Cancel ongoing request to Protocol
+            * as part of uninitiazation process.
+            * 10
+            */
+            EUninitializeCancelAllProto,
+
+            /**
+            * Disconnect protocol.
+            * 11
+            */
+            EDisconnectProto,
+
+            /**
+            * Destructs local/remote video and VS instances.
+            * 12
+            */
+            EDestructInternals,
+
+            /**
+            * Terminates H.324 session.
+            * 13
+            */
+            ETerminateSession,
+
+            /**
+            * Removing sinks and sources.
+            * 14
+            */
+            ERemovingSinksAndSources,
+
+            /**
+            * Request 324 control interface from protocol.
+            * 15
+            */
+            EGet324CtrlInterface,
+
+            /**
+            * Set volume.
+            * 16
+            */
+            ESetAudioVolume,
+
+            /**
+            * Gets the maximum volume for Protocol.
+            * 17
+            */
+            EGetAudioGetMaxVolume,
+
+            /**
+            * Reset protocol.
+            * 18
+            */
+            EDestructProtoPhaseDisconnect,
+
+            /**
+            * Destruct switch blank.
+            * 19
+            */
+            EDestructSwitchBlank,
+
+            /**
+            * Reset protocol.
+            * 20
+            */
+            EDestructProtoPhaseReset,
+
+            /**
+            * Check Protocol state.
+            * 21
+            */
+            ECheckProtoState,
+
+            /**
+            * Enables video internally (not originated by UI).
+            * 22
+            */
+            EEnableVideoInternal,
+
+            /**
+            * Disables video internally (not originated by UI).
+            * 23
+            */
+            EDisableVideoInternal,
+
+            /**
+            * Request H263Enc interface from protocol.
+            * 24
+            */
+            EGetH263EncInterface,
+
+            /**
+            * Requests an intra frame.
+            * 25
+            */
+            ESendIntraframe,
+
+            /**
+            * Set supported resolutions.
+            * 26
+            */
+            ESetSupportedResolutions,
+
+            /**
+            * Set video quality (by changing framerate)
+            * 27
+            */
+            ESetVideoQuality,
+
+			/**
+            * Remove H324 interface
+            * 28
+            */
+			ERemove324CtrlInterface,
+
+			/**
+            * Remove video encoder interface
+            * 29
+            */
+			ERemoveH263EncInterface,
+
+			/**
+            * Sends Video Temporal-spatial trade off command
+            * 30
+            */
+			ESendVTSTO,
+
+			/**
+            * Sets fast call setup options
+            * 31
+            */
+			ESetFastCsupOptions,
+
+            /**
+            * Sets vendor id
+            * 32
+            */
+			ESetVendorId,
+
+            /**
+            * Set interval when I-frames are sent
+            * 33
+            */
+			ESetIFrameInterval
+            };
+
+        /**
+        * Operation and related command id.
+        */
+        struct TCmdOpPair
+            {
+            // Operation
+            TOperation   iOp;
+            // Command id returned by proto2way asynch request
+            TInt iProtoCmdId;
+            };
+
+        /**
+        * Enables/Disables video sending.
+        * @param aEnable ETrue if video is to be enabled
+        * @param aOp operation to be added
+        * NOTE. Valid only for enabling video, not when disabled.
+        * @see void AutoEnableVideo
+        * @return started operation or ENone
+        */
+        TOperation EnableVideoL(
+            const TBool aEnable,
+            const TOperation aOp = EEnableVideo );
+
+        /**
+        * Calls Protocol pausing and acts according to the result.
+        * @return operation id for performed operation
+        */
+        TOperation DoPauseVideo();
+
+        /**
+        * Continues to next step of uninitialization.
+        * @param aOp operation to perform
+        * @return command id
+        */
+        void ContinueUninitializeL( const TOperation aOp );
+
+        /**
+        * Cancels all the running commands within Protocol.
+        * @param operation to be returned
+        *       EUninitializeCancelAllProto if cancellation is ongoing
+        *       (either because was already or just started)
+        *       ENone if cancellation is not ongoing
+        * @return error code
+        *        KErrNotReady if engine not in suitable state
+        *        KErrAlreadyExists if cancel was already pending
+        *        KErrNone if cancellation request succeeded
+        *        other Symbian OS error code if cancellation fails
+        */
+        TInt CancelAllProtoCommands( TOperation &aOp );
+
+        /**
+        * Stops view finder and remote video rendering.
+        */
+        void StopRendering();
+
+        /**
+        * Updates volume to Protocol (if possible).
+        */
+        void UpdateVolume();
+
+        /**
+        * Initiates protocol engine reset.
+        */
+        void ResetProto2WayL();
+
+        /**
+        * Removes operation from pending operations array.
+        * @param aOp TOperation
+        * @return ETrue if operation was found (and hence removed)
+        */
+        template<class T>
+        TBool RemoveOperation( const T& aOp );
+
+        /**
+        * Adds operation pending for callback.
+        * @param aOp operation value
+        * @param aCmdId protocol commd id or 0 if not Protocol cmd
+        * @param aResetExisting if ETrue removes existing operations
+        *        from array
+        * @return index of the operation in array (i.e. >= 0 )
+        */
+        TInt AddOperation(
+            const TOperation aOp,
+            TInt aCmdId,	
+            const TBool aResetExisting = EFalse );
+
+        /**
+        * Checks if an operation is pending.
+        * @param aOp operation
+        * @return index if operation is pending or KErrNotFound
+        */
+        TInt IsPending( const TOperation aOp ) const;
+
+        /**
+        * Checks if an operation is pending.
+        * @param aCmdId command id
+        * @return index if operation is pending or KErrNotFound
+        */
+        TInt IsPending( const TInt aCmdId ) const;
+
+        /**
+        * Completes asynchronous operation.
+        * @param aResult
+        * @return KErrNotFound if no operation else KErrNone
+        */
+        TInt CompleteOp( const TInt aResult );
+
+        /**
+        * Completes asynchronous operation asynchronously.
+        * @param aResult
+        * @return KErrNotFound if no operation else KErrNone
+        */
+        void AsyncCompleteOp( const TInt aResult = KErrNone );
+
+        /**
+        * Checks if specific operation matches to response from protocol.
+        * @param aProtoCmdId command id returned by protocol
+        * @param aOperation operation to search for in pending commands
+        * @param aIndex index in iPendingOps array if found
+        * @return ETrue if there's corrensponding entry in pending ops
+        */
+        TBool MatchResponseToPendingOps(
+            const TInt aProtoCmdId,
+            const TOperation aOperation,
+            TInt* aIndex = NULL );
+
+        /**
+        * Starts "self-destruction" timer.
+        */
+        void StartDisconnectTimerL();
+
+        /**
+        * Assigns new pending operation. Only one can be pending at a time
+        * so if there already is pending operation it is completed with error.
+        * @param aOperation operation to assign as pending
+        * @param aReplaceError error code to complete penging operation if
+        *        one exists. If KErrNone is passed, replacement is not done.
+        * @return KErrNone if assignment done successfully i.e. there was
+                  not pending operation that was completed.
+        *         KErrCancel if some other operation was pending and was
+        *                     completed with aReplaceError. Operation is
+        *                     still assigned successfully.
+        *         KErrGeneral if operation was not assigned.
+        */
+        TInt AssignPendingOp(
+            CVtEngOperation& aOperation,
+            TInt aReplaceError = KErrCancel );
+
+        /**
+        * Callback function that completes ongoing operation.
+        * @param aAny pointer to an instance of the class.
+        * @return always KErrNone.
+        */
+        static TInt DoCompleteOp( TAny* aAny );
+
+        /**
+        * Implementation of self-destruction timer activity.
+        * Causes a panic.
+        * @param aAny pointer to an instance of the class
+        *   Not used.
+        * @return KErrNone;
+        */
+        static TInt TimerCallback( TAny* aAny );
+
+        /**
+        * Creates and enques async callback for uninitialization.
+        * @see iNextStepCallback
+        */
+        void NextUninitStepCallbackL();
+
+        /**
+        * Callback method for async uninitialization step.
+        * @seeiNextStepCallback
+        * @return KErrNone;
+        */
+        static TInt UninitCallback( TAny* aAny );
+
+		/**
+        * Query 2-way's additional interfaces, encoder and H324
+        * @return KErrNone;
+        */
+        void QueryProtoInterfacesL();
+
+		/**
+        * Release 2-way's additional interfaces, encoder and H324
+        * @return KErrNone;
+        */
+        void ReleaseProtoInterfacesL();
+
+        /**
+        * Check for pending Protocol extension interface commands.
+        * @return ETrue if one or more extension command is pending
+        */
+        TBool ExtensionCommandsPending() const;
+
+        /**
+        * Checks is it possible to add sink / source from session 
+        * state point of view.
+        * @return ETrue if adding is allowed.
+        */
+        TBool MediaAddingValidity() const;
+        
+        /**
+        * Provider initialization state
+        */
+        enum TInitState
+            {
+            /**
+            * Initialization not ongoing.
+            */
+            EInitStateNone,
+
+            /**
+            * Initialize still image.
+            */
+            EStateInitStillImage,
+
+            /**
+            * Initilize default blank provider.
+            */
+            EStateInitProvider,
+
+            /**
+            * Provider is set to none.
+            */
+            EStateWaitingProviderChangeForUninit,
+
+            /**
+            * Initialization has been cancelled.
+            */
+            EStateInitCanceled
+            };
+
+        /**
+        * State flags.
+        */
+        enum
+            {
+            // Protocol state flags
+            // Sink/source added
+            EProtoAudioSourceAdded   = 0x000001,
+            EProtoVideoSourceAdded   = 0x000002,
+            EProtoAudioSinkAdded     = 0x000004,
+            EProtoVideoSinkAdded     = 0x000008,
+            // Track paused
+            EProtoAudioTrackPaused   = 0x000040,
+            EProtoVideoTrackPaused   = 0x000080,
+
+            // Pause/resume related flags.
+            ETwoStageOperation    = 0x000100,
+            ESourceUpdateNeeded   = 0x000200,
+            EProtoPauseVideoRequested= 0x000400,
+            EProtoPauseVideoBlankProv= 0x000800,
+            EProtoContVideoBlankProv = 0x001000,
+            EProtoContVideoBlankInit = 0x002000,
+
+            // Must send intra
+            EProtoSendIntraFrame     = 0x004000,
+
+            // 324 interface acquired
+            EProto324IFAcquired      = 0x008000,
+
+            // Cancel all command is called on Protocol
+            // or there's nothing to cancel
+            EProtoCancelProtoCmdsOk     = 0x010000,
+
+            // NON Protocol related flags
+
+            EVideoQualitySetByPeer= 0x020000,
+
+            // Outgoing video channel closed (after being open)
+            // Used for preventing video pause/resume when
+            // the channel is not open
+            EOutVideoChannelClosed = 0x040000,
+
+            // Outgoing audio channel closed (after being open)
+            // Used for preventing audio pause/resume
+            // the channel is not open
+            EOutAudioChannelClosed = 0x080000
+            };
+
+
+        /**
+        * Defines actions that can be taken when sharing started
+        * and/or stopped
+        */
+        enum TVideoEngAction
+            {
+            EVideoActionNone,
+            EVideoActionEnable,
+            EVideoActionDisable
+            };
+
+        /**
+        * Helper class for handling video quality manipulation.
+        */
+        class TVtEngVideoQuality
+            {
+
+        public:
+
+            // Forward for inner class
+            class TVQSParams;
+
+        public:
+
+            /**
+            * Constructor.
+            */
+            TVtEngVideoQuality();
+
+            /**
+            * Destructor.
+            */
+            ~TVtEngVideoQuality();
+
+            /**
+            * Sets new local video quality setting.
+            * @param aId Operation id.
+            * @param aSetPeer ETrue if peer video quality needs to be set,
+            * EFalse otherwise.
+            */
+            void SettingVideoQuality( TInt aId, const TVideoQuality aValue,
+                TBool aSetPeer );
+
+            /**
+            * Get current local video quality setting.
+            * @return Current local video quality setting.
+            */
+                TVideoQuality VideoQuality() const;
+
+            /**
+            * Setting video quality succeeded.
+            * @return ETrue if record with given id was found, EFalse other
+            * wise.
+            */
+            TBool SettingSucceeded( TInt aId, TVQSParams& aParams );
+
+            /**
+            * Setting video quality failed.
+            */
+            void SettingFailed( TInt aId );
+
+            /**
+            * Called when video quality indication is received from peer.
+            */
+            void UpdateVideoQuality( const TVideoQuality aVideoQuality );
+
+            /**
+            * Converts given trade off value to video quality enum.
+            */
+            TVideoQuality FromTradeOff( const TInt aTradeOff ) const;
+
+            /**
+            * Converts given video quality enum to trade off value.
+            */
+            TInt ToFrameRate( const TVideoQuality aVideoQuality ) const;
+
+            /**
+            * Converts given video quality value to frame rate.
+            */
+            TUint8 ToTradeOff( const TVideoQuality aVideoQuality ) const;
+
+            /**
+            * Finds id of setting param and returns index to it.
+            */
+            TInt FindVQSParam( TInt aId ) const;
+
+        public:
+
+            /**
+            * Video quality parameters.
+            */
+            struct TVQSParams
+                {
+
+            public:
+
+                // Default constructor
+                TVQSParams();
+
+                // Constructor with initializing parameters
+                TVQSParams( TInt aId, const TVideoQuality aValue,
+                    TBool aSetPeer );
+
+            public: // data
+
+                // Operation id
+                TInt iId;
+
+                // VideoQuality value to be set
+                TVideoQuality iValue;
+
+                // Defines whether peer video quality needs to be set or not
+                TBool iSetPeer;
+
+                };
+
+        private:
+
+            // Current local video quality
+            TVideoQuality iCurrent;
+
+            // Qued params
+            RArray< TVQSParams > iParamList;
+            };
+
+		// Class for handling different kind of H.245 logical
+		// channels and their state in different MONA call setup
+		// scenarios
+		class TLogicalChannel
+			{
+		public:
+
+			// H.245 logical channel ID to be established or
+			// already active
+			TUint iLogicalChannelId;
+
+			// H.245 logical channel ID that is currently closing.
+			TUint iLogicalChannelIdClosing;
+
+			// Variable to tell is same type (video or audio, incoming or outgoing)
+			// channel already started to close but not closed yet. If closing is pending
+			// same type channel cannot be opened until closing has finished or sink/source
+			// addition has failed for some reason.
+			TBool iSameTypeClosingPending;
+
+			// Variable to tell is same type (video or audio, incoming or outgoing)
+			// channel ready to be opened.
+			TBool iSameTypeChannelReadyToOpen;
+
+			};
+
+    private:    // Data members.
+
+        // Protocol engine pointer.
+        MVtSessionCommand* iSessionCommand;
+
+        // Local video configuration.
+        CVtEngLocalVideo*   iLocalVideo;
+
+        // Remote video configuration.
+        CVtEngRemoteVideo*  iRemoteVideo;
+
+        // Pending internal operations.
+        TInt               iCmdId;
+        CArrayFixFlat<TCmdOpPair>* iPendingOps;
+
+        // Video Source initialization state.
+        TInitState          iVSInitState;
+
+        // Flags used to determine if audio and video sink/source
+        // is added to protocol and media state.
+        TInt                iProtoStateFlags;
+
+        // protocol state.
+        MVtProtocolCommand::TVtProtocolState        iProtoState;
+
+        // Initialization flag.
+        TBool               iInitialized;
+
+        // Remote media state.
+        TInt                iRemoteMediaState;
+
+        // Pending operation from client.
+        CVtEngOperation*    iPendingOp;
+
+        // Protocol initialization information.
+        TVtInitInfo     iSdkInitInfo;
+
+
+        // Request status for (un)initialization.
+        TRequestStatus*     iRequestStatus;
+
+        // Audio controller handle.
+        MVtAudioConfigCommand* iAudioCtrl;
+
+        // Timer to detect failure in disconnection.
+        CPeriodic* iTimer;
+
+        // Protocol max volume.
+        TInt iProtoMaxVolume;
+
+        // Selected camera is not necessary activated also.
+        TCameraId           iSelectedCameraId;
+
+        // ETrue when it is allowed to update volume.
+        TBool iUpdateVolumeAllowed;
+
+        // ETrue when it is needed to update volume.
+        TBool iUpdateVolumeRequired;
+
+        // Owned asynch callback.
+        CIdle* iAsyncCallback;
+
+        // Pending volume operation.
+        CVtEngOperation*    iPendingVolumeOp;
+
+        // Used for various connection related operations.
+        TInt iConnectionStates;
+
+        // Used while pausing and resuming video.
+        CVtEngLocalVideo::TVtEngProviderType iTempProviderInfo;
+
+        // Used for setting the vendor info.
+        MVtH324ConfigCommand* iH324Config;
+
+
+        // Used H263 interface.
+        MVtVideoConfigCommand* iH263Encoder;
+
+        // Video quality
+        TVtEngVideoQuality iVideoQuality;
+
+        // Sharing object while video is disable will set this flag
+        TVideoEngAction iVideoAction;
+
+		// Logical channel structure for outgoing video channel(s).
+		TLogicalChannel iVideoOutgoingLogicalChannel;
+
+		// Logical channel structure for outgoing audio channel(s).
+		TLogicalChannel iAudioOutgoingLogicalChannel;
+
+		// Logical channel structure for incoming video channel(s).
+		TLogicalChannel iVideoIncomingLogicalChannel;
+
+		// Logical channel structure for incoming audio channel(s).
+		TLogicalChannel iAudioIncomingLogicalChannel;
+
+		/* For proceeding to next uninit step asynchronously.
+		 * Needed because Proto extension interface cannot be released within
+		 * callback 
+		 */
+		 CAsyncCallBack* iNextStepCallback;
+
+
+        /* Do not complete operation on pause command. This flag
+         * is used when image sharing is stopped and video was disabled
+         * when sharing was initially started to prevent black frame sending
+         * during blank switch.
+         */
+        TBool iPauseNoCompleteOp;
+
+        /**
+        * Result for asynchronous operation completion.
+        */
+        TInt iAsyncCompleteOpResult;
+    };
+
+#endif      // CVTENGMEDIAHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/CVtEngRemoteVideo.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,441 @@
+/*
+* 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:  Remote video handling class.
+*
+*/
+
+
+
+#ifndef CVTENGREMOTEVIDEO_H
+#define CVTENGREMOTEVIDEO_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <w32std.h>
+#include "MVtEngImageScaler.h"
+#include "MVtEngDraw.h"
+#include "TVtEngRendering.h"
+#include "TVtEngRenderConfig.h"
+#include <mdisplaysink.h>
+#include <mvtprotocolhandler.h>
+
+// FORWARD DECLARATIONS
+class CDirectScreenAccess;
+class CFbsBitmap;
+class CVtEngStateManager;
+class MVtEngScalerObserver;
+
+class TVtEngRenderingOptionsDSA;
+class TVtEngRenderingOptionsDP;
+class TVtEngRenderingOptionsNGA;
+
+// Define image sizes.
+// QCIF.
+const TInt KVtEngResolutionQCIFWidth = 176;
+const TInt KVtEngResolutionQCIFHeight = 144;
+
+// SQCIF.
+const TInt KVtEngResolutionSQCIFWidth = 128;
+const TInt KVtEngResolutionSQCIFHeight = 96;
+
+// Default video screen width.
+const TInt KVtEngRemoteVideoDefaultWidth = 176;
+
+// Default video screen height.
+const TInt KVtEngRemoteVideoDefaultHeight = 144;
+
+// Watcher checks point time-out 400 ms.
+const TInt KVtEngWatcherTimeout = 400000;
+
+// When the watcher has timed out 15 times without new frame, send event to UI.
+const TInt KVtEngWatcherThreshold = 15;
+
+// CLASS DECLARATION
+
+/**
+*  Class handling remote video.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.6
+*/
+NONSHARABLE_CLASS( CVtEngRemoteVideo ) :
+    public CBase,
+    public MDisplaySinkObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aPv2Way a reference to PV instance.
+        * @param aStateManager reference to VT state manager
+        * @return instance of CVtEngRemoteVideo
+        */
+        static CVtEngRemoteVideo* NewL(
+            MVtSessionCommand& aSessionCommand,
+            CVtEngStateManager& aStateManager );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngRemoteVideo();
+
+    public: // From MDisplaySinkObserver
+
+        /**
+        * @see MDisplaySinkObserver
+        */
+        void VideoFrameSizeChangedL( const TSize& aFrom,
+            const TSize& aTo );
+
+    public: // New functions
+
+        /**
+        * Sets parameters used when rendering remote video.
+        */
+        void SetRenderingParametersL(
+            const TVtEngRenderingOptionsNGA& aParams );   
+               
+        /**
+        * Sets parameters used when rendering remote video.
+        * @param aParams direct screen access parameters
+        */
+        void SetRenderingParametersL(
+            const TVtEngRenderingOptionsDSA& aParams );
+
+        /**
+        * Sets parameters used when rendering remote video.
+        * @param aParams direct screen access parameters
+        */
+        void SetRenderingParametersL(
+            const TVtEngRenderingOptionsDP& aParams );
+
+        /**
+        * Starts remote video rendering.
+        */
+        void StartVideoL();
+
+        /**
+        * Stops remote video rendering.
+        */
+        void StopVideoRendering();
+
+        /**
+        * Pauses remote video rendering.
+        * @return command id from PV
+        */
+        TInt PauseVideoL();
+
+        /**
+        * Adds Display sink into PV.
+		* @param Video channel logical channel ID number.
+        * @return PV command ID
+        */
+        TInt AddVideoSinkL( TInt aChannelId );
+
+        /**
+        * Adds Audio sink into PV.
+		* @param Audio channel logical channel ID number.
+        * @return PV command ID
+        */
+        TInt AddAudioSinkL( TInt aChannelId );
+
+        /**
+        * Returns state of Direct Screen Access.
+        * @return state of Direct Screen Access
+        */
+        TBool GetDsaState() const;
+
+        /**
+        * Returns the audiosink of nested CVtEngDraw class.
+        * @return the audiosink of nested CVtEngDraw class
+        */
+        MVTAudioSink* AudioSink();
+
+        /**
+        * Sets UI foreground state (i.e. is the Application
+        * current active application or not).
+        * @param aForeground ETrue if the VT application is
+        * in foreground, EFalse otherwise.
+        * @exception May leave with KErrNotReady.
+        */
+        void SetUIForegroundL( TBool aForeground );
+
+        /**
+         * Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+         */        
+        void RequestLastFrame();
+        
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aPv2Way a reference to PV instance
+        * @param aStateManager reference to VT state manager
+        */
+        CVtEngRemoteVideo(
+            MVtSessionCommand& aSessionCommand,
+            CVtEngStateManager& aStateManager );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+    public:
+
+        /**
+        * Base rendering class
+        */
+        NONSHARABLE_CLASS( CVtEngDraw ) :
+            public CActive,
+            public MVtEngDraw,
+            public MDirectScreenAccess
+            {
+
+            protected: // new methods
+                /**
+                * C++ constructor as private.
+                * @param aObserver callback interface for Display Sink
+                */
+                CVtEngDraw( MDisplaySinkObserver* aObserver );
+
+                /**
+                * Destructor
+                */
+                ~CVtEngDraw();
+
+                /**
+                * By default Symbian 2nd phase constructor is private.
+                */
+                void ConstructL();
+
+                /**
+                * If not active, set iStatus to KRequestPending and calls
+                * SetActive();
+                */
+                void Activate();
+
+                /**
+                * Creates DSA instance.
+                */
+                void CreateAndStartDSAL();
+
+            public: // from MDirectScreenAccess
+
+                /**
+                * From MDirectScreenAccess, this function is called by the
+                * window server when direct screen access must stop.
+                * @see MDirectScreenAccess::AbortNow
+                */
+                virtual void AbortNow(
+                    RDirectScreenAccess::TTerminationReasons aReason );
+
+                /**
+                * From MDirectScreenAccess, this method is called by the direct
+                * screen access instance as soon as direct screen access can
+                * resume.
+                * @see MDirectScreenAccess::Restart
+                */
+                virtual void Restart(
+                    RDirectScreenAccess::TTerminationReasons aReason );
+
+            public: // new functions
+
+                /**
+                * Configuration was updated.
+                */
+                void ConfigUpdatedL();
+
+                /**
+                * Display Sink pointer.
+                * @return instance of MDisplaySink
+                */
+                MDisplaySink* DisplaySink();
+
+                /**
+                * Returns state of Direct Screen Access.
+                * @return true if rendering
+                */
+                TBool GetDsaState() const;
+
+                /**
+                * Checks frame watcher expiration.
+                * @param aAny pointer to CVtEngDrawDSA
+                * @return Symbian OS error code
+                */
+                static TInt WatcherExpired( TAny* aAny );
+
+                /**
+                * Handles frame watcher expiration.
+                */
+                void HandleWatcherExpired();
+
+                /**
+                * Sets certain flag on.
+                * @param aFlags flags to turn on.
+                */
+                void SetFlag( TUint aFlags );
+
+                /**
+                * Clears certain flag.
+                * @param aFlags flags to clear.
+                */
+                void ClearFlag( TUint aFlags );
+
+                /**
+                * Checks if certain flag is on.
+                * @param aFlags flags to check.
+                */
+                TBool IsFlag( TUint aFlag ) const;
+
+                /**
+                * Called by CVtEngRemoteVideo, when video sink is added
+                * to PV.
+                */
+                void VideoSinkAdded();
+
+            private: // from CActive
+
+                /**
+                * Handles active object cancellation.
+                * @see CActive::Cancel
+                */
+                void DoCancel();
+
+                /**
+                * Handles active object execution errors.
+                * @see CActive::RunError
+                */
+                TInt RunError( TInt aError );
+
+            protected:
+
+                /**
+                * Defines if drawing can be done
+                * and if we have not received frames
+                * for some time and observer is notified
+                * (and no new frames since then).
+                */
+                enum TFlags
+                    {
+                    // Start the rendering.
+                    EStarted            =   ( 1 << 0 ),
+                    // Ready by window server.
+                    EReadyForeground    =   ( 1 << 1 ),
+                    // Ready by internal state.
+                    EReadyInternal      =   ( 1 << 2 ),
+                    // Ready to draw.
+                    EReady              = EReadyInternal | EReadyForeground,
+                    // Watcher expired because no frames received in time.
+                    EFrameWatcherExpired=   ( 1 << 3 ),
+                    // First frame has been received.
+                    EFirstFrameReceived =   ( 1 << 4 ),
+                    // Drawing ongoing flag
+                    ERemoteVideoDrawing =   ( 1 << 5 ),
+                    // VT UI foreground status (if set, UI is foreground)
+                    EFlagUIForeground =     ( 1 << 6 ),
+                    // Components have been initialized
+                    EFlagInitialized =      ( 1 << 7 ),
+                    // VT UI has been sent to background
+                    ESentToBackground =     ( 1 << 8 ),
+                    // Frame buffer contains data when this flag is set (DP,NGA)
+                    EFrameBufferFilled = ( 1 << 9 ),
+                    // BaseConstructL() call is pending (DP,NGA)
+                    EBaseConstructCalled = ( 1 << 10 ),
+                    // BaseSetConfigL() call is pending (DP,NGA)
+                    EBaseSetConfigCalled = ( 1 << 11 ),
+                    // BaseStartDrawL() call is pending (DP,NGA)
+                    EBaseBaseStartDrawCalled = ( 1 << 12 ),
+                    // UpdateSinkParamsL() needs to be called (DP,NGA)
+                    ESinkParamUpdateRequired  = ( 1 << 13 ),
+                    // Sink().Resume() needs to be called (DP,NGA)
+                    ESinkResumeRequired = ( 1 << 14 ),
+                    // InitializePostingSurfaceL() call is pending (DP), CreateSurfaceL call is pending (NGA)
+                    EInitializePostingSurfaceCalled = ( 1 << 15 ),
+                    // New frame buffer is store, not coverted and scaled yet
+                    EFrameBufferNeedsConvertAndScale = ( 1 << 16 ),
+
+                    // Bitmask for all pending calls (DP)
+                    EDelayedCallsMask = EBaseConstructCalled |
+                        EBaseSetConfigCalled |
+                        EBaseBaseStartDrawCalled |
+                        ESinkParamUpdateRequired |
+                        EInitializePostingSurfaceCalled
+                    };
+
+            protected : // data
+
+                // Direct Screen Access.
+                CDirectScreenAccess* iDSA;
+
+                // Display sink providing bitmaps.
+                MDisplaySink*        iDisplaySink;
+
+                // @see TFlags
+                TInt                 iFlags;
+
+                // For checking if display sink stops feeding.
+                // drawer with bitmaps
+                CPeriodic*           iWatcher;
+
+                // to reduce watcher restarts do cancel it
+                // only every 15 frames
+                // Counter for frame expiration.
+                TInt                 iCheckpoint;
+
+                // DisplaySink callback interface.
+                MDisplaySinkObserver* iObserver;
+
+                // Frame watcher callback.
+                TCallBack            iCallback;
+
+                // Container class as a friend.
+                friend class CVtEngRemoteVideo;
+
+                // Temporarily store image size when size changes on the fly.
+                TSize iSourceSize;
+
+                // DisplaySink status boolean.
+                TBool                iDSUpdated;
+            };
+
+    private:    // Data
+        // Packet Video interface.
+        MVtSessionCommand&    iSessionCommand;
+
+        // State manager.
+        CVtEngStateManager&  iStateManager;
+
+        // Draws remote video with DSA.
+        CVtEngDraw*          iDrawer;
+
+        // Display sink.
+        MDisplaySink*        iDisplaySink;
+
+        // Audio sink interface.
+        MVTAudioSink*         iAudioSink;
+
+        // Information from PV regarding sink.
+        TInt        iTrackId;
+
+        // @see TFlags
+        TInt                 iStateFlags;
+        
+        TBool              iEnableNGA;
+    };
+
+#endif      // CVTENGREMOTEVIDEO_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/MVtEngDraw.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* 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:  Remote video handling class.
+*
+*/
+
+
+
+#ifndef MVTENGDRAW_H
+#define MVTENGDRAW_H
+
+// INCLUDE
+
+#include <e32base.h>
+
+// FORWARD
+
+class MDisplaySink;
+class MDisplaySinkObserver;
+class TVtEngRenderConfig;
+
+/**
+*  Drawer API.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( MVtEngDraw )
+    {
+    public:
+
+       /**
+        * Base construction for derived classes.
+        */
+        virtual void BaseConstructL() = 0;
+
+        /**
+        * Instantiates display sink.
+        */
+        virtual MDisplaySink* CreateSinkL() = 0;
+
+        /**
+        * Refresh view.
+        */
+        virtual void BaseRefreshL() = 0;
+
+        /**
+        * Updates the target bitmaps and/or displaymode
+        * and/or the sizes of bitmaps
+        */
+        virtual void BaseRefreshBitmapsL() = 0;
+
+        /**
+        * DoCancel method for inherited classes.
+        */
+        virtual void BaseDoCancel() = 0;
+
+        /**
+        * Configuration verifying routine for derived classes. If
+        * new configuration is not supported, then may this method
+        * leaves with appropriate error code.
+        */
+        virtual void BaseVerifyConfigL() = 0;
+
+        /**
+        * Called when DSA calls Restart() to start drawing again.
+        */
+        virtual void BaseRestartL() = 0;
+
+        /**
+        * Called when DSA calls AbortNow() to stop drawing.
+        */
+        virtual void BaseAbortNow() = 0;
+
+        /**
+        * Starts rendering.
+        */
+        virtual void BaseStartDrawL() = 0;
+
+        /**
+        * Stops rendering.
+        */
+        virtual void BaseStopDraw() = 0;
+
+        /**
+        * Sets configuration.
+        */
+        virtual void BaseSetConfigL( const TVtEngRenderConfig& aConfig ) = 0;
+
+        /**
+        * Called when UI foreground status changes.
+        */
+        virtual void BaseSetUIForegroundL( TBool aForeground ) = 0;
+
+        /**
+        * Called when incoming video frame size changes.
+        */
+        virtual void BaseVideoFrameSizeChangedL( const TSize& aTo ) = 0;
+        
+        /**
+        * Request update last remote video frame through MVtEngFrameObserver::vtSetFrame.
+        */
+        virtual void BaseRequestLastFrame() = 0;        
+
+    protected:
+
+        /**
+        * Returns current configuration settings.
+        */
+        virtual TVtEngRenderConfig& Config() = 0;
+
+    };
+
+/**
+* Remote drawer factory.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 3.2
+*/
+class VtEngDrawFactory
+    {
+    public:
+        /**
+        * Factory method for creating drawer
+        * @param aObserver a callback interface
+        */
+        static MVtEngDraw* CreateDrawerL( MDisplaySinkObserver* aObserver, TBool );
+    };
+
+#endif // MVTENGDRAW_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/MVtEngFrameObserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* 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:  Observer interface for video frames.
+*
+*/
+
+
+
+#ifndef MVTENGFRAMEOBSERVER_H
+#define MVTENGFRAMEOBSERVER_H
+
+//  INCLUDES
+#include <e32def.h>
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+/**
+*  Observer interface for video frames.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class MVtEngFrameObserver
+    {
+    public:
+
+        enum TFrameType
+            {
+            ELocalVideoFrame,
+            ERemoteVideoFrame
+            };
+
+        virtual void vtHandleFrameL( TFrameType aType,
+            CFbsBitmap* aBitmap ) = 0;
+
+        /**
+        * Sets last drawn frame. This frame will be stored by UI
+        * and will be drawn when DSA is temporarily disabled (e.g.
+        * when a menu is opened)
+        */
+        virtual void vtSetFrame( TFrameType aType,
+            CFbsBitmap* aBitmap ) = 0;
+
+    };
+
+#endif      // MVTENGFRAMEOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/MVtEngImageScaler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* 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:  Interface used for scaling images to certain size.
+*
+*/
+
+
+
+#ifndef VTENGIMAGESCALER_H
+#define VTENGIMAGESCALER_H
+
+//  INCLUDES
+#include <gdi.h>
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+
+/**
+* Image scaler observer.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.8
+*/
+class MVtEngScalerObserver
+    {
+    public:
+
+        /**
+        * Called when scaling is ready.
+        * @param aBitmap a scaled bitmap
+        * @param aError Symbian OS error code
+        */
+        virtual void ScalingCompleted( 
+            CFbsBitmap* aBitmap,
+            TInt aError ) = 0;
+    };
+
+/**
+* Image scaler.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class MVtEngImageScaler
+    {
+    public: // new functions
+
+        /**
+        * Used to start the scaling of an image.
+        * @param aSourceIndex the index of the source to use.
+        */
+        virtual void ScaleL( 
+            TInt aSourceIndex ) = 0;
+
+        /**
+        * Configures the scaler.
+        * @param aDisplayMode which kind of display
+        * @param aSize the width and height of the display
+        * @return ETrue if previous scaling was cancelled
+        */
+        virtual TBool ConfigureL(
+            TDisplayMode aDisplayMode,
+            TSize aSize,
+            TInt aSourceHandle1,
+            TInt aSourceHandle2 ) = 0;
+
+        /**
+        * Deletes the scaling object.
+        */
+        virtual void Release() = 0;
+
+        /**
+        * Possibility to cancel the scaling.
+        * @return error code of canceling.
+        */
+        virtual TInt Cancel() = 0;
+    };
+
+/**
+* Image scaler factory.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.8
+*/
+class VtEngScalerFactory
+    {
+    public:
+        /**
+        * Factory method for creating scaler
+        * @param aObserver a callback interface
+        */
+        static MVtEngImageScaler* CreateScalerL(
+            MVtEngScalerObserver& aObserver );
+    };
+
+#endif  // VTENGIMAGESCALER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/MVtEngMedia.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,357 @@
+/*
+* 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:  Media interface
+*
+*/
+
+
+
+#ifndef MVTENGMEDIA_H
+#define MVTENGMEDIA_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MVtEngLocalVideoDisplay;
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+/**
+*  Media interface for defining data types for media transport and
+*  presentation of it locally as well methods for obtaining current
+*  configuration.
+*
+*  @lib videoteleng.lib
+*  @since Series 60 2.6
+*/
+class MVtEngMedia
+    {
+    public:  // New functions.
+
+        enum TMediaType
+            {
+            EMediaAudio = (1 << 0 ),
+            EMediaVideo = ( 1 << 1 ),
+            EMediaAudioPreparing = ( 1 << 2 ),
+            EMediaVideoPreparing = ( 1 << 3 ),
+            // Status of audio channel, applicable only for outgoing audio.
+            EMediaAudioChannelOpen = ( 1 << 4 ),
+            // Status of video channel, applicable only for outgoing video.
+            EMediaVideoChannelOpen = ( 1 << 5 )
+            };
+
+        /**
+        * ESourceCapsPrimaryCamera
+        *   primary camera can be selected.
+        * ESourceCapsSecondaryCamera
+        *   secondary camera can be selected.
+        * ESourceCapsStillImage
+        *   still image can be selected.
+        */
+        enum TSourceCapsFlags
+            {
+            ESourceCapsPrimaryCamera   = ( 1 << 0 ),
+            ESourceCapsSecondaryCamera = ( 1 << 1 ),
+            ESourceCapsStillImage      = ( 1 << 2 )
+            };
+
+        /**
+        * EMediaOutgoing
+        *  outbound media
+        * EMediaIncoming
+        *  inbound media
+        */
+        enum TMediaDirection
+            {
+            EMediaOutgoing,
+            EMediaIncoming
+            };
+
+        /**
+        * EMediaNone
+        *  No media source selected.
+        * EMediaCamera
+        *  Camera selected
+        * EMediaCameraPri
+        *  Primary camera selected.
+        *    Camera is inwards
+        * EMediaCameraSec
+        *  Secondary camera selected.
+        *    Camera is outwards
+        * EMediaStillImage
+        *  Still image as source.
+        * EMediaVideoStream
+        *  Video stream selected.
+        */
+        enum TMediaSource
+            {
+            EMediaNone,
+            EMediaCamera,
+            EMediaCameraPri,
+            EMediaCameraSec,
+            EMediaStillImage,
+            EMediaVideoStream,
+            EMediaShare
+            };
+
+        /**
+        * EPrimaryCamera
+        *  Primary camera is inwards faced.
+        * ESecondaryCamera
+        *  Camera is facing outwards.
+        */
+        enum TCameraId
+            {
+            EPrimaryCamera,
+            ESecondaryCamera
+            };
+
+        /**
+        * Camera information (zoom mainly).
+        */
+        struct TCameraInfo
+            {
+            TInt    iMinZoom;
+            TInt    iMaxZoom;
+            TInt    iMaxDigitalZoom;
+            TInt    iMajorZoomStepCount;
+            };
+
+        /**
+        *
+        * Video quality enumeration.
+        *
+        * EVideoQualityUndefined video quality has not been set
+        * yet.
+        * EVideoQualityDetail means slow frame rate, good image
+        * quality..
+        * EVideoQualityNormal smoother video with somewhat lower
+        * image quality than EVideoQualityDetail.
+        * EVideoQualityMotion the smoothest video with the worst
+        * image quality.
+        */
+        enum TVideoQuality
+            {
+            EVideoQualityUndefined,
+            EVideoQualityDetail,
+            EVideoQualityNormal,
+            EVideoQualityMotion
+            };
+
+        /**
+        * Enumerates object sharing state.
+        *
+        * ENotAbleToShare Is not able to share any objects (engine in wrong
+        * state)
+        * ENotSharing Is not sharing anything
+        * EInitializingShareImage Initializing still image sharing.
+        * ESharingImage Is sharing image
+        * ESharingVideoClip Is sharing video clip
+        */
+        enum TShareObjectState
+            {
+            ENotAbleToShare,
+            ENotSharing,
+            EInitializingShareImage,
+            EInitializingShareVideoClip,
+            ESharingImage,
+            ESharingVideoClip
+            };
+
+        /**
+        * Defines layout (screen orientation) used by
+        * Video Telephone application per active camera.
+        * Each camera has one of the following values:
+        *
+        * EOrientationLandscape Layout is always landscape.
+        * EOrientationPortrait Layout is always portrait.
+        * EOrientationObeyLayoutSwitch Obey layout in specific device mode.
+        */
+        enum TCameraOrientation
+          	{
+            EOrientationLandscape,
+            EOrientationPortrait,
+            EOrientationObeyLayoutSwitch
+          	};
+
+        /**
+        * Command parameters for Image sharing.
+        */
+        typedef TFileName TShareObjectImageParameters;
+
+        /**
+        * Command parameters for Video Clip sharing.
+        */
+        typedef TFileName TShareObjectVideoClipParameters;
+
+        /**
+        * Parameters for Prepare Camera.
+        */
+        struct TPrepareCameraParams
+            {
+            TMediaSource iMediaSource;
+            TBool iInitialize;
+            };
+
+        /**
+        * Returns state of transmission local video/audio to remote end.
+        *
+        * @param aMediaDirection
+        * @param aActiveMedia returns active media as bitmap (see TMediaType).
+        * @return Symbian OS error code.
+        */
+        virtual TInt GetMediaState(
+            const TMediaDirection aMediaDirection,
+            TInt& aActiveMedia ) const = 0;
+
+        /**
+        * Returns active source for video transmission and
+        * local display.
+        * @param aSource source in return
+        * @return Symbian OS error code
+        */
+        virtual TInt GetSource( TMediaSource& aSource ) const = 0;
+
+        /**
+        * Returns source capabilities.
+        * @param combination of capability flags
+        * @return Symbian OS error code
+        */
+        virtual TInt GetSourcesCaps( TInt& aCaps ) const = 0;
+
+        /**
+        * Returns currently active camera.
+        * @param returns current camera id.
+        * @return Symbian OS error code.
+        * KErrNotReady if the engine is not ready or it's in wrong state,
+        * KErrInUse if camera is used by other application.
+        * Camera must be initialized, by async KVtEngPrepareCamera command or
+        * KVtEngSetSource command with camera parameter, in order to get
+        * KErrInUse indication.
+        */
+        virtual TInt GetCurrentCameraId( TCameraId& aId ) const = 0;
+
+        /**
+        * Returns camera information.
+        * @param aId camera to query information for.
+        * @param aInfo returns camera information
+        * @return Symbian OS error code. If camera is not
+        * available returns KErrNotFound.
+        */
+        virtual TInt GetCameraInfo(
+            const TCameraId aId,
+            TCameraInfo& aInfo ) const = 0;
+
+        /**
+        * Gets current zoom step
+        * @param aCurrentStep current zoom step
+        * @return Symbian OS error code.
+        */
+        virtual TInt GetCurrentZoomStep( TInt& aCurrentStep ) = 0;
+
+        /**
+        * Gets maximum zoom value that may be passed to camera.
+        * @param aMaxZoomStep maximum zoom step.
+        * @return Symbian OS error code.
+        */
+        virtual TInt GetMaxZoomStep( TInt& aMaxZoomStep ) = 0;
+
+        /**
+        * Gets number of major zoom level leaps.
+        * Less than or equal to maximum digital zoom steps.
+        * @param aCount number of leaps
+        * @return Symbian OS error code.
+        */
+        virtual TInt GetMajorZoomStepCount( TInt& aCount ) = 0;
+
+        /**
+        * Maps major zoom leap step to corresponding step index.
+        * @param aIndex major zoom step.
+        * @param aStep zoom step
+        */
+        virtual void GetMajorZoomStep( TInt aIndex, TInt& aStep ) = 0;
+
+        /**
+        * Gets freeze support status.
+        * @param aFreezeSupported ETrue if freeze is supported, EFalse otherwise.
+        * @return KErrNotReady if provider is not ready yet.
+        * @since S60 3.1
+        */
+        virtual TInt GetFreezeSupported( TBool& aFreezeSupported ) const = 0;
+
+        /**
+        * Gets freeze current status.
+        * @param aFreezeSupported ETrue if active provider is frozen, EFalse otherwise.
+        * @return KErrNotReady if provider is not ready yet.
+        * @since S60 3.1
+        */
+        virtual TInt GetFreezeState( TBool& aFrozen ) const = 0;
+
+        /**
+        * Returns state of DSA drawing, whether is active or not.
+        * @param aMediaDirection in or out direction
+        * @param aState returns state of Direct Screen Access
+        * @return Symbian OS error code
+        */
+        virtual TInt GetDsaState(
+            const TMediaDirection aMediaDirection,
+            TBool& aActive ) const = 0;
+
+        /**
+        * Returns state of VideoCall, whether is connected or not.
+        * @return state
+        */
+        virtual TBool VideoCallConnected () const = 0;
+         
+        /**
+        * Returns ETrue if rendering has been started.
+        *
+        * @param aDirection specifies the rendering direction to check
+        * @return ETrue if rendering has been started.
+        */
+        virtual TBool RenderingStarted( const TMediaDirection
+            aDirection ) const = 0;
+
+        /**
+        * Gets current local video quality setting.
+        * @param aVideoQuality Current local video quality settings.
+        * @since S60 3.1
+        */
+        virtual void GetVideoQuality( TVideoQuality& aVideoQuality ) const = 0;
+
+        /**
+        * Gets current object sharing state.
+        * @param aObjectSharingState On return contains current object sharing
+        * state. @see MVtEngMedia::TShareObjectState.
+        * @since S60 3.1
+        */
+        virtual void GetObjectSharingState(
+            TShareObjectState& aObjectSharingState ) const = 0;
+
+        /**
+        * Gets camera orientations for primary and secondary camera.
+        * @see MVtEngMedia::TCameraOrientation
+        * @param aPrimaryCameraOrientation priamry camera orientation.
+        * @param aSecondaryCameraOrientation secondary camera orientation.
+        */
+        virtual void GetCameraOrientations(
+            TCameraOrientation& aPrimaryCameraOrientation,
+            TCameraOrientation& aSecondaryCameraOrientation ) const = 0;
+    };
+
+#endif      // MVTENGMEDIA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfig.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERCONFIG_H
+#define TVTENGRENDERCONFIG_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class RWindow;
+
+
+// CLASS DECLARATION
+
+/**
+*  Configuration for representation of local or remote video.
+*  Used only internally.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+struct TVtEngRenderConfig
+    {
+    public: // enumerations
+
+        /**
+        * Indication of type of rendering specified by configuration.
+        * EWsRender fields applicable for window server are valid
+        * EDsaRender fields applicable for DSA are valid
+        */
+        enum TRenderType
+            {
+            EWsRender,
+            EDsaRender,
+            EDpRender,
+            ENgaRender
+            };
+
+    public: // data
+        RWindow*            iRemoteWindow;
+
+        RWsSession*          iWsSession;
+        CWsScreenDevice*     iWsSreenDevice;
+        RWindowBase*         iWindow;
+
+        MVtEngFrameObserver* iObserver;
+        TRect                iRect;
+        TRect                iClipRect;
+        TPoint               iOffset;
+        TRenderType          iType;
+    };
+
+#endif      // TVTENGRENDERCONFIG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDP.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERCONFIGDP_H
+#define TVTENGRENDERCONFIGDP_H
+
+//  INCLUDES
+#include "TVtEngRenderConfig.h"
+#include "TVtEngRenderingDP.h"
+#include <posting_surface.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+*  Configuration for representation of local or remote video.
+*  Used only internally.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderConfigDP ) : public TVtEngRenderConfig
+    {
+public: // new functions
+
+    TVtEngRenderConfigDP();
+
+    TVtEngRenderConfigDP( const TVtEngRenderingOptionsDP& aOptions );
+
+    TVtEngRenderConfigDP& operator=( const TVtEngRenderConfig& aConfig );
+
+public: // data
+    // Background color value. This color is filled to areas that are not
+    // covered by the image.
+    TUint                           iBackGround;
+    };
+
+#include "TVtEngRenderConfigDP.inl"
+
+#endif      // TVTENGRENDERCONFIGDP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDP.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::TVtEngRenderConfigDP
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDP::TVtEngRenderConfigDP()
+    {
+    Mem::FillZ( this, sizeof( TVtEngRenderConfigDP ) );
+    iType = EDpRender;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::TVtEngRenderConfigDP
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDP::TVtEngRenderConfigDP(
+    const TVtEngRenderingOptionsDP& aOptions )
+    {
+    iType = EDpRender;
+    iWsSession = &aOptions.iWs;
+    iWsSreenDevice = &aOptions.iWsSD;
+    iWindow = &aOptions.iWindow;
+    iObserver = aOptions.iObserver;
+    iRect = aOptions.iRect;
+    iClipRect = aOptions.iClipRect;
+    iOffset = aOptions.iOffset;
+    iBackGround = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::operator=
+//
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDP& TVtEngRenderConfigDP::operator=(
+    const TVtEngRenderConfig& aConfig )
+    {
+    iWsSession = aConfig.iWsSession;
+    iWsSreenDevice = aConfig.iWsSreenDevice;
+    iWindow = aConfig.iWindow;
+    iObserver = aConfig.iObserver;
+    iRect = aConfig.iRect;
+    iClipRect = aConfig.iClipRect;
+    iOffset = aConfig.iOffset;
+    iType = aConfig.iType;
+    return *this;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDSA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERCONFIGDSA_H
+#define TVTENGRENDERCONFIGDSA_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "TVtEngRenderConfig.h"
+#include "TVtEngRenderingDSA.h"
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+*  Configuration for representation of local or remote video.
+*  Used only internally.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderConfigDSA ) : public TVtEngRenderConfig
+    {
+public: // new functions
+
+    TVtEngRenderConfigDSA();
+
+    TVtEngRenderConfigDSA( const TVtEngRenderingOptionsDSA& aOptions );
+
+    TVtEngRenderConfigDSA& operator=( const TVtEngRenderConfig& aConfig );
+
+public: // data
+    };
+
+#include "TVtEngRenderConfigDSA.inl"
+
+#endif      // TVTENGRENDERCONFIGDSA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigDSA.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,70 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDSA::TVtEngRenderConfigDSA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDSA::TVtEngRenderConfigDSA()
+    {
+    Mem::FillZ( this, sizeof( TVtEngRenderConfigDSA ) );
+    iType = EDsaRender;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDSA::TVtEngRenderConfigDSA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDSA::TVtEngRenderConfigDSA(
+    const TVtEngRenderingOptionsDSA& aOptions )
+    {
+    iType = EDsaRender;
+    iWsSession = &aOptions.iWs;
+    iWsSreenDevice = &aOptions.iWsSD;
+    iWindow = &aOptions.iWindow;
+    iObserver = aOptions.iObserver;
+    iRect = aOptions.iRect;
+    iClipRect = aOptions.iClipRect;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDSA::operator=
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigDSA& TVtEngRenderConfigDSA::operator=(
+    const TVtEngRenderConfig& aConfig )
+    {
+    iWsSession = aConfig.iWsSession;
+    iWsSreenDevice = aConfig.iWsSreenDevice;
+    iWindow = aConfig.iWindow;
+    iObserver = aConfig.iObserver;
+    iRect = aConfig.iRect;
+    iClipRect = aConfig.iClipRect;
+    iOffset = aConfig.iOffset;
+    iType = aConfig.iType;
+    return *this;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigNGA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* 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:  Class for NGA render configuration.
+*
+*/
+
+
+#ifndef TVTENGRENDERCONFIGNGA_H
+#define TVTENGRENDERCONFIGNGA_H
+
+//  INCLUDES
+#include "TVtEngRenderConfig.h"
+#include "TVtEngRenderingNGA.h"
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+*  Configuration for representation of local or remote video.
+*  Used only internally.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderConfigNGA ) : public TVtEngRenderConfig
+    {
+public: // new functions
+
+    TVtEngRenderConfigNGA();
+
+    TVtEngRenderConfigNGA( const TVtEngRenderingOptionsNGA& aOptions );
+
+    TVtEngRenderConfigNGA& operator=( const TVtEngRenderConfig& aConfig );
+
+public: // data    
+    };
+
+#include "TVtEngRenderConfigNGA.inl"
+
+#endif      // TVTENGRENDERCONFIGNGA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderConfigNGA.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* 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:  Inline implementation for TVtEngRenderConfigNGA.
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigNGA::TVtEngRenderConfigNGA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigNGA::TVtEngRenderConfigNGA()
+    {
+    Mem::FillZ( this, sizeof( TVtEngRenderConfigNGA ) );
+    iType = ENgaRender;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::TVtEngRenderConfigNGA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigNGA::TVtEngRenderConfigNGA(
+    const TVtEngRenderingOptionsNGA& aOptions )
+    {
+    iType = ENgaRender;
+    iWsSession = &aOptions.iWs;
+    //iWsSreenDevice = &aOptions.iWsSD;
+   // iWindow = &aOptions.iWindow;
+    iObserver = aOptions.iObserver;
+    //iRect = aOptions.iRect;
+    //iClipRect = aOptions.iClipRect;
+    //iOffset = aOptions.iOffset;
+    iRemoteWindow = &aOptions.iWindow;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderConfigDP::operator=
+//
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderConfigNGA& TVtEngRenderConfigNGA::operator=(
+    const TVtEngRenderConfig& aConfig )
+    {
+    iWsSession = aConfig.iWsSession;
+   // iWsSreenDevice = aConfig.iWsSreenDevice;
+   // iWindow = aConfig.iWindow;
+    iObserver = aConfig.iObserver;
+   // iRect = aConfig.iRect;
+    //iClipRect = aConfig.iClipRect;
+   // iOffset = aConfig.iOffset;
+    iType = aConfig.iType;
+    iRemoteWindow = aConfig.iRemoteWindow;
+    return *this;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRendering.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERING_H
+#define TVTENGRENDERING_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+*  Configuration for representation of local or remote video
+*  via window server.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderingOptions )
+    {
+    public: // constructor
+
+        /**
+        * C++ constructor
+        */
+        inline TVtEngRenderingOptions(
+            MVtEngFrameObserver& aObserver,
+            TSize aRect );
+
+        /**
+        * copy constructor
+        */
+        inline TVtEngRenderingOptions( const TVtEngRenderingOptions& aOptions );
+
+    private:
+        TVtEngRenderingOptions& operator=( const TVtEngRenderingOptions& );
+
+    public:
+        // Frame observer
+        MVtEngFrameObserver* iObserver;
+
+        // Bitmap size
+        TSize iSize;
+    };
+
+#include <tvtengrendering.inl>
+
+#endif      // TVTENGRENDERING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRendering.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptions::TVtEngRenderingOptions
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptions::TVtEngRenderingOptions(
+    MVtEngFrameObserver& aObserver,
+    TSize aSize ) :
+    iObserver( &aObserver ),
+    iSize( aSize)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptions::TVtEngRenderingOptions
+// C++ copy constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptions::TVtEngRenderingOptions(
+    const TVtEngRenderingOptions& aOptions ) :
+    iObserver( aOptions.iObserver ),
+    iSize( aOptions.iSize )
+    {
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingDP.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGRENDERINGDP_H
+#define TVTENGRENDERINGDP_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+*  Display posting access rendering definitions.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderingOptionsDP )
+    {
+    public: // constructor
+
+        /**
+        * C++ constructor
+        */
+        inline TVtEngRenderingOptionsDP(
+            MVtEngFrameObserver& aObserver,
+            RWsSession& aWs,
+            CWsScreenDevice& aScreenDevice,
+            RWindowBase& aWindow,
+            const TRect& aScreenRect,
+            const TRect& aClipRect,
+            const TPoint& aOffset );
+
+        /**
+        * C++ copy constructor.
+        * @param aOptions options to be copied to this instance.
+        */
+        inline TVtEngRenderingOptionsDP(
+            const TVtEngRenderingOptionsDP& aOptions );
+
+    private:
+        TVtEngRenderingOptionsDP& operator=(
+            const TVtEngRenderingOptionsDP& );
+
+    public: // data members
+        RWsSession&      iWs;
+        CWsScreenDevice& iWsSD;
+        RWindowBase&     iWindow;
+        TRect            iRect;
+        TRect            iClipRect;
+        TPoint           iOffset;
+
+        // Frame observer
+        MVtEngFrameObserver* iObserver;
+    };
+
+#include <tvtengrenderingdp.inl>
+
+#endif      // TVTENGRENDERINGDP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingDP.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsDP::TVtEngRenderingOptionsDP
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsDP::TVtEngRenderingOptionsDP(
+    MVtEngFrameObserver& aObserver,
+    RWsSession& aWs,
+    CWsScreenDevice& aScreenDevice,
+    RWindowBase& aWindow,
+    const TRect& aScreenRect,
+    const TRect& aClipRect,
+    const TPoint& aOffset ) :
+    iWs( aWs ),
+    iWsSD( aScreenDevice ),
+    iWindow( aWindow ),
+    iRect( aScreenRect ),
+    iClipRect( aClipRect ),
+    iOffset( aOffset ),
+    iObserver( &aObserver )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDP
+// C++ copy constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsDP::TVtEngRenderingOptionsDP(
+    const TVtEngRenderingOptionsDP& aOptions )
+    : iWs( aOptions.iWs ),
+      iWsSD( aOptions.iWsSD ),
+      iWindow( aOptions.iWindow ),
+      iRect( aOptions.iRect ),
+      iClipRect( aOptions.iClipRect ),
+      iOffset( aOptions.iOffset ),
+      iObserver( aOptions.iObserver )
+    {
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingDSA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,81 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+#ifndef TVTENGRENDERINGDSA_H
+#define TVTENGRENDERINGDSA_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+
+// CLASS DECLARATION
+
+/**
+*  Direct screen access rendering definitions.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderingOptionsDSA )
+    {
+    public: // constructor
+
+        /**
+        * C++ constructor
+        */
+        inline TVtEngRenderingOptionsDSA(
+            MVtEngFrameObserver& aObserver,
+            RWsSession& aWs,
+            CWsScreenDevice& aScreenDevice,
+            RWindowBase& aWindow,
+            const TRect& aScreenRect,
+            const TRect& aClipRect );
+
+        /**
+        * C++ copy constructor.
+        * @param aOptions options to be copied to this instance.
+        */
+        inline TVtEngRenderingOptionsDSA(
+            const TVtEngRenderingOptionsDSA& aOptions );
+
+    private:
+        TVtEngRenderingOptionsDSA& operator=(
+            const TVtEngRenderingOptionsDSA& );
+
+    public: // data members
+        RWsSession&      iWs;
+        CWsScreenDevice& iWsSD;
+        RWindowBase&     iWindow;
+        TRect            iRect;
+        TRect            iClipRect;
+
+        // Frame observer
+        MVtEngFrameObserver* iObserver;
+    };
+
+#include <tvtengrenderingdsa.inl>
+
+#endif      // TVTENGRENDERINGDSA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingDSA.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDSA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDSA(
+    MVtEngFrameObserver& aObserver,
+    RWsSession& aWs,
+    CWsScreenDevice& aScreenDevice,
+    RWindowBase& aWindow,
+    const TRect& aScreenRect,
+    const TRect& aClipRect ) :
+    iWs( aWs ),
+    iWsSD( aScreenDevice ),
+    iWindow( aWindow ),
+    iRect( aScreenRect ),
+    iClipRect( aClipRect ),
+    iObserver( &aObserver )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDSA
+// C++ copy constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsDSA::TVtEngRenderingOptionsDSA(
+    const TVtEngRenderingOptionsDSA& aOptions )
+    : iWs( aOptions.iWs ),
+      iWsSD( aOptions.iWsSD ),
+      iWindow( aOptions.iWindow ),
+      iRect( aOptions.iRect ),
+      iClipRect( aOptions.iClipRect ),
+      iObserver( aOptions.iObserver )
+    {
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingNGA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* 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:  Class for NGA Rendering.
+*
+*/
+
+#ifndef TVTENGRENDERINGNGA_H
+#define TVTENGRENDERINGNGA_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MVtEngFrameObserver;
+class RWindow;
+class RWsSession;
+// CLASS DECLARATION
+
+/**
+*  Direct screen access rendering definitions.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( TVtEngRenderingOptionsNGA )
+    {
+    public: // constructor
+
+        /**
+        * C++ constructor
+        */
+        inline TVtEngRenderingOptionsNGA(
+            MVtEngFrameObserver& aObserver,
+            RWindow& aWindow, RWsSession& aWs );
+
+        /**
+        * C++ copy constructor.
+        * @param aOptions options to be copied to this instance.
+        */
+        inline TVtEngRenderingOptionsNGA(
+            const TVtEngRenderingOptionsNGA& aOptions );
+
+    private:
+        TVtEngRenderingOptionsNGA& operator=(
+            const TVtEngRenderingOptionsNGA& );
+
+    public: // data members
+        RWindow&    iWindow;
+        
+        RWsSession&      iWs;
+        
+        // Frame observer
+        MVtEngFrameObserver* iObserver;
+    };
+
+#include <tvtengrenderingnga.inl>
+
+#endif      // TVTENGRENDERINGNGA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Media/TVtEngRenderingNGA.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* 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:  Inline implementation for TVtEngRenderingOptionsNGA
+*
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsNGA::TVtEngRenderingOptionsNGA
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsNGA::TVtEngRenderingOptionsNGA(
+    MVtEngFrameObserver& aObserver,
+    RWindow& aWindow, RWsSession& aWs) :
+    iWindow( aWindow ),
+    iWs( aWs ),
+    iObserver( &aObserver )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderingOptionsNGA::TVtEngRenderingOptionsNGA
+// C++ copy constructor
+// -----------------------------------------------------------------------------
+//
+inline TVtEngRenderingOptionsNGA::TVtEngRenderingOptionsNGA(
+    const TVtEngRenderingOptionsNGA& aOptions )
+    : iWindow( aOptions.iWindow ),
+      iWs( aOptions.iWs),
+      iObserver( aOptions.iObserver )
+    {
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/CVtEngSessionHandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* 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:  Video session interface.
+*
+*/
+
+
+
+#ifndef CVTENGSESSIONHANDLER_H
+#define CVTENGSESSIONHANDLER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "MVtEngSessionInfo.h"
+#include "MVtCtlEventObserver.h"
+#include "MVtCtlCallControl.h"
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+class CVtCtlFactory;
+class CVtEngOperation;
+class CVtEngIncomingCallMonitor;
+// CLASS DECLARATION
+
+/**
+*  Abstraction for video telephony session with remote end.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngSessionHandler ) : 
+        public CActive, 
+        public MVtEngSessionInfo,
+        public MVtCtlEventObserver
+    {
+    public: // constructor and destructors
+
+        static CVtEngSessionHandler* NewL( );
+
+        virtual ~CVtEngSessionHandler();
+
+    public: // New functions
+
+        /**
+        * Performs on operation in the handler.
+        * @param operation to be performed on the handler
+        */
+        void HandleL( CVtEngOperation& aOperation );
+
+    public: // from MVtEngSessionInfo
+
+        /**
+        * Gets session state.
+        * @return
+        */
+        virtual TSessionState State( TBool aForcedRefresh ) const;
+
+        /**
+        * Gets session direction.
+        * @return
+        */
+        virtual TInt GetDirection( TDirection& aDirection ) const;
+
+        /**
+        * Gets session duration.
+        * @param 
+        * @param
+        */
+        virtual TInt GetDuration( 
+            TDuration& aDuration,
+            TBool& aEnabled ) const;
+
+        /*
+        * @see MVtEngSessionInfo::aCLI
+        */
+        virtual TInt GetCLI( TCLI& aCLI ) const;
+        
+    public: // From MVtCtlEventObserver
+        virtual void HandleVtSessionEventL( 
+            TVtCtlEvent aEvent,
+            TAny* aParams );
+    
+    public: // new functions
+        /**
+        * Initializes session handler.
+        */
+        void InitializeL();
+
+        /**
+        * Frees resources used by session handler.
+        */
+        void Uninitialize();
+
+        MVtCtlCallControl::TVtCtlState RealState() const;
+        
+        /**
+        * Starts Incoming call PS key monitoring
+        */
+        void StartIncomingCallMonitorL();
+
+    private: // constructors
+
+        void ConstructL();
+
+        CVtEngSessionHandler( );
+
+    private: // from CActive
+        void RunL();
+
+        void DoCancel();
+
+    private: // Member data
+        MVtCtlCallControl* iSessionControl;
+        CVtCtlFactory*     iFactory;
+
+        RLibrary iLib;
+        
+        CVtEngIncomingCallMonitor* iIncomingCallMonitor; 
+    };
+
+
+#endif      // CVTENGSESSIONHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/MVtEngDtmfHandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* 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:  DTMF handler interface for DTMF states and media 
+*                handler to use.
+*
+*/
+
+
+
+#ifndef MVTENGDTMFHANDLER_H
+#define MVTENGDTMFHANDLER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// DATA TYPES
+
+// FORWARD DECLARATIONS
+class CVtEngOperation;
+class TVtEngDtmfTone;
+class MVTUserInput;
+class CVtEngDtmfState;
+
+// CLASS DECLARATION
+
+/**
+*  Base class for data types
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class MVtEngDtmfHandler
+    {
+    public: // 
+        /**
+        * Dtmf states
+        */
+        enum TVtEngDtmfState 
+            {
+            // Not sending DTMF
+            EVtDtmfStateIdle = 0,
+            // Sending DTMF
+            EVtDtmfStateSending,
+            // Sending DTMF, another waiting in buffer
+            EVtDtmfStateBuffered
+            };
+
+    public:
+
+        /**
+        * Handles a DTMF command.
+        * @param 
+        */
+        virtual void HandleL( CVtEngOperation& aOp ) = 0;
+
+        /**
+        * Activates a DTMF state.
+        * @param aNewState state index
+        * @return activated state
+        */
+        virtual CVtEngDtmfState& ActivateState( 
+            MVtEngDtmfHandler::TVtEngDtmfState aNewState ) = 0;
+
+        /**
+        * Handles completion of DTMF sending, non-leavable method.
+        * @param aError Symbian OS error code
+        */
+        virtual void SendComplete( TInt aError ) = 0;
+
+        /**
+        * Returns new instance used for sending DTMF tone to protocol 
+        * @param aTone tone to send
+        * @return protocol DTMF tone.
+        */
+        virtual MVTUserInput& ReserveProtoDtmfL(
+            const TVtEngDtmfTone& aTone  ) = 0;
+
+        /**
+        * Releses protocol DTMF instance.
+        */
+        virtual void ReleaseProtoDtmf() = 0;
+
+		/**
+        * Compares last issued DTMF command ID to given command ID.
+        * @param aCheckCommandId command ID to be compared against
+        * @return ETrue if IDs are same, otherwise EFalse
+        */
+		virtual TBool CheckCommandId( TInt aCheckCommandId ) const = 0 ;
+
+		/**
+        * Stores command ID, used in CheckCommandID.
+        * @param aStoreCommandId command ID to be stored.        
+        */
+		virtual void StoreCommandId( TInt aStoreCommandId ) = 0;
+    };
+
+#endif      MVTENGDTMFHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/MVtEngSessionInfo.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* 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:  Video session interface.
+*
+*/
+
+
+
+#ifndef MVTENGSESSIONINFO_H
+#define MVTENGSESSIONINFO_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Abstraction for video telephony session with remote end.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class MVtEngSessionInfo
+    {
+    public: // 
+
+        /**
+        * Session state
+        * EIdle           Session not established.
+        * EInitializing   Initializing MO session
+        * ERemoteAlerting Remote end is alerting
+        * EReceiving      Incoming session request from network
+        * EConnected      Connection to peer is established.
+        * ENegotiating    Handshaking with peer.
+        * EOpen           Session active and media channels are open.
+        * EClearing       Clearing connection.
+        */
+        enum TSessionState 
+            {
+            EUnknown = -1,
+            EIdle,
+            EInitializing,
+            ERemoteAlerting,
+            EReceiving,
+            EConnected,
+            ENegotiating,
+            EOpen,
+            EClearing
+            };
+        
+        typedef TTimeIntervalSeconds TDuration;
+
+        /**
+        * Session direction
+        * EDirectionNone In idle there's no direction .
+        * EDirectionMO   Mobile originated sesison
+        * EDirectionMT   Mobile terminated session
+        */
+        enum TDirection 
+            {
+            EDirectionNone,
+            EDirectionMO,
+            EDirectionMT
+            };
+        
+        enum { KCallNameLength = 50 };
+        
+        typedef TBuf<KCallNameLength> TCallName;
+        /**
+        * CLI data related to a call
+        */
+        struct TCLI {
+            // call id of the call
+            TInt iCallId;
+            
+            // caller name
+            TCallName iName;
+            
+            // indicates if voice call can be made to peer
+            TBool iVoiceCallPossible;
+            };
+        
+        /**
+        * Returns session state
+        * @aForcedRefresh if ETrue current state is forced to update.
+        * Should be EFalse when called in frequently because forced
+        * refresh is more time consuming (requires context switch)
+        * @return
+        */
+        virtual TSessionState State( TBool aForcedRefresh ) const = 0;
+
+        /**
+        *
+        * @return direction
+        */
+        virtual TInt GetDirection( TDirection& aDirection ) const = 0;
+
+        /**
+        *
+        * @param 
+        * @param aEnabled
+        */
+        virtual TInt GetDuration( 
+            TDuration& aDuration,
+            TBool& aEnabled ) const = 0;
+        
+        
+        virtual TInt GetCLI( TCLI& aCLI ) const = 0;
+    };
+
+
+#endif      // TVTENGSESSIONINFO_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/TVtEngDtmfTone.h	Mon Nov 23 14:47:47 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:  Local and remote video rendering configuration.
+*
+*/
+
+
+
+#ifndef TVTENGDTMFTONE_H
+#define TVTENGDTMFTONE_H
+
+//  INCLUDES
+#include "TVtEngType.h"
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Abstraction for DTMF tone
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class TVtEngDtmfTone : public TVtEngtType
+    {
+    public: // constructor
+
+        /**
+        * C++ constructor
+        */
+        TVtEngDtmfTone( const TChar& aTone );
+
+    public:
+        // Tone
+        TChar iTone;
+    };
+#include "TVtEngDtmfTone.inl"
+
+#endif      // TVTENGDTMFTONE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/Session/TVtEngDtmfTone.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* 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:  Inline methods for TVtEngDtmfTone
+*
+*/
+
+
+
+inline TVtEngDtmfTone::TVtEngDtmfTone( const TChar& aTone )
+: TVtEngtType( EVtEngTypeDtmf ) { iTone = aTone; }
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngDtmfState.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,246 @@
+/*
+* 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:  DTMF state classes.
+*
+*/
+
+
+
+#ifndef CVTENGDTMFSTATE_H
+#define CVTENGDTMFSTATE_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <mvtprotocolhandler.h>
+#include    "TVtEngDtmfTone.h"
+#include    "MVtEngDtmfHandler.h"
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for DTMF states.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfState ) : public CBase
+    {
+    public:
+        /**
+        * C++ constructor.
+        * @param aDtmfHandler 
+        * @param aH324Config H324 configure interface 
+        */
+        CVtEngDtmfState( 
+            MVtEngDtmfHandler& aDtmfHandler,
+            MVtH324ConfigCommand& aH324Config );
+
+    public: // new methods
+
+        /**
+        * Sends a DTMF tone. Derived classes implement this
+        * and each vary in behavior.
+        * @param aTone tone to send
+        */
+        virtual void SendDtmfL( const TVtEngDtmfTone& aTone ) = 0;
+
+        /**
+        * Handles callback about DTMF sending. Releases pv2way dtmf instance.
+        * @param aError Symbian OS error code
+        */
+        virtual void DtmfSendCompleteL( TInt aError );
+
+    protected: // new methods
+        /**
+        * Sends tone and changes state
+        * @param aDtmf tone to send
+        * @param aNewState new DTMF state
+        */
+        void DoSendAndActivateStateL( 
+            const TVtEngDtmfTone& aDtmf,
+            MVtEngDtmfHandler::TVtEngDtmfState aNewState );
+
+    protected: // member data
+
+        // DTMF handler
+        MVtEngDtmfHandler& iDtmfHandler;
+
+        // H324 configure interface
+        MVtH324ConfigCommand& iH324Config;
+    };
+
+/**
+*  Idle DTMF state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfIdle ) : public CVtEngDtmfState
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aDtmfHandler 
+        * @param aH324Config H324 configure interface
+        */
+        static CVtEngDtmfState* NewL( 
+            MVtEngDtmfHandler& aDtmfHandler,
+            MVtH324ConfigCommand& aH324Config );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngDtmfIdle();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Sends DTMF tone and changes state to "sending".
+        * @param aTone tone to send
+        */
+        virtual void SendDtmfL( const TVtEngDtmfTone& aTone );
+
+        /**
+        * @see CVtEngDtmfState
+        */
+        virtual void DtmfSendCompleteL( TInt aError );
+
+    private: // constructors
+
+        /**
+        * C++ constructor.
+        * @param aDtmfHandler 
+        * @param aH324Config H324 configure interface
+        */
+        CVtEngDtmfIdle( 
+            MVtEngDtmfHandler& aDtmfHandler,
+            MVtH324ConfigCommand& aH324Config );
+    };
+
+/**
+*  Sending DTMF state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfSending ) : public CVtEngDtmfState
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aDtmfHandler 
+        * @param aH324Config H324 configure interface
+        */
+        static CVtEngDtmfState* NewL( 
+            MVtEngDtmfHandler& aDtmfHandler,
+            MVtH324ConfigCommand& aH324Config );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngDtmfSending();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Changes state to "buffered".
+        * @param aTone tone to send
+        */
+        virtual void SendDtmfL( const TVtEngDtmfTone& aTone );
+
+        /**
+        * @see CVtEngDtmfState
+        */
+        virtual void DtmfSendCompleteL( TInt aError );
+
+    private: // constructor
+
+        /**
+        * C++ constructor.
+        * @param aDtmfHandler 
+        * @param aH324Config 
+        */
+        CVtEngDtmfSending( 
+            MVtEngDtmfHandler& aDtmfHandler,
+            MVtH324ConfigCommand& aH324Config );
+
+    };
+
+/**
+*  Buffered DTMF state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngDtmfBuffered ) : public CVtEngDtmfState
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aDtmfHandler 
+        * @param aH324Config H324 configure interface 
+        */
+        static CVtEngDtmfState* NewL( 
+            MVtEngDtmfHandler& aDtmfHandler,
+            MVtH324ConfigCommand& aH324Config );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngDtmfBuffered();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Buffers DTMF tone that is sent when previous
+        * tones in buffer are sent.
+        * @param aTone tone that is added to the buffer
+        */
+        virtual void SendDtmfL( const TVtEngDtmfTone& aTone );
+
+        /**
+        * @see CVtEngDtmfState
+        */
+        virtual void DtmfSendCompleteL( TInt aError );
+
+    private: // constructors
+
+        /**
+        * C++ constructor.
+        * @param aDtmfHandler 
+        * @param aH324Config 
+        */
+        CVtEngDtmfBuffered( 
+            MVtEngDtmfHandler& aDtmfHandler,
+            MVtH324ConfigCommand& aH324Config );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Member data
+
+        // Buffered DTMF tones.
+        CArrayFixFlat<TVtEngDtmfTone>* iTones;
+    };
+
+#endif      // CVTENGDTMFSTATE_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateAlerting.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* 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:  Base class for states
+*
+*/
+
+
+
+#ifndef CVTENGSTATEALERTING_H
+#define CVTENGSTATEALERTING_H
+
+//  INCLUDES
+#include "CVtEngStateBase.h"
+//#include <?include_file>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+*  Alerting state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateAlerting ) : public CVtEngStateBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateAlerting( 
+            CVtEngStateManager& aStateManager,
+            CVtEngEventManager& aEventManager );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateAlerting();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Updates state. May result to state transition
+        */
+        virtual void UpdateL();
+
+        /**
+        * Validates a command.
+        */
+        virtual TBool ValidateCommand(
+            const TVtEngCommandId aCommandId );
+
+        /**
+        * @see CVtEngStateBase
+        */
+        virtual MVtEngSessionInfo::TSessionState State() const;
+
+        /**
+        *
+        */
+        virtual TBool HandleL( CVtEngOperation& aOp );
+
+    private:
+
+        /**
+        * Handles state transition to alerting.
+        */
+        void DoOpenL();
+
+
+        
+    };
+
+#endif      // CVTENGSTATEALERTING_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateBase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,190 @@
+/*
+* 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:  Base class for states
+*
+*/
+
+
+
+#ifndef CVTENGSTATEBASE_H
+#define CVTENGSTATEBASE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+#include "CVtEngStateManager.h"
+#include "CVtEngEventManager.h"
+#include "CVtEngMediaHandler.h"
+#include "CVtEngSessionHandler.h"
+#include "CVtEngOperation.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+
+// FORWARD DECLARATIONS
+class CVtEngSessionHandler;
+class CVtEngMediaHandler;
+class CVtEngAudioHandler;
+
+// CLASS DECLARATION
+
+/**
+*  State base class
+
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateBase ) : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateBase();
+
+    public: // New functions
+        
+        /**
+        * Updates state. May result to state transition
+        */
+        virtual void UpdateL() = 0;
+
+        /**
+        * Checks if a command is valid in current state.
+        * @param aCommandId command to be validated
+        * @return ETrue if command is valid.
+        */
+        virtual TBool ValidateCommand(
+            const TVtEngCommandId aCommandId );
+
+        /**
+        * Handles an operation. Base class method is empty
+        * and derived classes may handle the operation if applicable.
+        * @param aOp operation to be handled
+        * @return ETrue if handled
+        */
+        virtual TBool HandleL( CVtEngOperation& aOp );
+
+        /**
+        * Returns session handler.
+        * @return reference to session handler
+        */
+        CVtEngSessionHandler& SessionHandler();
+
+        /**
+        * Returns media handler.
+        * @return reference to media handler
+        */
+        CVtEngMediaHandler& MediaHandler();
+
+        /**
+        * Returns audio handler.
+        * @return reference to audio handler
+        */
+        CVtEngAudioHandler& AudioHandler();
+
+        /**
+        * Creates new state if needed.
+        * @return new state or NULL
+        */
+        CVtEngStateBase* NewStateL( 
+            const MVtEngSessionInfo::TSessionState aState );
+
+        virtual MVtEngSessionInfo::TSessionState State() const = 0;
+
+    public: // New functions 
+
+        /**
+        * Sets new current state. 
+        * @param aOldState old state.
+        */
+        void OpenL( CVtEngStateBase* aOldState );
+
+        /**
+        * For derived classes to handle state change
+        */
+        virtual void DoOpenL( ) = 0;
+
+        
+        /**
+        * State uninitialization.
+        */
+        virtual void Close();
+
+    protected: // new functions
+
+        /**
+        * Saves configuration to settings for later
+        * usage.
+        */
+        void SaveToSettingsL( CVtEngOperation& aOp );
+
+        /**
+        * Notifies state change to event manager.
+        * @param aNewState new session state.
+        */
+        void NotifyStateChange( MVtEngSessionInfo::TSessionState aNewState );
+
+        /**
+        * Saves video state to settings. Used e.g. when video can not be 
+        * started in current state.
+        * @param aEnabled video is enabled
+        */
+        void SetVideoEnabled( TBool aEnabled );
+
+        /**
+        * Goes to disconnecting or idle state if needed.
+        * @return state object if transition is required.
+        */
+        //CVtEngStateBase* DisconnectingOrIdleStateL();
+
+        /**
+        * Creates negotiating state if bearer state is connected
+        * and pv state is ESetup, and UI has indicated state changte
+        * is permitted.
+        * @return negotiating state object or NULL
+        */
+        CVtEngStateBase* NegotiatingOrConnectedStateL( 
+            TBool aAcceptOnlyNegotiating = EFalse );
+
+
+        /**
+        * Saves video state to settings. Used e.g. when video can not be 
+        * started in current state.
+        * @param aEnabled video is enabled
+        */
+        void TerminateSessionL( CVtEngOperation& aOp );
+
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateBase( 
+            CVtEngStateManager& aStateManager,
+            CVtEngEventManager& aEventManager );
+
+    protected:  // Data
+        // State manager
+        CVtEngStateManager& iStateManager;
+
+        // Event manager
+        CVtEngEventManager& iEventManager;
+
+    private:
+    };
+
+#endif      // CVTENGSTATEBASE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateClearing.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* 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:  Clearing state
+*
+*/
+
+
+
+#ifndef CVTENGSTATECLEARING_H
+#define CVTENGSTATECLEARING_H
+
+//  INCLUDES
+
+#include "CVtEngStateBase.h"
+
+/**
+*  Clearing state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateClearing ) : public CVtEngStateBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateClearing( 
+            CVtEngStateManager& aStateManager,
+            CVtEngEventManager& aEventManager );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateClearing();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Updates state. May result to state transition
+        */
+        virtual void UpdateL();
+
+        /**
+        * Validates a command.
+        */
+        TBool ValidateCommand(
+            const TVtEngCommandId aCommandId );
+
+        /**
+        * @see CVtEngStateBase
+        */
+        virtual MVtEngSessionInfo::TSessionState State() const;
+
+        /**
+        * @see CVtEngStateBase::HandleL
+        */
+        TBool HandleL( CVtEngOperation& aOp );
+
+    private:
+
+        /**
+        * Handles state transition to clearing.
+        */
+        void DoOpenL();
+
+    };
+
+#endif      // CVTENGSTATECLEARING_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateConnected.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* 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:  Base class for states
+*
+*/
+
+
+
+#ifndef CVTENGSTATECONNECTED_H
+#define CVTENGSTATECONNECTED_H
+
+//  INCLUDES
+#include "CVtEngStateBase.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Clearing state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateConnected ) : public CVtEngStateBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateConnected( 
+            CVtEngStateManager& aStateManager,
+            CVtEngEventManager& aEventManager );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateConnected();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Updates state. May result to state transition
+        */
+        virtual void UpdateL();
+
+        /**
+        * Validates a command.
+        */
+        TBool ValidateCommand(
+            const TVtEngCommandId aCommandId );
+
+        /**
+        * @see CVtEngStateBase
+        */
+        virtual MVtEngSessionInfo::TSessionState State() const;
+
+        /**
+        * @see CVtEngStateBase::HandleL
+        */
+        TBool HandleL( CVtEngOperation& aOp );
+
+    private:
+
+        /**
+        * Handles state transition to connected.
+        */
+        void DoOpenL();
+
+    };
+
+#endif      // CVTENGSTATECONNECTED_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateIdle.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* 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:  Idle state
+*
+*/
+
+
+
+#ifndef CVTENGSTATEIDLE_H
+#define CVTENGSTATEIDLE_H
+
+//  INCLUDES
+#include "CVtEngStateBase.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+*  Idle state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateIdle ) : public CVtEngStateBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateIdle( 
+            CVtEngStateManager& aStateManager,
+            CVtEngEventManager& aEventManager );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateIdle();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Updates state. May result to state transition
+        */
+        virtual void UpdateL();
+
+        /**
+        * Validates a command.
+        */
+        TBool ValidateCommand(
+            const TVtEngCommandId aCommandId );
+
+        /**
+        * @see CVtEngStateBase
+        */
+        virtual MVtEngSessionInfo::TSessionState State() const;
+
+    private:
+
+        /**
+        * Handles state transition to idle.
+        */
+        void DoOpenL();
+
+    };
+
+#endif      // CVTENGSTATEIDLE_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateInitializing.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* 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:  Initializing state
+*
+*/
+
+
+
+#ifndef CVTENGSTATEINITIALIZING_H
+#define CVTENGSTATEINITIALIZING_H
+
+//  INCLUDES
+#include "CVtEngStateBase.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+*  Initializing state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateInitializing ): public CVtEngStateBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateInitializing( 
+            CVtEngStateManager& aStateManager,
+            CVtEngEventManager& aEventManager );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateInitializing();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Updates state. May result to state transition
+        */
+        virtual void UpdateL();
+
+        /**
+        * Validates a command.
+        */
+        TBool ValidateCommand(
+            const TVtEngCommandId aCommandId );
+
+        /**
+        * @see CVtEngStateBase
+        */
+        virtual MVtEngSessionInfo::TSessionState State() const;
+        
+        /**
+        * @see CVtEngStateBase::HandleL
+        */
+        TBool HandleL( CVtEngOperation& aOp );
+
+    private:
+
+        /**
+        * Handles state transition to initializing.
+        */
+        void DoOpenL();
+    };
+
+#endif      // CVTENGSTATEINITIALIZING_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateManager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,143 @@
+/*
+* 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:  State manager for session and audio routing states.
+*
+*/
+
+
+
+#ifndef CVTENGSTATEMANAGER_H
+#define CVTENGSTATEMANAGER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "vtengcommands.h"
+#include "MVtEngSessionInfo.h"
+// FORWARD DECLARATIONS
+class CVtEngStateBase;
+class CVtEngHandlerContainer;
+class CVtEngEventManager;
+class CVtEngOperation;
+
+// CLASS DECLARATION
+
+/**
+*  Owner of engine states. Delegates update request
+*  to active state when requested. Provides method
+*  to enquire command availability in current state.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateManager ): public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CVtEngStateManager* NewL(
+            CVtEngHandlerContainer& aHandlers,
+            CVtEngEventManager& aEventManager );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateManager();
+
+    public: // New functions
+        
+        /**
+        * Requests updates for current state.        
+        */
+        void Update( );
+
+        /**
+        * Checks if a command is possible in current state
+        * @param aCommandId command to check
+        * @return ETrue if command can be performed
+        */
+        TBool IsCommandPossible( 
+            const TVtEngCommandId aCommandId ) const;
+
+        /**
+        * Sets new session state.
+        * @param aNewState new session state
+        */
+        void SetState( CVtEngStateBase& aNewState );
+
+        /**
+        * Passes an operation to current state for
+        * handling.
+        * @param aOp operation to be handled
+        * @return ETrue if operation handled
+        */
+        TBool HandleOperationL( CVtEngOperation& aOp );
+
+        /**
+        * Previous session state.
+        */
+        MVtEngSessionInfo::TSessionState PreviousSessionState() const;
+
+        /**
+        * Current session state.
+        */
+        MVtEngSessionInfo::TSessionState SessionState() const;
+
+        /**
+        * Returns handler container.
+        * @return handler container
+        */
+        inline CVtEngHandlerContainer& Handlers();
+
+        /**
+        * Returns event manager.
+        * @return event manager
+        */
+        inline CVtEngEventManager& EventManager();
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateManager( 
+            CVtEngHandlerContainer& aHandlers,
+            CVtEngEventManager& aEventManager );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+        // Previous session state
+        MVtEngSessionInfo::TSessionState iPreviousSessionState;
+
+        // Current session state
+        CVtEngStateBase*        iSessionState;
+         
+        // Handler container
+        CVtEngHandlerContainer& iHandlers;
+
+        // Event manager
+        CVtEngEventManager&     iEventManager;
+
+    };
+
+#include    "CVtEngStateManager.inl"
+
+#endif      // CVTENGSTATEMANAGER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateManager.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* 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:  State manager inline methods.
+*
+*/
+
+
+// MEMBER FUNCTIONS
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::Handlers
+// Return handler container.
+// 
+// -----------------------------------------------------------------------------
+//
+inline CVtEngHandlerContainer& CVtEngStateManager::Handlers() 
+    { return iHandlers; }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::EventManager
+// Return event manager.
+// 
+// -----------------------------------------------------------------------------
+//
+inline CVtEngEventManager& CVtEngStateManager::EventManager() 
+    { return iEventManager; }
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateNegotiating.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* 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:  Negotiating state
+*
+*/
+
+
+
+#ifndef CVTENGSTATENEGOTIATING_H
+#define CVTENGSTATENEGOTIATING_H
+
+//  INCLUDES
+#include "CVtEngStateBase.h"
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+*  Negotiatimg state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateNegotiating ) : public CVtEngStateBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateNegotiating(
+            CVtEngStateManager& aStateManager,
+            CVtEngEventManager& aEventManager );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateNegotiating();
+
+    public: // From CVtEngStateBase
+
+        /**
+        * Updates state. May result to state transition
+        */
+        virtual void UpdateL();
+
+        /**
+        * Validates a command.
+        */
+        TBool ValidateCommand(
+            const TVtEngCommandId aCommandId );
+
+        /**
+        * @see CVtEngStateBase
+        */
+        virtual MVtEngSessionInfo::TSessionState State() const;
+
+        /**
+        * @see CVtEngStateBase
+        */
+        virtual TBool HandleL( CVtEngOperation& aOp );
+
+    private:
+
+        /**
+        * Handles state transition to negotiating.
+        */
+        void DoOpenL();
+
+    };
+
+#endif      // CVTENGSTATENEGOTIATING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateOpen.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* 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:  Open state
+*
+*/
+
+
+
+#ifndef CVTENGSTATEOPEN_H
+#define CVTENGSTATEOPEN_H
+
+//  INCLUDES
+#include "CVtEngStateBase.h"
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+*  Open state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateOpen ) : public CVtEngStateBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateOpen( 
+            CVtEngStateManager& aStateManager,
+            CVtEngEventManager& aEventManager );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateOpen();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Updates state. May result to state transition
+        */
+        virtual void UpdateL();
+
+        /**
+        * Validates a command.
+        */
+        TBool ValidateCommand(
+            const TVtEngCommandId aCommandId );
+
+        /**
+        * @see CVtEngStateBase
+        */
+        virtual MVtEngSessionInfo::TSessionState State() const;
+
+        /**
+        * @see CVtEngStateBase::HandleL
+        */
+        TBool HandleL( CVtEngOperation& aOp );
+        
+    private:
+
+        /**
+        * Changes audio routing
+        * @param aOp audio routing or null if value should
+        *        be read from settings
+        */
+        void RouteAudioL( 
+            CVtEngOperation* aOp );
+        
+        /**
+        * Uses extension framework to complete
+        * from operation.
+        * @since S60 v3.2
+        * @param aOp audio routing or null 
+        */    
+        void CallExtensionL( CVtEngOperation* aOp );    
+
+    private:
+
+        /**
+        * Handles state transition to open.
+        */
+        void DoOpenL();
+
+    };
+
+#endif      // CVTENGSTATEOPEN_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Inc/State/CVtEngStateRinging.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* 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:  Ringing state
+*
+*/
+
+
+
+#ifndef CVTENGSTATERINGING_H
+#define CVTENGSTATERINGING_H
+
+//  INCLUDES
+#include "CVtEngStateBase.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CVtEngStateManager;
+
+// CLASS DECLARATION
+
+/**
+*  Ringing state class
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CVtEngStateRinging ) : public CVtEngStateBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CVtEngStateRinging( 
+            CVtEngStateManager& aStateManager,
+            CVtEngEventManager& aEventManager );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVtEngStateRinging();
+
+    public: // From CVtEngStateBase
+        
+        /**
+        * Updates state. May result to state transition
+        */
+        virtual void UpdateL();
+
+        /**
+        * Validates a command.
+        */
+        TBool ValidateCommand(
+            const TVtEngCommandId aCommandId );
+
+        /**
+        * @see CVtEngStateBase
+        */
+        virtual MVtEngSessionInfo::TSessionState State() const;
+
+    private:
+
+        /**
+        * Handles state transition to ringing.
+        */
+        void DoOpenL();
+
+    };
+
+#endif      // CVTENGSTATERINGING_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Bmarm/VTLOGGERU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,8 @@
+EXPORTS
+	Initialize__9CVtLogger @ 1 NONAME R3UNUSED ; CVtLogger::Initialize(void)
+	Print__9CVtLoggeriG7TPtrC16 @ 2 NONAME ; CVtLogger::Print(int, TPtrC16)
+	Print__9CVtLoggeriG7TPtrC16i @ 3 NONAME ; CVtLogger::Print(int, TPtrC16, int)
+	Print__9CVtLoggeriG7TPtrC16ii @ 4 NONAME ; CVtLogger::Print(int, TPtrC16, int, int)
+	Uninitialize__9CVtLogger @ 5 NONAME R3UNUSED ; CVtLogger::Uninitialize(void)
+	Flags__9CVtLogger @ 6 NONAME R3UNUSED ; CVtLogger::Flags(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Bwins/VTLOGGERU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+	?Initialize@CVtLogger@@SAXXZ @ 1 NONAME ; public: static void __cdecl CVtLogger::Initialize(void)
+	?Print@CVtLogger@@SAXHVTPtrC16@@@Z @ 2 NONAME ; public: static void __cdecl CVtLogger::Print(int,class TPtrC16)
+	?Print@CVtLogger@@SAXHVTPtrC16@@H@Z @ 3 NONAME ; public: static void __cdecl CVtLogger::Print(int,class TPtrC16,int)
+	?Print@CVtLogger@@SAXHVTPtrC16@@HH@Z @ 4 NONAME ; public: static void __cdecl CVtLogger::Print(int,class TPtrC16,int,int)
+	?Uninitialize@CVtLogger@@SAXXZ @ 5 NONAME ; public: static void __cdecl CVtLogger::Uninitialize(void)
+	?Flags@CVtLogger@@SAHXZ @ 6 NONAME ; public: static int __cdecl CVtLogger::Flags(void)
+	?Print@CVtLogger@@SAXHHVTPtrC16@@H@Z @ 7 NONAME ; void CVtLogger::Print(int, int, class TPtrC16, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/EABI/vtloggerU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,11 @@
+EXPORTS
+	_ZN9CVtLogger10InitializeEv @ 1 NONAME
+	_ZN9CVtLogger12UninitializeEv @ 2 NONAME
+	_ZN9CVtLogger5FlagsEv @ 3 NONAME
+	_ZN9CVtLogger5PrintEi7TPtrC16 @ 4 NONAME
+	_ZN9CVtLogger5PrintEi7TPtrC16i @ 5 NONAME
+	_ZN9CVtLogger5PrintEi7TPtrC16ii @ 6 NONAME
+	_ZTI9CVtLogger @ 7 NONAME ; #<TI>#
+	_ZTV9CVtLogger @ 8 NONAME ; #<VT>#
+	_ZN9CVtLogger5PrintEii7TPtrC16i @ 9 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* 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:  Video Telephony logger build information file.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/cvtlogger.h      |../../../inc/cvtlogger.h
+../inc/VtLogger.hrh     |../../../inc/VtLogger.hrh
+
+PRJ_MMPFILES
+../Group/vtlogger.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Group/vtlogger.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* 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:  This is project specification file video telephony logger.
+*
+*/
+
+#include <platform_paths.hrh>
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+TARGET          vtlogger.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x101F8699
+
+SOURCEPATH      ../Src
+
+SOURCE          CVtLogger.cpp
+
+DOCUMENT        ../Group/bld.inf
+
+USERINCLUDE     ../Inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib 
+LIBRARY efsrv.lib
+LIBRARY flogger.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Inc/cvtlogger.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,378 @@
+/*
+* Copyright (c) 2004 - 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 telephony engine debugging support.
+*
+*/
+
+
+
+#ifndef CVTLOGGER_H
+#define CVTLOGGER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <flogger.h>
+#include <f32file.h>
+#include "vtlogger.hrh"
+
+// CONSTANTS
+const TInt KVtDebugBufferSize = 100;
+const TInt KVtDebugReturnValNotApplicable = -1;
+
+// MACROS
+
+#define DEBUG_CONSTRUCT CVtLogger::ELogConstruction
+#define DEBUG_DESTRUCT CVtLogger::ELogDestruction
+#define DEBUG_MEDIA CVtLogger::ELogMedia
+#define DEBUG_AUDIO CVtLogger::ELogAudio
+#define DEBUG_SESSION CVtLogger::ELogSession
+#define DEBUG_DETAIL CVtLogger::ELogDetails
+#define DEBUG_ALL CVtLogger::ELogLogEverything
+#define DEBUG_GEN CVtLogger::ELogGeneric
+#define DEBUG_RETURN CVtLogger::ELogReturn
+
+#define DEBUG_FLAG1 CVtLogger::ELogApp1
+#define DEBUG_FLAG2 CVtLogger::ELogApp2
+#define DEBUG_FLAG3 CVtLogger::ELogApp3
+#define DEBUG_FLAG4 CVtLogger::ELogApp4
+
+#if defined(VTDEBUG) && defined(__CS_VIDEO_TELEPHONY)
+/**
+* Write a text buffer to log.
+*/
+#define __VTPRINT(level,x) CVtLogger::Print(level, _L(x));
+
+/**
+* Write a text buffer and integer value to log.
+*/
+#define __VTPRINT2(level,x,y) CVtLogger::Print(level, _L(x), y);
+
+/**
+* Write a text buffer and two integer values to log.
+*/
+#define __VTPRINT3(level,x,y,z) CVtLogger::Print(level, _L(x), y, z);
+
+#define __VTPRINTENTER(x) CVtLogger::Print( CVtLogger::ELogGeneric, ETrue, _L(x));
+
+#define __VTPRINTEXIT(x) CVtLogger::Print( CVtLogger::ELogGeneric, EFalse, _L(x) );
+
+#define __VTPRINTEXITR(x,y) CVtLogger::Print( CVtLogger::ELogGeneric, EFalse, _L(x), y );
+
+/**
+* Initialize VT logging, must be called before any __VTPRINT's are called.
+*/
+#define VTLOGINIT CVtLogger::Initialize();
+
+/**
+* Uninitializes VT logging, must be called client using logging is deleted.
+*/
+#define VTLOGUNINIT CVtLogger::Uninitialize();
+
+/**
+* Returns logging and configuration flags
+*/
+#define VTFLAGS CVtLogger::Flags();
+
+/**
+* check if baseband loopback is enabled
+*/
+#define DEBUG_CFG_BB_LOOPBACK ( CVtLogger::Flags() & CVtLogger::ECfgBBLoopbackEnabled )
+
+/**
+* check if PV engine loopback is enabled
+*/
+#define DEBUG_CFG_PV_LOOPBACK ( CVtLogger::Flags() & CVtLogger::ECfgPVLoopbackEnabled )
+
+/**
+* Disables passing of audio source to PV
+*/
+#define DEBUG_CFG_NO_AUDIO_SOURCE ( CVtLogger::Flags() & CVtLogger::ECfgNoAudioSource )
+
+/**
+* Disables passing of audio source to PV
+*/
+#define DEBUG_CFG_NO_AUDIO_SINK ( CVtLogger::Flags() & CVtLogger::ECfgNoAudioSink )
+
+/**
+* Disables passing of video sink to PV
+*/
+#define DEBUG_CFG_NO_VIDEO_SINK ( CVtLogger::Flags() & CVtLogger::ECfgNoVideoSink )
+
+/**
+* Disables passing of video source to PV
+*/
+#define DEBUG_CFG_NO_VIDEO_SOURCE ( CVtLogger::Flags() & CVtLogger::ECfgNoVideoSource )
+
+#else
+
+/**
+* Disables VT Debug mode if __CS_VIDEO_TELEPHONY is undefined
+*/
+#undef VTDEBUG
+
+#define __VTPRINT(level,x) 
+#define __VTPRINT2(level,x,y) 
+#define __VTPRINT3(level,x,y,z) 
+#define __VTPRINTENTER(x)
+#define __VTPRINTEXIT(x)
+#define __VTPRINTEXITR(x,y)
+#define VTLOGINIT
+#define VTLOGUNINIT
+#define VTFLAGS 0
+#define DEBUG_CFG_BB_LOOPBACK 0
+#define DEBUG_CFG_PV_LOOPBACK 0
+#define DEBUG_CFG_NO_AUDIO_SINK 0
+#define DEBUG_CFG_NO_AUDIO_SOURCE 0
+#define DEBUG_CFG_NO_VIDEO_SINK 0
+#define DEBUG_CFG_NO_VIDEO_SOURCE 0
+
+#endif // VTDEBUG
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+*  Debbuging support.
+*  To enable logging (either with RDebug or RFileLogger) follow steps below:
+*  1. Create folder c:\Logs\VT
+*  2. Create file VTLOGCONF.txt
+*  3. Open the file and define logging level by hexadecimal digit, 
+*     see TLogLevel in class declaration below. Example: 2007 means that
+*     constructors (0x1), destructors (0x2 ) in media subsystem (0x4) are 
+*     logged to file (0x2000), i.e. the values are bitwise or'ed. Log file
+*     name is "<thread name>.txt" where <thread name> is name of the thread
+*     where logging takes places.
+*
+*  @lib videoteleng
+*  @since 2.6
+*/
+class CVtLogger : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CVtLogger* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVtLogger();
+
+    public: // New functions
+        
+        /**
+        * Writes to log file or RDebug.
+        * @param aDes text output
+        */
+        virtual void Print( TDesC& aDes );
+
+        /**
+        * Log level defining logging behavior.
+        */
+        enum TLogLevel {
+            // Constructors are logged
+            ELogConstruction  = 0x00000001,
+            // Destructors are logged
+            ELogDestruction   = 0x00000002,
+            // Media subsystem methods are logged
+            ELogMedia         = 0x00000004,
+            // Session subsystem methods are logged
+            ELogSession       = 0x00000008,
+            // Audio subsystem methods are logged
+            ELogAudio         = 0x00000010,
+            // Details in methods are logged
+            ELogDetails       = 0x00000020,
+            // Generic framework methods are logged
+            ELogGeneric       = 0x00000040,
+            // Log return from function
+            ELogReturn        = 0x00000080,
+            // Everything is logged, as if all above were set.
+            ELogLogEverything = 0x0000007F,
+            // Insert time at the beginning of each log entry
+            // For file logging time is always written because
+            // it is automatically done by RFileLogger.
+            ELogTime          = 0x00001000,
+            // Log to file instead of using RDebug
+            ELogToFile        = 0x00002000,
+            // Application specific flag 1
+            ELogApp1          = 0x00004000,
+            // Application specific flag 2
+            ELogApp2          = 0x00008000,
+            // Application specific flag 3
+            ELogApp3          = 0x00010000,
+            // Application specific flag 4
+            ELogApp4          = 0x00020000,
+
+            // Configuration flags
+
+            /** Loopback configuration (set only
+            *   one of the following flags
+            */
+            // Baseband loopback enabled
+            ECfgBBLoopbackEnabled = 0x00100000,
+            // PV Engine loopback enabled
+            ECfgPVLoopbackEnabled = 0x00200000,
+
+            // Disable passing of audio source
+            ECfgNoAudioSink       = 0x00400000,
+
+            // Disable passing of audio sink
+            ECfgNoAudioSource     = 0x00800000,
+
+            // Disable passing of video source
+            ECfgNoVideoSource     = 0x01000000,
+
+            // Disable passing of video sink
+            ECfgNoVideoSink      = 0x02000000
+            };
+
+        /**
+        * Writes buffer to log.
+        * @param aLevel combination of TLogLevel values
+        * @param aBuffer buffer to log
+        */
+        IMPORT_C static void Print( 
+            TInt aLevel, 
+            TPtrC aBuffer );
+
+        /**
+        * Writes buffer to log.
+        * @param aLevel combination of TLogLevel values
+        * @param aBuffer buffer to log
+        * @param aValue value appended to buffer
+        */
+        IMPORT_C static void Print( 
+            TInt aLevel, 
+            TPtrC aBuffer, 
+            TInt aValue );
+        
+        /**
+        * Writes buffer to log.
+        * @param aLevel combination of TLogLevel values
+        * @param aBuffer buffer to log
+        * @param aValue1 first value appended to buffer
+        * @param aValue2 second value appended to buffer
+        */
+        IMPORT_C static void Print( 
+            TInt aLevel, 
+            TPtrC aBuffer, 
+            TInt aValue1,
+            TInt aValue2 );
+
+        /**
+        * Writes buffer to log. This overloaded method is used
+        * for printing entry or exit from a function.
+        * @since Series60 2.8
+        * @param aLevel combination of TLogLevel values
+        * @param aEntry if ETrue "<" is appended to end of string
+        *               if EFalse ">" is appended to end of string
+        * @param aBuffer buffer to log
+        * @param aRetVal return value of the function. If this value
+        * is present (i.e. other than KVtDebugReturnValNotApplicable
+        * is passed) then aBuffer should include format tag '%d' where
+        * aRetValue should be placed.
+        */
+        IMPORT_C static void Print(
+            TInt aLevel,
+            const TBool aEntry,
+            TPtrC aBuffer,
+            TInt aRetVal = KVtDebugReturnValNotApplicable );
+            
+        /**
+        * Initializes logging. This must be called before
+        * any use of __VTPRINT macros.
+        */
+        IMPORT_C static void Initialize();
+
+        /**
+        * Uninitializes logging. This must be called when
+        * client of logging service is deleted.
+        */
+        IMPORT_C static void Uninitialize();
+
+        /**
+        * Returns flags in configuration file
+        * @return flags
+        */
+        IMPORT_C static TInt Flags();
+
+    private:
+    
+        /**
+        * Returns logger.
+        * @return logger
+        */
+        static CVtLogger* Logger();
+
+        /**
+        * Returns if certain log levels are set.
+        * @param aLevels bitmap of TLogLevel values
+        * @return ETrue if all aLevels are set.
+        */
+        TBool CheckLevels( TInt aLevels ) const;
+
+        /**
+        * Reads configuration file and starts
+        * monitoring changes on it.
+        */
+        void ReadCongigFile();
+
+    private: // from CActive
+        
+        /**
+        * Handles file change notification
+        */
+        void RunL();
+
+        /**
+        * Cancels monitoring file change
+        */
+        void DoCancel();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVtLogger();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( );
+
+    private:    // Data        
+    
+        // Buffer size for printed lines
+        enum 
+            {
+            ETempBufLength = 80
+            };
+            
+        TFileName               iFileName;
+        RFs                     iFs;
+        TInt                    iLogLevel;
+        TInt                    iAccessCount;
+        TBuf<ETempBufLength>    iBuffer;
+        TBuf<ETempBufLength>    iTempBuf;
+    };
+
+
+#endif      // CVTLOGGER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Inc/vtlogger.hrh	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* 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:  Defines when logger is enabled.
+*
+*/
+
+
+#ifndef VTLOGGER_HRH
+#define VTLOGGER_HRH
+
+// DATA TYPES
+// MACROS
+
+#if defined(_DEBUG)
+/**
+* Debugging enabled always in debug builds
+*/
+#define VTDEBUG
+
+#endif
+
+#endif // VTLOGGER_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Src/CVtLogger.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,371 @@
+/*
+* Copyright (c) 2004 - 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 telephony logger
+*
+*/
+
+
+#pragma CTC SKIP
+// INCLUDE FILES
+#include    "cvtlogger.h"
+
+
+// LOCAL CONSTANTS
+_LIT( KVtEngLogConfig, "c:\\Logs\\VT\\VTLOGCONF.txt" );
+_LIT( KVtEngLogFolder, "c:\\Logs\\VT" );
+_LIT( KVtEngLogFolderLogger, "VT" );
+_LIT( KVtEngLogPrefix, "VT: " );
+_LIT( KVtEngLogExtension, ".txt" );
+_LIT( KVtLoggerEnterFunc, "<" );
+_LIT( KVtLoggerExitFunc, ">" );
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtLogger::CVtLogger
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtLogger::CVtLogger() : CActive( CActive::EPriorityStandard - 1 ),
+    iLogLevel( ELogLogEverything )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtLogger::ConstructL( )
+    {
+    User::LeaveIfError( iFs.Connect() );
+    TFindFile find( iFs );
+    TUint logLevel( 0 );
+    TInt ret = iFs.Att(KVtEngLogFolder, logLevel );
+    if ( ret == KErrNone )
+        {
+        if ( find.FindByPath( KVtEngLogConfig, NULL ) == KErrNone )
+            {
+            CActiveScheduler::Add( this );
+            ReadCongigFile();
+            }
+        if ( iLogLevel & ELogToFile )
+            {
+            RThread thread;
+            iFileName.Copy( thread.Name() );
+            iFileName.Append( KVtEngLogExtension );
+            }
+        }
+    Dll::SetTls( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtLogger* CVtLogger::NewL( )
+    {
+    CVtLogger* self = new( ELeave ) CVtLogger;
+
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::~CVtLogger
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVtLogger::~CVtLogger()
+    {
+    Cancel();
+    iFs.Close();
+    Dll::SetTls( NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+void CVtLogger::Print( TDesC& aDes )
+    {
+    if ( iLogLevel & ELogTime && !(iLogLevel & ELogToFile) )
+        {
+        TTime time;
+        time.HomeTime();
+        const TDateTime dt= time.DateTime();
+
+        iTempBuf.Zero();
+        iTempBuf.AppendNum( dt.Minute() );
+        iTempBuf.Append(':');
+        iTempBuf.AppendNum( dt.Second() );
+        iTempBuf.Append(':');
+        iTempBuf.AppendNum( dt.MicroSecond() );
+        iTempBuf.Append(' ');
+
+        const TInt currentLength( iTempBuf.Length() );
+
+        iTempBuf.Append( aDes.Left( Min( iTempBuf.MaxLength() - currentLength, aDes.Length() ) ) );
+        RDebug::Print( iTempBuf );
+        }
+    else
+        {
+        if ( iLogLevel & ELogToFile )
+            {
+            RFileLogger::Write(
+                KVtEngLogFolderLogger,
+                iFileName,
+                EFileLoggingModeAppend,
+                aDes );
+            }
+        else
+            {
+            RDebug::Print( aDes );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+    TInt aLevel,
+    TPtrC aBuffer )
+    {
+    CVtLogger* logger = CVtLogger::Logger();
+    if ( logger && logger->CheckLevels( aLevel ) )
+        {
+        logger->iBuffer.Copy( KVtEngLogPrefix );
+        logger->iBuffer.Append( aBuffer);
+        logger->Print( logger->iBuffer );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+    TInt aLevel,
+    TPtrC aBuffer,
+    TInt aValue )
+    {
+    CVtLogger* logger = CVtLogger::Logger();
+    if ( logger && logger->CheckLevels( aLevel ) )
+        {
+        logger->iBuffer.Zero();
+        logger->iBuffer.AppendNum( aValue );
+        logger->iBuffer.Format( aBuffer, aValue );
+        logger->iBuffer.Insert( 0, KVtEngLogPrefix );
+        logger->Print( logger->iBuffer );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+    TInt aLevel,
+    TPtrC aBuffer,
+    TInt aValue1,
+    TInt aValue2 )
+    {
+    CVtLogger* logger = CVtLogger::Logger();
+    if ( logger && logger->CheckLevels( aLevel ) )
+        {
+        logger->iBuffer.Format( aBuffer, aValue1, aValue2 );
+        logger->iBuffer.Insert( 0, KVtEngLogPrefix );
+        logger->Print( logger->iBuffer );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Writes to log.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print(
+            TInt aLevel,
+            const TBool aEntry,
+            TPtrC aBuffer,
+            TInt aRetVal )
+    {
+    CVtLogger* logger = CVtLogger::Logger();
+    if ( logger && logger->CheckLevels( aLevel ) )
+        {
+        logger->iBuffer.Copy( KVtEngLogPrefix );
+        if ( aEntry )
+            {
+            logger->iBuffer.Append( aBuffer );
+            logger->iBuffer.Append( KVtLoggerEnterFunc );
+            }
+        else
+            {
+            if ( aRetVal != KVtDebugReturnValNotApplicable )
+                {
+                logger->iTempBuf.Format( aBuffer, aRetVal );
+                logger->iBuffer.Append( logger->iTempBuf );
+                }
+            else
+                {
+                logger->iBuffer.Append( aBuffer );
+                }
+            logger->iBuffer.Append( KVtLoggerExitFunc );
+            }
+        logger->Print( logger->iBuffer );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Logger
+// Returns logger.
+// -----------------------------------------------------------------------------
+//
+CVtLogger* CVtLogger::Logger()
+    {
+    TAny* tls = Dll::Tls();
+    if ( tls )
+        {
+        return reinterpret_cast<CVtLogger*>( tls );
+        }
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Initialize
+// Initialize logger.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Initialize()
+    {
+    CVtLogger* logger = NULL;
+    if ( Dll::Tls() == NULL )
+        {
+        TRAPD( err, logger = CVtLogger::NewL() );
+        if ( err == KErrNone )
+            {
+            Dll::SetTls( logger );
+            }
+        }
+    else
+        {
+        logger = CVtLogger::Logger();
+        }
+    if ( logger )
+        {
+        (logger->iAccessCount)++;
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Uninitialize
+// Uninitialize logger.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Uninitialize()
+    {
+    TAny* tls = Dll::Tls();
+    if ( tls )
+        {
+        CVtLogger* logger = CVtLogger::Logger();
+        TInt count( --(logger->iAccessCount) );
+        if ( !count )
+            {
+            delete reinterpret_cast<CVtLogger*>( tls );
+            Dll::SetTls( NULL );
+            }
+        }
+
+    }
+
+void CVtLogger::ReadCongigFile()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L(" VT: ReadConfigFile" ) );
+#endif
+    RFile config;
+    if ( config.Open( iFs, KVtEngLogConfig, EFileShareAny ) == KErrNone )
+        {
+        TBuf8<16> buf;
+        if ( config.Read( buf ) == KErrNone )
+            {
+            TLex8 lex( buf );
+            TUint logLevel( 0 );
+            if ( lex.Val( logLevel, EHex ) == KErrNone )
+                {
+                iLogLevel = logLevel;
+                }
+            }
+        config.Close();
+        }
+    iFs.NotifyChange( ENotifyEntry, iStatus, KVtEngLogConfig() );
+    SetActive();
+    }
+
+void CVtLogger::RunL()
+    {
+    if ( iStatus == KErrNone )
+        {
+        ReadCongigFile();
+        }
+    }
+
+void CVtLogger::DoCancel()
+    {
+    iFs.NotifyChangeCancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Flags
+// Returns flags.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CVtLogger::Flags()
+    {
+    CVtLogger* logger = CVtLogger::Logger();
+    if ( logger )
+        {
+        return logger->iLogLevel;
+        }
+    return KErrGeneral;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::CheckLevels
+// Check debug level.
+// -----------------------------------------------------------------------------
+//
+TBool CVtLogger::CheckLevels( TInt aLevels ) const
+    {
+    if ( aLevels & iLogLevel )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+#pragma CTC ENDSKIP
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Logger/Src/CVtLoggerStub.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* 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:  Video telephony logger stub
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtLogger.h"
+#include    <f32file.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtLogger::CVtLogger
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtLogger::CVtLogger()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtLogger::ConstructL( )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtLogger* CVtLogger::NewL( )
+    {
+    return NULL;
+    }
+
+// Destructor
+CVtLogger::~CVtLogger()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Prints to log.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtLogger::Print( TDesC& )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Prints to log.
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print( 
+    TInt , 
+    TDesC&  )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Prints to log.
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print( 
+    TInt , 
+    TDesC& , 
+    TInt )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::Print
+// Prints to log.
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVtLogger::Print( 
+    TInt , 
+    TDesC& , 
+    TInt ,
+    TInt )
+    {    
+    }
+
+CVtLogger* CVtLogger::Logger()
+    {
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtLogger::CheckLevels
+// Check debug level.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtLogger::CheckLevels( TInt aLevels ) const
+    {
+    return EFalse;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Rom/videoteleng.iby	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2004-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
+ *
+*/
+
+ 
+#ifndef __VIDEOTELENG_IBY__
+#define __VIDEOTELENG_IBY__
+
+REM Video telephony engine libraries
+
+#ifdef __CS_VIDEO_TELEPHONY
+file=ABI_DIR\BUILD_DIR\videotelproto.dll   SHARED_LIB_DIR\videotelproto.dll
+file=ABI_DIR\BUILD_DIR\Videoteleng.dll     SHARED_LIB_DIR\Videoteleng.dll
+file=ABI_DIR\BUILD_DIR\cscallctrl.dll      SHARED_LIB_DIR\cscallctrl.dll
+file=ABI_DIR\BUILD_DIR\vtlogger.dll        SHARED_LIB_DIR\vtlogger.dll
+
+// Enabler for eclipsing ROM binaries
+data=ZSYSTEM\install\videoteleng_stub.sis  system\install\videoteleng_stub.sis
+
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Audio/CVtEngAudioHandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,709 @@
+/*
+* 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:  Audio handler implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngAudioHandler.h"
+#include    "CVtEngSettings.h"
+#include    "CVtEngEventManager.h"
+#include    "VtEngUtils.h"
+#include    <cvtlogger.h>
+#include    <featmgr.h>
+#include    <mmf/server/sounddevice.h>
+#include    <audiopreference.h>
+#include    "VtEngUtils.h"
+#include    "CVtEngStateManager.h"
+#include    "MVtEngSessionInfo.h"
+#include    "CVtEngHandlerContainer.h"
+
+// CONSTANTS
+
+// For DevSound initialization
+const TInt KVtEngUidControlHwDevice = 0x10206593;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::CVtEngAudioHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngAudioHandler::CVtEngAudioHandler()
+    {
+    __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.c++" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::ConstructL()
+    {
+    __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.ConstructL" )
+
+    iAccHandler = &CVtEngUtility::AccessoryHandler();
+    iAccHandler->RegisterObserverL( this );
+    iTelephonyAudioRouting = CTelephonyAudioRouting::NewL( *this );
+    iCurrentAudioOutput = iTelephonyAudioRouting->Output();
+
+    // Fetch the mode.
+    User::LeaveIfError( iAccHandler->AccessoryMode( iAccMode ) );
+    __VTPRINT2( DEBUG_AUDIO, "AH.iAccMode %d", ( TInt )iAccMode.iAccessoryMode )
+
+    UpdateCurrentVolume();
+    __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.ConstructL<")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngAudioHandler* CVtEngAudioHandler::NewL()
+    {
+    CVtEngAudioHandler* self = new( ELeave ) CVtEngAudioHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::~CVtEngAudioHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngAudioHandler::~CVtEngAudioHandler()
+    {
+    __VTPRINT( DEBUG_AUDIO, "AH.~<" )
+    delete iRoutingEnabler;
+
+    delete iTelephonyAudioRouting;
+    if ( iAccHandler )
+    	{
+    	iAccHandler->RemoveObserver( this );
+    	}
+    __VTPRINT( DEBUG_AUDIO, "AH.~>" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::HandleL
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::HandleL( CVtEngOperation& aOperation )
+    {
+    __VTPRINT2( DEBUG_AUDIO, "AH.HandleL op=%d", ( TInt )iOperation )
+    if ( iOperation )
+        {
+        // While operation is ongoing, another call should not be made.
+        User::Leave( KErrArgument );
+        }
+
+    MVtEngAudio::TVtEngRoutingSetting routeSetting;
+    TVtEngOpParamUtil<MVtEngAudio::TVtEngRoutingSetting>::Set(
+        routeSetting, aOperation );
+
+    switch( routeSetting )
+        {
+        case EActivateHandsfree:
+            SetLoudspeakerL( ETrue, ETrue );
+            break;
+
+        case EDeactivateHansfree:
+            SetLoudspeakerL( EFalse, ETrue );
+            break;
+
+        case EActivateBT:
+            SetBluetoothL( ETrue ); // asynchronous
+            break;
+
+        case EDeactivateBT:
+            SetBluetoothL( EFalse );
+            break;
+        }
+
+    iOperation = &aOperation;
+    __VTPRINT( DEBUG_AUDIO | DEBUG_RETURN, "AH.HandleL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::SetRoutingEnablerL
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::SetRoutingEnablerL( const TBool aEnable )
+    {
+    __VTPRINTENTER( "AHRout.SetRoutingEnablerL" )
+
+    if ( aEnable && !iRoutingEnabler )
+        {
+        // Before connected state audio routing can be changed by the user
+        // only in MO calls. Create temporary devsound only if call is such.
+        const CVtEngHandlerContainer& handlers =
+            CVtEngUtility::StateManager()->Handlers();
+        const MVtEngSessionInfo& session = handlers.Session();
+        MVtEngSessionInfo::TDirection direction =
+            MVtEngSessionInfo::EDirectionNone; // init to MO, if
+        const TInt err( session.GetDirection( direction ) );
+        if ( err == KErrNone && direction == MVtEngSessionInfo::EDirectionMO )
+            {
+            iRoutingEnabler = CRoutingEnabler::NewL();
+            }
+        }
+    else if ( !aEnable )
+        {
+        delete iRoutingEnabler;
+        iRoutingEnabler = NULL;
+        }
+    __VTPRINTEXIT( "AHRout.ReleaseRoutingEnablerL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::IncreaseVolume
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngAudioHandler::IncreaseVolume()
+    {
+    __VTPRINTENTER( "AH.IncreaseVolume" )
+    TBool adjustOk( AdjustVolume( 1 ) );
+    if ( !adjustOk )
+        {
+        // only reason for AdjustVolume to fail is that volume is max already
+        CVtEngEventManager::NotifyEvent( KVtEngAudioVolumeMax );
+        }
+    __VTPRINTEXITR( "AH.IncreaseVolume %d", adjustOk )
+    return adjustOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::DecreaseVolume
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngAudioHandler::DecreaseVolume()
+    {
+    __VTPRINTENTER( "AH.DecreaseVolume" )
+    TBool adjustOk( AdjustVolume( -1 ) );
+    if ( !adjustOk )
+        {
+        // only reason for AdjustVolume to fail is that volume is min already
+        CVtEngEventManager::NotifyEvent( KVtEngAudioVolumeMin );
+        }
+    __VTPRINTEXITR( "AH.DecreaseVolume %d", adjustOk )
+    return adjustOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::AdjustVolume
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngAudioHandler::AdjustVolume( const TInt aDelta )
+    {
+    __VTPRINTENTER( "AH.AdjustVolume" )
+    __VTPRINT2( DEBUG_AUDIO, "AH.AdjustVolume aDelta = %d", aDelta )
+    TBool result( EFalse );
+    CVtEngSettings& settings( CVtEngUtility::Settings() );
+    TVtEngOutputVolume volume;
+    settings.GetVolume( volume.iHandsetVolume, EFalse, EFalse );
+    settings.GetVolume( volume.iHandsfreeVolume, ETrue, EFalse );
+    TAudioRoutingState routingState;
+    GetRoutingState( routingState );
+    TInt& value( ( routingState == EAudioLoudspeaker ) ?
+        volume.iHandsfreeVolume : volume.iHandsetVolume );
+    value += aDelta;
+    TInt validValue( settings.ValidVolume( value ) );
+    if ( validValue == value )
+        {
+        settings.SetVolume(
+            volume.iHandsetVolume,
+            volume.iHandsfreeVolume,
+            ETrue );
+        settings.SetVolume(
+            volume.iHandsetVolume,
+            volume.iHandsfreeVolume,
+            EFalse );
+        result = ETrue;
+        }
+    __VTPRINTEXITR( "AH.AdjustVolume %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::GetRoutingState
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAudioHandler::GetRoutingState(
+        TAudioRoutingState& aAudioRoutingState )
+    {
+    switch ( iCurrentAudioOutput )
+        {
+        // Wired headset has the highest priority.
+        case CTelephonyAudioRouting::EWiredAudioAccessory:
+            __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.GRS.wired" )
+            aAudioRoutingState = EAudioWiredHeadset;
+            break;
+
+        // Then bluetooth handsfree.
+        case CTelephonyAudioRouting::EBTAudioAccessory:
+            __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.GRS.bt" )
+            aAudioRoutingState = EAudioBT;
+            break;
+
+        // Loudspeaker.
+        case CTelephonyAudioRouting::ELoudspeaker:
+            __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.GRS.IHF" )
+            aAudioRoutingState = EAudioLoudspeaker;
+            break;
+
+        // Handset as fallback.
+        default:
+            __VTPRINT( DEBUG_CONSTRUCT | DEBUG_AUDIO, "AH.GRS.Handset" )
+            aAudioRoutingState = EAudioHandset;
+            break;
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::GetRoutingAvailability
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAudioHandler::GetRoutingAvailability(
+        const TAudioRoutingState aAudioRoutingState,
+        TBool& aAvailable )
+    {
+    TAudioRoutingState currentRouting;
+    GetRoutingState( currentRouting ); // always succeeds
+
+    if ( currentRouting == aAudioRoutingState )
+        {
+        // It is possible to route to itself, although it does not make
+        // much sense.
+        aAvailable = ETrue;
+        }
+    else if ( currentRouting == EAudioWiredHeadset )
+        {
+        // For wired headset, audio routings are not possible.
+        aAvailable = EFalse;
+        }
+    else
+        {
+        switch ( aAudioRoutingState )
+            {
+            case EAudioHandset:
+            case EAudioLoudspeaker:
+                // Handset & loudspeaker are always available.
+                aAvailable = ETrue;
+                break;
+
+            case EAudioBT:
+                aAvailable = IsOutputAvailable( CTelephonyAudioRouting::EBTAudioAccessory );
+                break;
+
+            case EAudioWiredHeadset:
+                // Wired headset can not be routed to. When headset is
+                // attached, routing happens automatically.
+                aAvailable = EFalse;
+                break;
+            }
+        }
+
+    __VTPRINT3( DEBUG_AUDIO, "AH.GRA state %d availability=%d",
+        aAudioRoutingState, aAvailable )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::GetHeadsetType
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAudioHandler::GetHeadsetType(
+        TWiredHeadsetType& aHeadsetType )
+    {
+    switch ( iAccMode.iAccessoryMode )
+        {
+        case EAccModeWiredHeadset:
+        case EAccModeWiredCarKit:
+        case EAccModeMusicStand:
+            aHeadsetType = EWiredHeadset;
+            break;
+
+        case EAccModeLoopset:
+            aHeadsetType = EWiredLoopset;
+            break;
+
+        case EAccModeTextDevice:
+            aHeadsetType = EWiredTty;
+            break;
+
+        case EAccModeHandPortable:
+        case EAccModeWirelessHeadset:
+        case EAccModeWirelessCarKit:
+        default:
+            // Not wired headset.
+            aHeadsetType = EWiredNone;
+            break;
+        }
+
+    __VTPRINT2( DEBUG_AUDIO, "AH.HeadsetType=%d", aHeadsetType )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::OutputVolume
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAudioHandler::OutputVolume(
+        const TBool aHandsetVolume ) const
+    {
+    __VTPRINT2( DEBUG_AUDIO, "AH.OutputVolume isHandset=%d", aHandsetVolume )
+    TInt vol = 0;
+    CVtEngSettings& setting = CVtEngUtility::Settings();
+    TInt err( setting.GetVolume( vol, !aHandsetVolume, EFalse ) );
+    if ( err != KErrNone )
+        {
+        vol = err;
+        }
+    __VTPRINT2( DEBUG_AUDIO, "AH.OutputVolume vol=%d",vol )
+    return vol;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::SetLoudspeakerL
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::SetLoudspeakerL( TBool aTurnOn, TBool /*aShowNote*/ )
+    {
+    __VTPRINTENTER(	"AH.SetLoudspeakerL" )
+    __VTPRINT2( DEBUG_AUDIO, "AH.SetLoudspeakerL %d", aTurnOn )
+    TBool available( EFalse );
+    GetRoutingAvailability( EAudioLoudspeaker, available );
+    if ( !available )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    // Set shownote flag up in telephony audiorouting, before calling SetOutputL.
+    User::LeaveIfError( iTelephonyAudioRouting->SetShowNote( ETrue ) );
+
+    if( aTurnOn )
+        {
+        iTelephonyAudioRouting->SetOutputL( CTelephonyAudioRouting::ELoudspeaker );
+        }
+    else
+        {
+        iTelephonyAudioRouting->SetOutputL( CTelephonyAudioRouting::EHandset );
+        }
+    __VTPRINTEXIT( "AH.SetLoudspeakerL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::SetBluetoothL
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::SetBluetoothL( TBool aTurnOn )
+    {
+    __VTPRINTENTER( "AH.SetBluetoothL" )
+    TBool available( EFalse );
+    GetRoutingAvailability( EAudioBT, available );
+    if ( !available )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    // Set shownote flag up in telephony audiorouting, before calling SetOutputL.
+    User::LeaveIfError( iTelephonyAudioRouting->SetShowNote( ETrue ) );
+
+    if( aTurnOn )
+        {
+        iTelephonyAudioRouting->SetOutputL( CTelephonyAudioRouting::EBTAudioAccessory );
+        }
+    else
+        {
+        iTelephonyAudioRouting->SetOutputL( CTelephonyAudioRouting::EHandset );
+        }
+    __VTPRINTEXIT( "AH.SetBluetoothL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::AvailableOutputsChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::AvailableOutputsChanged(
+    CTelephonyAudioRouting& /*aTelephonyAudioRouting*/ )
+    {
+    __VTPRINTENTER( "AH.AvailableOutputsChanged" )
+    CVtEngEventManager::NotifyEvent( KVtEngAudioRoutingAvailabilityChanged );
+    __VTPRINTEXIT( "AH.AvailableOutputsChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::OutputChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::OutputChanged(
+    CTelephonyAudioRouting& aTelephonyAudioRouting )
+    {
+    __VTPRINTENTER( "AH.OutputChanged" )
+    CTelephonyAudioRouting::TAudioOutput
+        previousAudioOutput( iCurrentAudioOutput );
+    iCurrentAudioOutput = aTelephonyAudioRouting.Output();
+    CVtEngEventManager::NotifyEvent( KVtEngAudioRoutingChanged );
+    // HandSet -> IHF
+    if( ( previousAudioOutput == CTelephonyAudioRouting::EHandset ) &&
+        ( iCurrentAudioOutput == CTelephonyAudioRouting::ELoudspeaker ) )
+        {
+        __VTPRINT( DEBUG_AUDIO, "AH.OutputChanged signalling HandSet to IHF" )
+        }
+    // IHF -> HandSet
+    else if( ( previousAudioOutput == CTelephonyAudioRouting::ELoudspeaker ) &&
+        ( iCurrentAudioOutput == CTelephonyAudioRouting::EHandset ) )
+        {
+        __VTPRINT( DEBUG_AUDIO, "AH.OutputChanged signalling IHF to HandSet" )
+        }
+    UpdateCurrentVolume();
+    __VTPRINTEXITR( "AH.OutputChanged %d", iCurrentAudioOutput )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::SetOutputComplete
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::SetOutputComplete(
+    CTelephonyAudioRouting& aTelephonyAudioRouting,
+    TInt aError )
+    {
+    __VTPRINTENTER( "AH.SetOutputComplete" )
+    if ( aError == KErrNone )
+        {
+        OutputChanged( aTelephonyAudioRouting );
+        }
+    CompleteOperation( aError );
+    __VTPRINTEXIT( "AH.SetOutputComplete" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::CompleteOperation
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::CompleteOperation( TInt aResult )
+    {
+    __VTPRINT3( DEBUG_AUDIO, "AH.CompleteOperation op=%d,res=%d" ,
+        ( TInt )iOperation, aResult )
+    if ( iOperation )
+        {
+        iOperation->HandleOpComplete( aResult );
+        iOperation = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::UpdateCurrentVolume
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::UpdateCurrentVolume()
+    {
+    __VTPRINTENTER( "AH.UpdateCurrentVolume" )
+    TAudioRoutingState currentRouting = EAudioHandset;
+    GetRoutingState( currentRouting );
+
+    const TBool currentVolume = ( currentRouting == EAudioLoudspeaker );
+    CVtEngSettings& setting = CVtEngUtility::Settings();
+    setting.SetCurrentVolume( currentVolume );
+
+    __VTPRINTEXITR( "AH.UpdateCurrentVolume output is IHF=%d", currentVolume )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::AccessoryModeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngAudioHandler::AccessoryModeChanged(
+    const TAccMode& aMode, const TBool /* aActivated */ )
+    {
+    iAccMode.iAccessoryMode = aMode;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngAudioHandler::IsOutputAvailable
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngAudioHandler::IsOutputAvailable(
+    const CTelephonyAudioRouting::TAudioOutput aOutput )
+    {
+    const TArray< CTelephonyAudioRouting::TAudioOutput > outputs =
+        iTelephonyAudioRouting->AvailableOutputs();
+
+    for ( TInt i = 0; i < outputs.Count(); i++ )
+        {
+        if ( outputs[ i ] == aOutput )
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::NewL
+// -----------------------------------------------------------------------------
+//
+CRoutingEnabler* CRoutingEnabler::NewL()
+    {
+    CRoutingEnabler* enabler =
+        new ( ELeave ) CRoutingEnabler();
+    CleanupStack::PushL( enabler );
+    enabler->StartL();
+    CleanupStack::Pop( enabler );
+    return enabler;
+    }
+
+// Destructor
+CRoutingEnabler::~CRoutingEnabler()
+    {
+    if ( iDevSound )
+    	{
+        // If initialization ahs been successfull, Devsound Play has started
+        // and need to be stopped.
+        if( !iDevsoundInitializeFailure )
+            {
+            __VTPRINT( DEBUG_MEDIA, "AHRout.~ Stopping audio" )
+    	    iDevSound->Stop();
+            }
+        delete iDevSound;
+    	iDevSound = NULL;
+        }
+    }
+
+// c++ constructor
+CRoutingEnabler::CRoutingEnabler()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::StartL
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::StartL()
+    {
+    __VTPRINTENTER( "AHRout.StartL" )
+    iDevSound = CMMFDevSound::NewL();
+
+    iDevSound->InitializeL(
+        *( this ),
+        EMMFStatePlaying );
+    __VTPRINTEXIT( "AHRout.StartL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::InitializeComplete
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::InitializeComplete( TInt aError )
+    {
+    __VTPRINTENTER( "AHRout.InitializeComplete" )
+    if ( aError == KErrNone )
+        {
+        TMMFPrioritySettings prioritySettings;
+        prioritySettings.iPriority = KAudioPriorityCSCallDownlink;
+        prioritySettings.iPref =
+            ( TMdaPriorityPreference ) KAudioPrefCSCallDownlink;
+        prioritySettings.iState = EMMFStatePlaying;
+        if ( iDevSound )
+            {
+            iDevSound->SetPrioritySettings( prioritySettings );
+
+            TRAPD( err, iDevSound->PlayInitL() );
+            if ( err != KErrNone )
+            	{
+            	__VTPRINT2( DEBUG_AUDIO, "AHRout.InitializeComplete PlayInitL err=%d", err )
+
+                // Devsound PlayInitL leave error happened.
+                iDevsoundInitializeFailure = ETrue;
+            	}
+            }
+        }
+    else
+        {
+        __VTPRINT2( DEBUG_AUDIO, "AHRout.InitializeComplete err=%d", aError )
+
+        // Devsound initialization failed
+        iDevsoundInitializeFailure = ETrue;
+        }
+    __VTPRINTEXIT( "AHRout.InitializeComplete" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::ToneFinished
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::ToneFinished( TInt /*aError*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::BufferToBeFilled
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::BufferToBeFilled(
+    CMMFBuffer* /*aBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::PlayError
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::PlayError( TInt /*aError*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::BufferToBeEmptied
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::BufferToBeEmptied(
+    CMMFBuffer* /*aBuffer*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::RecordError
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::RecordError(
+    TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::ConvertError
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::ConvertError( TInt /*aError*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRoutingEnabler::DeviceMessage
+// -----------------------------------------------------------------------------
+//
+void CRoutingEnabler::DeviceMessage(
+    TUid /*aMessageType*/, const TDesC8& /*aMsg*/ )
+    {
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngAccessoryHandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2004-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:  Accessory listener.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngAccessoryHandler.h"
+#include    "MVtEngAccessoryObserver.h"
+#include    <cvtlogger.h>
+                                                                 
+// CONSTANTS
+const TInt KVtEngAccObserverGranularity = 1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::CVtEngAccessoryHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngAccessoryHandler::CVtEngAccessoryHandler() : 
+    CActive( CActive::EPriorityStandard ),
+    iAccessoryObservers( KVtEngAccObserverGranularity )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::ConstructL()
+    {
+    User::LeaveIfError( iAccessoryServer.Connect() );
+    User::LeaveIfError( iAccessoryMode.CreateSubSession( iAccessoryServer ) );
+    StartListening();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngAccessoryHandler* CVtEngAccessoryHandler::NewL( )
+    {
+    __VTPRINTENTER( "AccHdr.NewL" )
+    CVtEngAccessoryHandler* self = new( ELeave ) CVtEngAccessoryHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "AccHdr.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::~CVtEngAccessoryHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngAccessoryHandler::~CVtEngAccessoryHandler()
+    {
+    __VTPRINTENTER( "AccHdr.~" )
+    Cancel();
+    RemoveAllObservers();
+    iAccessoryMode.CloseSubSession();    
+    iAccessoryServer.Disconnect();
+    __VTPRINTEXIT( "AccHdr.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RemoveObserver
+// Removes an accessory listener.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::RemoveObserver( 
+    MVtEngAccessoryObserver* aObserver )
+    {
+    __VTPRINTENTER( "AccHdr.RemoveObserver" )
+    TInt pos = iAccessoryObservers.Find( aObserver );
+    if ( pos != KErrNotFound )
+        {
+        iAccessoryObservers.Remove( pos );
+        }
+    __VTPRINTEXIT( "AccHdr.RemoveObserver" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RegisterObserverL
+// New accessory listener.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::
+    RegisterObserverL( MVtEngAccessoryObserver* aObserver )
+    {
+    __VTPRINTENTER( "AccHdr.RegisterObserverL" )
+    TInt pos = iAccessoryObservers.Find( aObserver );
+    if ( pos == KErrNotFound )
+        {
+        User::LeaveIfError( iAccessoryObservers.Append( aObserver ) );
+        }
+    __VTPRINTEXIT( "AccHdr.RegisterObserverL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RemoveAllObservers
+// All observers off they go
+// 
+// -----------------------------------------------------------------------------
+//    
+void CVtEngAccessoryHandler::RemoveAllObservers()
+    {
+    iAccessoryObservers.ResetAndDestroy();
+    iAccessoryObservers.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::StartListening
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::StartListening() 
+    {
+    iAccessoryMode.NotifyAccessoryModeChanged( iStatus, iMode );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RunL
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::RunL()
+    {
+    __VTPRINTENTER( "AccHdr.RunL" )
+    StartListening();
+    NotifyObserversL();
+    __VTPRINTEXIT( "AccHdr.RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::DoCancel
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::DoCancel()
+    {
+    __VTPRINTENTER( "AccHdr.DoCancel" )
+    iAccessoryMode.CancelNotifyAccessoryModeChanged();
+    __VTPRINTEXIT( "AccHdr.DoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::RunError
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAccessoryHandler::RunError( TInt /*aError*/ )
+    {
+    __VTPRINTENTER( "AccHdr.RunError" )
+    __VTPRINTEXIT( "AccHdr.RunError" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::NotifyObserversL.
+// -----------------------------------------------------------------------------
+//
+void CVtEngAccessoryHandler::NotifyObserversL()
+    {
+    const TInt obsCount( iAccessoryObservers.Count() );
+    for ( TInt i = 0; i < obsCount; i++ )
+        {
+        MVtEngAccessoryObserver* obs = iAccessoryObservers[ i ];
+        if ( obs )
+            {
+            obs->AccessoryModeChanged( 
+                iMode.iAccessoryMode, iMode.iAudioOutputStatus );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngAccessoryHandler::CMonitor::AccessoryMode
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngAccessoryHandler::
+    AccessoryMode( TAccPolAccessoryMode& aAccessoryMode) const
+    {
+    return iAccessoryMode.GetAccessoryMode( aAccessoryMode );
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngCRObserverItem.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,242 @@
+/*
+* 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:  Video call CR listener.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngCRObserverItem.h"
+#include    <centralrepository.h>
+#include    "MVtEngCRSettingObserver.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::CVtEngCRObserverItem
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem::CVtEngCRObserverItem(
+    MVtEngCRSettingObserver* aObserver,
+    TUid aUid, TUint32 aKey, 
+    CCenRepNotifyHandler::TCenRepKeyType aType  ) : 
+    iObserver( aObserver ), iUid( aUid ), iKey( aKey ), iType( aType ),
+    iNotifier( NULL )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem* CVtEngCRObserverItem::NewL( 
+    MVtEngCRSettingObserver* aObserver,
+    TUid aUid, TUint32 aKey, 
+    CCenRepNotifyHandler::TCenRepKeyType aType  )
+    {
+    __VTPRINTENTER( "CRListener.NewL" )
+    CVtEngCRObserverItem* self = 
+        new( ELeave ) CVtEngCRObserverItem( aObserver, aUid, aKey, aType );
+    __VTPRINTEXIT( "CRListener.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::~CVtEngCRObserverItem
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem::~CVtEngCRObserverItem()
+    {
+    __VTPRINTENTER( "CRListener.~" )
+    if ( iNotifier )
+    	{
+    	iNotifier->StopListening();
+    	}
+    delete iNotifier;
+    __VTPRINTEXIT( "CRListener.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Offer
+// Checks if uid and id match this observer's.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngCRObserverItem::Offer( const TUid aUid, const TUint32 aKey ) const
+    {
+    return aUid == iUid && iKey == aKey ? ETrue : EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Offer
+// Checks if uid matches this observer's.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngCRObserverItem::Offer( const TUid aUid ) const
+    {
+    return aUid == iUid ? ETrue : EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Offer
+// Checks if id matches this observer's.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngCRObserverItem::Offer( const TUint32 aKey ) const
+    {
+    return iKey == aKey ? ETrue : EFalse;
+    }
+        
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::SetCenRepNotifier
+// Sets the actual change handler to this object.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::SetCenRepNotifier( CCenRepNotifyHandler* aNotifier )
+    {
+    iNotifier = aNotifier;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyInt
+// Callback of changed int value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyInt( TUint32 aId, TInt aNewValue )
+    {
+    __VTPRINTENTER( "CRListener.Int" )
+    iObserver->HandleNotifyInt( iUid, aId, aNewValue );
+    __VTPRINTEXIT( "CRListener.Int" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyReal
+// Callback of changed real value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyReal( TUint32 aId, TReal aNewValue )
+    { 
+    __VTPRINTENTER( "CRListener.Real" )
+    iObserver->HandleNotifyReal( iUid, aId, aNewValue );
+    __VTPRINTEXIT( "CRListener.Real" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyString
+// Callback of changed string value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyString( TUint32 aId, 
+    const TDesC16& aNewValue )
+    {
+    __VTPRINTENTER( "CRListener.String" )
+    iObserver->HandleNotifyString( iUid, aId, aNewValue );
+    __VTPRINTEXIT( "CRListener.String" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyBinary
+// Callback of changed binary value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyBinary( TUint32 /* aId */, 
+    const TDesC8& /* aNewValue */ )
+    {
+    __VTPRINTENTER( "CRListener.Binary" )
+    __VTPRINTEXIT( "CRListener.Binary" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyGeneric
+// Callback of a change in central repository.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRObserverItem::HandleNotifyGeneric( TUint32 /* aId */ )
+    {
+    __VTPRINTENTER( "CRListener.Generic" )
+    __VTPRINTEXIT( "CRListener.Generic" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::HandleNotifyError
+// Callback of an error occurred.
+// -----------------------------------------------------------------------------
+//
+#ifdef VTDEBUG
+void CVtEngCRObserverItem::HandleNotifyError( TUint32 aId, TInt aError, 
+    CCenRepNotifyHandler* /* aHandler */ )
+#else    
+void CVtEngCRObserverItem::HandleNotifyError( 
+    TUint32 /* aId */, TInt /* aError */, CCenRepNotifyHandler* /* aHandler */ )
+#endif // VTDEBUG  
+    {
+    __VTPRINT3( DEBUG_GEN, "CRListener.error id=%d,err=%d ", aId, aError )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Uid
+// Returns Uid for this observer.
+// -----------------------------------------------------------------------------
+//    
+TUid CVtEngCRObserverItem::Uid() const
+    {
+    return iUid;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Key
+// Returns Key for this observer.
+// -----------------------------------------------------------------------------
+//    
+TUint32 CVtEngCRObserverItem::Key() const
+    {
+    return iKey;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Notifier
+// Returns Notifier for this observer.
+// -----------------------------------------------------------------------------
+//    
+CCenRepNotifyHandler* CVtEngCRObserverItem::Notifier() const
+    {
+    return iNotifier;
+    }
+  
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Type
+// Returns Type for this observer.
+// -----------------------------------------------------------------------------
+//    
+CCenRepNotifyHandler::TCenRepKeyType CVtEngCRObserverItem::Type() const
+    {
+    return iType;
+    }
+  
+// -----------------------------------------------------------------------------
+// CVtEngCRObserverItem::Observer
+// Returns true observer for this observer.
+// -----------------------------------------------------------------------------
+//    
+MVtEngCRSettingObserver* CVtEngCRObserverItem::Observer() const
+    {
+    return iObserver;
+    }
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngCRProxy.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,441 @@
+/*
+* 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:  Central repository proxy.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngCRObserverItem.h"
+#include    "CVtEngCRProxy.h"
+#include    "MVtEngCRSettingObserver.h"
+#include    <cvtlogger.h>
+
+// CONSTANTS
+
+const TInt KVtEngCRProxyObsGranularity = 5;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::CVtEngCRProxy
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy::CVtEngCRProxy() : iObserverItems( KVtEngCRProxyObsGranularity )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy* CVtEngCRProxy::NewL( )
+    {
+    __VTPRINTENTER( "CRProxy.NewL" )
+    CVtEngCRProxy* self = new( ELeave ) CVtEngCRProxy;
+    __VTPRINTEXIT( "CRProxy.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::~CVtEngCRProxy
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy::~CVtEngCRProxy()
+    {
+    __VTPRINTENTER( "CRProxy.~" )
+    RemoveAllObservers();
+    RemoveSessions();
+    __VTPRINTEXIT( "CRProxy.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::FindItem
+// Finds observer item.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem* CVtEngCRProxy::FindItem( 
+    const TUid& aUid, 
+    const TUint32 aKey,
+    TInt& aIndex ) const
+    {
+    TInt count( iObserverItems.Count() );
+    CVtEngCRObserverItem* item = NULL;
+    TBool found( EFalse );
+    while ( count-- && !found )
+        {
+        item = iObserverItems[ count ];
+        if ( item->Offer( aUid, aKey ) )
+            {
+            aIndex = count;
+            found = ETrue;
+            }
+        }
+
+    // Just NULL the item if not found
+    if ( !found )
+        {
+        item = NULL;
+        }
+    return item;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::FindItem
+// Finds observer item.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRObserverItem* CVtEngCRProxy::FindItem( 
+    const TUint32 aKey, TInt& aIndex ) const
+    {
+    TInt count( iObserverItems.Count() );
+    CVtEngCRObserverItem* item = NULL;
+    if ( aIndex < 0 )
+        {
+        return NULL;
+        }
+
+    for ( ; aIndex < count; aIndex++ )
+        {
+        item = iObserverItems[ aIndex ];
+        if ( item->Offer( aKey  ) )
+            {
+            break;
+            }
+        }
+    return item;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::RemoveInterested
+// Removes a cent rep listener.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRProxy::RemoveInterested( CVtEngCRObserverItem& aObserver )
+    {
+    __VTPRINTENTER( "CRProxy.RemoveInterested" )
+    TInt index ( 0 );
+    CVtEngCRObserverItem* item = FindItem( aObserver.Uid(), 
+        aObserver.Key(), index );
+    if ( !item )
+        {
+        // Should not be possible.
+        __VTPRINTEXITR( "CRProxy.RemoveInterested %d", 0 )
+        return;
+        }
+
+    delete item;
+    iObserverItems.Remove( index );
+    __VTPRINTEXITR( "CRProxy.RemoveInterested %d", 1 )
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::NewCRSessionL
+// New Central repository-uid pairing.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy::CCRSession* CVtEngCRProxy::NewCRSessionL( TUid aUid )
+    {
+    __VTPRINTENTER( "CRProxy.NewCRSessionL" )
+    CRepository* crSession = CRepository::NewL( aUid );
+    CleanupStack::PushL( crSession );
+    CCRSession* csSession = new ( ELeave ) CCRSession;
+    csSession->iSession = crSession;
+    csSession->iUid = aUid;    
+    CleanupStack::Pop( crSession );
+    __VTPRINTEXIT( "CRProxy.NewCRSessionL" )
+    return csSession;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::RegisterInterested
+// New Central repository listener.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRProxy::RegisterInterestedL( CVtEngCRObserverItem* aObserver )
+    {
+    __VTPRINTENTER( "CRProxy.RegisterInterestedL" )
+    CRepository* crSession = MapUidToCR( aObserver->Uid() );
+    CCRSession* csSession = NULL;
+    if( !crSession )
+        {
+        csSession = NewCRSessionL( aObserver->Uid() );
+        CleanupStack::PushL( csSession );
+        crSession = csSession->iSession;
+        iCRSessions.AppendL( csSession );
+        CleanupStack::Pop( csSession );
+        }
+
+    CCenRepNotifyHandler* notifier = 
+        CCenRepNotifyHandler::NewL( *aObserver, *crSession, 
+        aObserver->Type(), aObserver->Key() );
+    //notifier ownership transfered
+    aObserver->SetCenRepNotifier( notifier );
+    notifier->StartListeningL();
+    iObserverItems.AppendL ( aObserver );
+    __VTPRINTEXIT( "CRProxy.RegisterInterestedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::MapUidToCR
+// Maps a given UID to a Central repository session.
+// -----------------------------------------------------------------------------
+//
+CRepository* CVtEngCRProxy::MapUidToCR( const TUid aUid )
+    {
+    __VTPRINTENTER( "CRProxy.Map" )
+    CCRSession* csSession = NULL;
+    TBool found( EFalse );
+    TInt count( iCRSessions.Count() );
+    for ( TInt i = 0 ; i < count; i++ )
+        {
+        csSession = iCRSessions[ i ];
+        if ( csSession->iUid == aUid )
+            {
+            i = count; // break loop
+            found = ETrue;
+            }
+        }
+    CRepository* session = NULL;        
+    // Only return something when found.
+    if ( found )
+        {
+        session = csSession->iSession;
+        }
+    __VTPRINTEXITR( "CRProxy.Map %d", (TInt) session )
+    return session;
+    }
+  
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::RemoveAllObservers
+// All observers off they go.
+// -----------------------------------------------------------------------------
+//    
+void CVtEngCRProxy::RemoveAllObservers()
+    {
+    __VTPRINTENTER( "CRProxy.RemoveAll" )
+    iObserverItems.ResetAndDestroy();
+    iObserverItems.Close();
+    __VTPRINTEXIT( "CRProxy.RemoveAll" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::RemoveSessions
+// Removes all Central repository sessions.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCRProxy::RemoveSessions()
+    {
+    __VTPRINTENTER( "CRProxy.RemoveAllS" )
+    iCRSessions.ResetAndDestroy();
+    iCRSessions.Close();
+    __VTPRINTEXIT( "CRProxy.RemoveAllS" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::GetSession
+// Gets an existing or a new Central repository session for a UID.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::GetSessionL( const TUid aUid, CRepository*& crSession )
+    {
+    TInt err( KErrNone );
+    crSession = MapUidToCR( aUid );
+    if ( !crSession )
+        {
+        CCRSession* session = NULL;
+        session = NewCRSessionL( aUid );
+        if ( session )
+            {
+            CleanupStack::PushL( session );
+            iCRSessions.AppendL( session );
+            CleanupStack::Pop( session );
+            crSession = session->iSession;
+            }
+        else 
+            {
+            err = KErrNotFound;
+            }
+        }
+    return err;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Get
+// Gets integer value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Get( const TUid aUid, const TUint32 aId, TInt& aVal )
+    {
+    __VTPRINTENTER( "CRProxy.GetInt" )       
+    __VTPRINT3( DEBUG_GEN, "UID=%d,key=%d", aUid.iUid, (TInt) aId );
+
+    CRepository* crSession = NULL;
+    TRAPD( err, GetSessionL( aUid, crSession ) );
+    if ( err == KErrNone )
+        {
+        err = crSession->Get( aId, aVal );
+        }
+    __VTPRINTEXITR( "CRProxy.GetInt %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Get
+// Gets real value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Get( const TUid aUid, const TUint32 aId, TReal& aVal )
+    {
+    __VTPRINTENTER( "CRProxy.GetReal" )
+    __VTPRINT3( DEBUG_GEN, "UID=%d,key=%d", aUid.iUid, (TInt) aId );
+    CRepository* crSession = NULL;
+    TRAPD( err, GetSessionL( aUid, crSession ) );
+    if ( err == KErrNone )
+        {
+        err = crSession->Get( aId, aVal );
+        }
+    __VTPRINTEXITR( "CRProxy.GetR %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Get
+// Gets binary value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Get( const TUid aUid, const TUint32 aId, TDes8& aVal )
+    {
+    __VTPRINTENTER( "CRProxy.GetD8" )
+    __VTPRINT3( DEBUG_GEN, "UID=%d,key=%d", aUid.iUid, (TInt) aId );
+    CRepository* crSession = NULL;
+    TRAPD( err, GetSessionL( aUid, crSession ) );
+    if ( err == KErrNone )
+        {
+        err = crSession->Get( aId, aVal );
+        }
+    __VTPRINTEXITR( "CRProxy.GetD8 %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Get
+// Gets string value.
+// -----------------------------------------------------------------------------
+//      
+TInt CVtEngCRProxy::Get( const TUid aUid, const TUint32 aId, TDes16& aVal )
+    {
+    __VTPRINTENTER( "CRProxy.GetD16" )
+    __VTPRINT3( DEBUG_GEN, "UID=%d,key=%d", aUid.iUid, (TInt) aId );
+    CRepository* crSession = NULL;
+    TRAPD( err, GetSessionL( aUid, crSession ) );
+    if ( err == KErrNone )
+        {
+        err = crSession->Get( aId, aVal );
+        }
+    __VTPRINTEXITR( "CRProxy.GetD16 %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Set
+// Sets integer value to Central Repository.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Set( const TUid aUid, const TUint32 aId, TInt aVal )
+    {
+    __VTPRINTENTER( "CRProxy.SetInt" )
+    CRepository* crSession = NULL;
+    TRAPD( err, GetSessionL( aUid, crSession ) );
+    if ( err == KErrNone )
+        {
+        err = crSession->Set( aId, aVal );
+        }
+    __VTPRINTEXITR( "CRProxy.SetInt %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Set
+// Sets real value to Central Repository.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Set( const TUid aUid, const TUint32 aId, const TReal& aVal )
+    {
+    __VTPRINTENTER( "CRProxy.SetR" )
+    CRepository* crSession = NULL;
+    TRAPD( err, GetSessionL( aUid, crSession ) );
+    if ( err == KErrNone )
+        {
+        err = crSession->Set( aId, aVal );
+        }
+    __VTPRINTEXITR( "CRProxy.SetR %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Set
+// Sets binary value to Central Repository.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Set( const TUid aUid, const TUint32 aId, const TDesC8& aVal )
+    {
+    __VTPRINTENTER( "CRProxy.SetD8" )
+    CRepository* crSession = NULL;
+    TRAPD( err, GetSessionL( aUid, crSession ) );
+    if ( err == KErrNone )
+        {
+        err = crSession->Set( aId, aVal );
+        }
+    __VTPRINTEXITR( "CRProxy.SetD8 %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::Set
+// Sets string value to Central Repository.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCRProxy::Set( 
+    const TUid aUid, const TUint32 aId, const TDesC16& aVal )
+    {
+    __VTPRINTENTER( "CRProxy.SetD16" )
+    CRepository* crSession = NULL;
+    TRAPD( err, GetSessionL( aUid, crSession ) );
+    if ( err == KErrNone )
+        {
+        err = crSession->Set( aId, aVal );
+        }
+    __VTPRINTEXITR( "CRProxy.SetD16 %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCRProxy::CCRSession::~CCRSession
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy::CCRSession::~CCRSession()
+    {
+    __VTPRINTENTER( "CRProxy.~" )
+    delete iSession;
+    __VTPRINTEXIT( "CRProxy.~" )
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngDeviceLockMonitor.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* 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:  Monitors device lock state
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngDeviceLockMonitor.h"
+#include    "CVTEngPubSubsListener.h"
+#include    "CVtEngEventManager.h"
+#include    "cvtlogger.h"
+
+#include <coreapplicationuisdomainpskeys.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngDeviceLockMonitor* CVtEngDeviceLockMonitor::NewL()
+    {
+    CVtEngDeviceLockMonitor* self = new ( ELeave ) CVtEngDeviceLockMonitor();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// Destructor
+CVtEngDeviceLockMonitor::~CVtEngDeviceLockMonitor()
+    {
+    delete iAutolockListener;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::NotifyState
+// Notifies UI about device lock state
+// -----------------------------------------------------------------------------
+//
+void CVtEngDeviceLockMonitor::NotifyState() const
+    {
+    __VTPRINTENTER( "LockMonitor.NotifyState" )
+
+    TInt state = EAutolockStatusUninitialized;
+
+	// Get autolock state
+	TInt err = iAutolockListener->Get( state );
+
+	__VTPRINT2( DEBUG_GEN, "LockMonitor Get err: %d", err );
+	__VTPRINT2( DEBUG_GEN, "LockMonitor state: %d", state );
+
+	if( err == KErrNone )
+		{
+		const TInt event =
+        ( state <= EAutolockOff ) ?
+                KVtEngDeviceLockOff : KVtEngDeviceLockOn;
+        CVtEngEventManager::NotifyEvent( event );
+        }		
+			
+    __VTPRINTEXIT( "LockMonitor.NotifyState" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::HandleNotifyPSL
+// Callback for autolock state change
+// -----------------------------------------------------------------------------
+//
+void CVtEngDeviceLockMonitor::HandleNotifyPSL(
+    const TUid aUid,
+    const TInt& aKey,
+    const TRequestStatus& aStatus )
+    {
+    if ( aStatus == KErrNone &&
+         aUid == KPSUidCoreApplicationUIs &&
+         aKey == KCoreAppUIsAutolockStatus )
+        {
+        NotifyState();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::CVtEngDeviceLockMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDeviceLockMonitor::CVtEngDeviceLockMonitor()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDeviceLockMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDeviceLockMonitor::ConstructL()
+    {
+    __VTPRINTENTER( "LockMonitor.ConstructL" )
+    // Listener for autolock state
+    iAutolockListener = CVtEngPubSubsListener::NewL(
+        KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, this );
+    __VTPRINTEXIT( "LockMonitor.ConstructL" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngEventManager.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,271 @@
+/*
+* 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:  Event manager implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngEventManager.h"
+#include    "MVtEngEventObserver.h"
+#include    "VtEngUtils.h"
+#include    "VtEngEvents.h"
+#include    "VtEngPanic.h"
+#include    <cvtlogger.h>
+
+// CONSTANTS
+const TInt KMaxEventsInQueue = 8;
+
+// max amount of simultanous event observers
+const TInt KMaxVtEventObservers = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::CVtEngEventManager
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngEventManager::CVtEngEventManager() : CActive( CActive::EPriorityHigh ),
+    iObservers( KMaxVtEventObservers ) 
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngEventManager* CVtEngEventManager::NewL(
+    MVtEngEventObserver& aEventObserver )
+    {
+    CVtEngEventManager* self = 
+        new ( ELeave ) CVtEngEventManager();        
+    CleanupStack::PushL( self );
+    self->ConstructL( aEventObserver );
+    CleanupStack::Pop(); // self 
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::ConstructL
+// 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::ConstructL( MVtEngEventObserver& aEventObserver )
+	{
+	iEventQueue = new ( ELeave ) CArrayFixFlat< TInt >( KMaxEventsInQueue );
+    iEventQueue->SetReserveL( KMaxEventsInQueue );
+    iObservers.Append( &aEventObserver );
+	}
+	
+// Destructor
+CVtEngEventManager::~CVtEngEventManager()
+    {
+    Cancel();
+    delete iEventQueue;
+    iObservers.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::SessionStateChangedL
+// Notifies session state change to UI.
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::SessionStateChanged()
+    {
+    __VTPRINTENTER( "EventManager.SessionStateChanged" )
+    NotifyEvent( KVtEngSessionStateChanged );
+    __VTPRINTEXIT( "EventManager.SessionStateChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::NotifyEvent
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::NotifyEvent( const TInt aEvent )
+    {
+    __VTPRINTENTER( "EventManager.NotifyEvent" )
+    __VTPRINT2( DEBUG_GEN, "EventManager.NotifyEvent event=%d", aEvent );
+    CVtEngEventManager& eventManager = 
+            CVtEngUtility::EventManager();
+    if ( !eventManager.QueueAsyncEvent( aEvent ) )
+        {        
+        eventManager.DoNotifyEvent( aEvent );
+        }
+    __VTPRINTEXIT( "EventManager.NotifyEvent" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::AddObserverL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::AddObserverL( MVtEngEventObserver* aObserver )
+    {
+    TInt count( iObservers.Count() );
+    TBool duplicate = EFalse;
+    while ( count-- )
+        {
+        if ( aObserver == iObservers[ count ] )
+            {
+            count = 0; // break loop
+            duplicate = ETrue;
+            }
+        }
+    if ( !duplicate )
+        {
+        User::LeaveIfError( iObservers.Append( aObserver ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::RemoveObserver
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::RemoveObserver( const MVtEngEventObserver* aObserver )
+    {
+    TInt count( iObservers.Count() );
+    while ( count-- )
+        {
+        if ( aObserver == iObservers[ count ] )
+            {
+            iObservers.Remove( count );
+            count = 0; // break loop
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::RunL
+// Notify event
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::RunL()
+    {
+    __VTPRINTENTER( "EventManager.RunL" )
+    __VTPRINT2( DEBUG_GEN, "EventManager.RunL count=%d", iEventQueue->Count() );
+    // get oldest event in queue (event at index 0)
+    const TInt event = iEventQueue->At( 0 ) ;
+    
+    // delete event before calling DoNotifyEvent(), because DoNotifyEvent() may
+    // hang if it causes ASynchronous call in handler
+    iEventQueue->Delete( 0 );
+
+    // if more events pending -> signal again
+    if( iEventQueue->Count() > 0  )
+        {
+        Signal();    
+        }
+
+    // and finally notify event
+    DoNotifyEvent( event );      
+    __VTPRINTEXIT( "EventManager.RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::DoCancel
+// No op
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::DoCancel()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::DoNotifyEvent
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::DoNotifyEvent( const TInt aEvent )
+    {
+    __VTPRINTENTER( "EventManager.DoNotifyEvent" )
+    __VTPRINT2( DEBUG_GEN, "EventManager.DoNotifyEvent event=%d", aEvent );
+    TRAP_IGNORE( {
+        TInt count( iObservers.Count() );
+        while ( count-- )
+            {
+            iObservers[count]->HandleVtEventL( aEvent ) ;
+            }
+        } )
+    __VTPRINTEXIT( "EventManager.DoNotifyEvent" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::QueueAsyncEvent
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngEventManager::QueueAsyncEvent( const TInt aEvent )
+    {
+    __VTPRINTENTER( "EventManager.QueueAsyncEvent" )
+    __VTPRINT2( DEBUG_GEN, "EventManager.QueueAsyncEvent event=%d", aEvent );
+    TBool async( EFalse );
+    switch ( aEvent )
+        {
+        case KVtEngSessionStateChanged:
+        case KVtEngNegotiationProblem:
+        case KVtEngShareImageInitializeBegin:
+        case KVtEngShareImageInitializeEnd:
+            async = ETrue;
+            QueueAndSignal( aEvent );
+            break;
+        default:
+            break;
+        }
+    __VTPRINTEXIT( "EventManager.QueueAsyncEvent" )
+    return async;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::QueueAndSignal
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::QueueAndSignal( const TInt aEvent )
+    {
+    __VTPRINTENTER( "EventManager.QueueAndSignal" )
+    __VTPRINT2( DEBUG_GEN, "EventManager.QueueAndSignal event=%d", aEvent );
+    if( iEventQueue->Count() < KMaxEventsInQueue )
+        {
+        TRAP_IGNORE( iEventQueue->AppendL( aEvent ) ); // can't leave
+        Signal();
+        }
+    else
+        {
+        Panic( EVtEngPanicInvalidTooManyPendingEvents );        
+        }
+    __VTPRINTEXIT( "EventManager.QueueAndSignal" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngEventManager::Signal
+// -----------------------------------------------------------------------------
+//
+void CVtEngEventManager::Signal()
+    {
+    __VTPRINTENTER( "EventManager.Signal" )
+    if( !IsActive() )
+        {
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        __VTPRINT2( DEBUG_GEN, "EventManager.QueueAndSignal count=%d", iEventQueue->Count() );
+        }                
+    __VTPRINTEXIT( "EventManager.Signal" )
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngHandlerContainer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* 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:  Container for functional handlers in the engine.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngHandlerContainer.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::Uninitialize
+// Uninitialises handlers.
+// -----------------------------------------------------------------------------
+//
+void CVtEngHandlerContainer::Uninitialize()
+    {
+    iSession->Uninitialize();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::CVtEngHandlerContainer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngHandlerContainer::CVtEngHandlerContainer()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngHandlerContainer::ConstructL( )
+    {
+    iMedia = CVtEngMediaHandler::NewL( );
+    iSession = CVtEngSessionHandler::NewL( );
+    iAudio = CVtEngAudioHandler::NewL( );
+    
+    }
+
+void CVtEngHandlerContainer::CreateDtmfHandlerL( 
+    MVtH324ConfigCommand* aH324Config )
+    {
+    __VTPRINTENTER( "HlrCnr.CreateDtmfHandlerL" )    
+    iDtmf = CVtEngDtmfHandler::NewL( *aH324Config );
+    __VTPRINTEXIT( "HlrCnr.CreateDtmfHandlerL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngHandlerContainer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngHandlerContainer* CVtEngHandlerContainer::NewL( )
+    {
+    __VTPRINTENTER( "HlrCnr.NewL" )
+    
+    CVtEngHandlerContainer* self = new( ELeave ) CVtEngHandlerContainer;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "HlrCnr.NewL" )
+    return self;
+    }
+
+
+// Destructor
+CVtEngHandlerContainer::~CVtEngHandlerContainer()
+    {
+    __VTPRINTENTER( "HlrCnr.~" )
+
+    delete iMedia;
+    delete iSession;
+    delete iAudio;
+    delete iDtmf;
+
+    __VTPRINTEXIT( "HlrCnr.~" )
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngInitializer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,687 @@
+/*
+* 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:    Implementation class for initializing the engine gradually.
+*                Active object initializes one "subsystem" on each
+*                round. In case of failure timer is started and
+*                retrial is done after time-out. Uninitialization
+*                is done is one shot.
+
+
+
+
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngInitializer.h"
+#include    "CVtEngStateManager.h"
+#include    "CVtEngEventManager.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngHandlerContainer.h"
+#include    "CVtEngOperation.h"
+#include    "VtEngPanic.h"
+#include    "VtEngConstants.h"
+#include    "VtEngDefs.hrh"
+#include    <cvtlogger.h>
+#include    <mvtprotocolhandler.h>
+#include    <telcommsinfopskeys.h>
+#include    <videotelephonyvariant.hrh>
+#include    "VtEngUtils.h"
+#include    "CVtEngSettings.h"
+
+// CONSTANTS
+const TInt KVtEngInitializerPriority = CActive::EPriorityStandard;
+const TInt KVtEngInitializerRetrials = 3;
+const TInt KVtEngInitializerRetrialTimeout = 500000; // 0.5 seconds
+const TInt KVtEngInitializerTimerPriority = CActive::EPriorityUserInput;
+
+_LIT( KVtEngCommDiagPortName, "PVDIAGPORT" );
+_LIT( KVtEngCommTestPortName, "COMM::0" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CVtEngInitializer* CVtEngInitializer::NewL( CVtEngHandlerContainer& aHandlers )
+    {
+    __VTPRINTENTER( "Intlzr.NewL" )
+    CVtEngInitializer* self = new ( ELeave ) CVtEngInitializer( aHandlers );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "Intlzr.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::CVtEngInitializer
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngInitializer::CVtEngInitializer(
+            CVtEngHandlerContainer& aHandlers ) :
+            CActive( KVtEngInitializerPriority ),
+            iHandlers( aHandlers ),
+            iStep( EInitNone ),
+            iDataportHandled( 0 ),
+			iOwnershipInMH( EFalse )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::ConstructL
+// Second phase constructor.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::ConstructL()
+    {
+    iTimer = CPeriodic::NewL( KVtEngInitializerTimerPriority );
+    
+    }
+
+// Destructor
+CVtEngInitializer::~CVtEngInitializer()
+    {
+    __VTPRINTENTER( "Intlzr.~" )
+    delete iTimer;
+    Cancel();
+    
+    if ( iSessionCommand && !iOwnershipInMH )
+        {
+        VTProtocolFactory::DeleteSessionCommand( iSessionCommand );
+        iSessionCommand = NULL;
+        }
+    __VTPRINTEXIT( "Intlzr.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::InitializeL
+// Start initialization process.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::InitializeL( CVtEngOperation& aCallback )
+    {
+    __VTPRINTENTER( "Intlzr.InitializeL" )
+    __VTPRINT( DEBUG_GEN, "Intlzr.Init")
+    __ASSERT_ALWAYS( iStep != EInitComplete,
+        Panic( EVtEngPanicInvalidInitializationEntry ) );
+    iCallback = &aCallback;
+    if ( iStep == EInitComplete )
+        {
+        __VTPRINTEXIT( "Intlzr.InitializeL" )
+        return;
+        }
+    ContinueOrRetry( EContinue );
+    __VTPRINTEXIT( "Intlzr.InitializeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::CancelInit
+// Cancels already started ini.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngInitializer::CancelInit()
+    {
+    __VTPRINTENTER( "Intlzr.CancelInit" )
+    TBool cancelSignalled = EFalse;
+    __VTPRINT2( DEBUG_GEN, "Intlzr.CancelInit %d", iStep )
+    if ( IsActive() )
+        {
+        switch ( iStep )
+            {
+            case EInitMedia: // media->InitializeL pending
+            case EInitProto: // media->InitializeProviderL pending
+                {
+                if ( ! ( iDataportHandled & EDataportReceived )  )
+                    {
+                    __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit complete" )
+                    if ( iStatus == KRequestPending )
+	                    {
+                        // Actual protocol init is not done yet.
+                        TRequestStatus* status = &iStatus;
+                        __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit complete1" )
+                        User::RequestComplete( status, KErrNone );
+                        __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit complete2" )
+                        }
+                    iDataportHandled |= EDataportReceived;
+                    __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit complete" )
+                    }
+                __VTPRINT( DEBUG_GEN, "Intlzr.CancelInit MH cancel" )
+                CVtEngMediaHandler* media =
+                    static_cast<CVtEngMediaHandler*>( &iHandlers.Media() );
+                media->CancelInitialize();
+                iStep = EResetMediaPhase2;
+                }
+                break;
+            case EResetMedia:
+                break;
+            default:
+                cancelSignalled = ETrue;
+                Cancel();
+            }
+        }
+    __VTPRINTEXITR( "Intlzr.CancelInit %d", cancelSignalled )
+    return cancelSignalled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::Uninitialize
+// Start un-initialization process.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::Uninitialize( CVtEngOperation& aCallback )
+    {
+    __VTPRINTENTER( "Intlzr.Uninitialize" )
+    iCallback = &aCallback;
+    ContinueOrRetry( EReset );
+    __VTPRINTEXIT( "Intlzr.Uninitialize" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::GetSessionCommand
+// Transfer ownership of Protocol and continue initialization.
+//
+// -----------------------------------------------------------------------------
+//
+MVtSessionCommand* CVtEngInitializer::GetSessionCommand()
+    {
+    __VTPRINTENTER( "Intlzr.GetSessionCommand" )
+	 __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.GetSessionCommand iSessionCommand: $%x", reinterpret_cast< TUint >( iSessionCommand ) )
+    MVtSessionCommand* sessionCommand = iSessionCommand;
+
+	// Set ownership to media handler since media handler is requesting so.
+	iOwnershipInMH = ETrue;
+	if( iStep >= EInitDataportCompleted )
+		{
+		// Ownership can be totally given to MH after dataport is loaned.
+		__VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.GetSessionCommand iSessionCommand ownership to MH GetSessionCommand")
+		
+		iSessionCommand = NULL;
+		iStep = EInitComplete;
+		ContinueOrRetry( EContinue );		
+		}
+    if ( iStep != EResetMedia )
+        {
+        __VTPRINT( DEBUG_GEN, "Intlzr.GetSessionCommand=>ContinueOrRetry( EContinue )")
+        ContinueOrRetry( EContinue );
+        }
+    else
+        {
+        // Reset requested. ContinueOrRetry with EReset was called
+        // while protocol Init was ongoing. Now continue
+        __VTPRINT( DEBUG_GEN, "Intlzr.GetSessionCommand=>ContinueOrRetry( EReset )")
+        ContinueOrRetry( EReset );
+        }
+    __VTPRINTEXIT( "Intlzr.GetSessionCommand" )
+    return sessionCommand;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::Initialized
+// Returns if engine is initialized.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngInitializer::Initialized() const
+    {
+    return ( iStep == EInitComplete );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::RunL
+// Perform initialization step
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::RunL()
+    {
+    __VTPRINTENTER( "Intlzr.RunL" )
+    __VTPRINT3( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run step=%d err=%d",
+        iStep, iStatus.Int() )
+    if ( iStatus != KErrNone )
+        {
+        Notify( iStatus.Int() );
+        __VTPRINTEXIT( "Intlzr.RunL" )
+        return;
+        }
+    CVtEngMediaHandler* media =
+        static_cast<CVtEngMediaHandler*>( &iHandlers.Media() );
+
+    switch ( iStep )
+        {
+        case EInitNone:
+            return;
+        case EInitMedia:
+            // Initialize video source
+            iStatus = KRequestPending;
+            media->InitializeL( iStatus );
+            SetActive();
+            iStep++; // EInitProto
+            __VTPRINTEXIT( "Intlzr.RunL" )
+            return;
+        case EInitProto:
+            // Initialize Protocol => create terminal only once.
+            __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run create Protocol")
+            if ( !iSessionCommand )
+                {
+                __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run DOCREATE Protocol" )
+                TVt3G324MSupported protocolSupported;
+                iSessionCommand = VTProtocolFactory::CreateSessionCommandL(
+                    media, ETrue, protocolSupported );
+                    
+                if (protocolSupported == EVt3G324MMissing)
+                    {
+                    __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run init 3G324M stack is missing")    
+                    Notify(KErrNotReady);
+                    return;   
+                    }
+
+				// Initialize Protocol immediately after it is created.
+				if( iSessionCommand )
+					{
+					__VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run InitL protocol")
+					iSessionCommand->InitProtocolL( media->SdkInitInfo() );
+					}
+                }
+            if ( iSessionCommand )
+                {
+                const TDesC* dataportName = NULL;
+                __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run init protocol")
+                if(iCallback->Command() == KVtEngInitializeEngineTest )
+                    {
+                    __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                        "Intlzr.Run init with COMM::0")
+                    CVtEngUtility::Settings().SetConnectReady();    
+                    iComms = VTProtocolFactory::CreateCommServerL(
+                        KVtEngCommTestPortName );
+                    }
+                else if( iCallback->Command() == KVtEngInitializeEngineDiag )
+                    {
+                    __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                        "Intlzr.Run init with PVDIAGPORT")
+                    CVtEngUtility::Settings().SetConnectReady();    
+                    iComms = VTProtocolFactory::CreateCommServerL(
+                    KVtEngCommDiagPortName  );
+                    }
+                else
+                    { // [MediatorChange]: 
+                    __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                        "Intlzr.Run init with DATAPORT" )
+                    dataportName = 
+                        CVtEngUtility::Settings().DataportInfo();
+                    if ( !dataportName ) 
+                        {
+                        // not available yet, start waiting,
+                        // HandleSettingChangedL is called when dataport
+                        // becomes available
+                        __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                                                "Intlzr.Run DATAPORT is not ready yet" )
+                        
+                        CVtEngUtility::Settings().NotifyChangeL( 
+                        CVtEngSettings::EDataportInfo, *this );
+                        iStatus = KRequestPending;
+                        SetActive();                        
+                        __VTPRINTEXIT( "Intlzr.RunL" )
+                        return;
+                        }
+                    else
+                        {
+                        //RDebug::Print( _L("DataportName is:%S"), dataportName );
+                        TBool bitReversed( BitReversalUsed() );
+                                        
+                        iComms = VTProtocolFactory::CreateCommServerL(
+                           *dataportName, bitReversed );
+                        // not interested of DP info any more
+                        CVtEngUtility::Settings().CancelNotifyChange( 
+                            CVtEngSettings::EDataportInfo, *this );
+                        }
+                    }
+                    
+                // Initialization is now completed
+					iStep = EInitDataportCompleted;
+
+					// Dataport is now loaned
+					CVtEngUtility::Settings().SetDataportLoaned( ETrue );
+
+					// Update states since dataport is now loaned
+					CVtEngStateManager* states = CVtEngUtility::StateManager();
+					states->Update();
+
+					// No need for ownership anymore, media handler owns the pointer and is 
+					// responsible of deletion.
+					if( iOwnershipInMH )
+						{
+						__VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.Run iSessionCommand ownership to MH")						
+						iSessionCommand = NULL; 
+						iStep = EInitComplete;
+						ContinueOrRetry( EContinue );						
+						}
+                    
+                    __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                        "Intlzr.Run init protocol port operation completed")
+                // Media handler calls GetSessionCommand when InitL
+                // is complete and initialization continues.
+                __VTPRINTEXIT( "Intlzr.RunL" )
+                return;
+                }
+            break;
+        case EInitSession:
+            {
+            CVtEngSessionHandler* session =
+                static_cast<CVtEngSessionHandler*>( &iHandlers.Session() );
+            session->InitializeL();
+            __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                    "Intlzr.RunL StartMediatorListenerL" )
+            CVtEngUtility::EngineUtils()->StartMediatorListenerL();
+            }
+            break;
+        case EResetMedia:
+            iHandlers.Uninitialize();
+            iStatus = KRequestPending;
+            media->Uninitialize( iStatus );
+            SetActive();
+            iStep++; // EResetMediaPhase2
+            __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                "Intlzr.RunL step reset media started" )
+            __VTPRINTEXIT( "Intlzr.RunL" )
+            return;
+        case EResetMediaPhase2:
+            if ( iComms )
+                {
+                __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                    "Intlzr.RunL VTENgine deletes COMM server" )
+                CVtEngMediaHandler* media =
+                static_cast<CVtEngMediaHandler*>( &iHandlers.Media() );
+                if ( media->ProtoInitialized() )
+                    {
+                    TRAPD( err, VTProtocolFactory::DeleteCommServerL( iComms ) );
+                    __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL,
+                        "Intlzr.RunL VTENgine deletes COMM server err=%d", err )
+                    __ASSERT_ALWAYS( err == KErrNone,
+                        Panic( EVtEngPanicCommsDestructOnInvalidState ) );
+                    iComms = NULL;
+                    }
+                else if ( !media->ProtoInitialized() && iSessionCommand )
+                    {
+                    __VTPRINTEXIT( "Intlzr.RunL" )
+                    return;
+                    }
+                }
+            break;
+        case EInitComplete:
+            break;
+        default:
+            Panic( EVtEngPanicInvalidInitializationState );
+            break;
+        }
+    ContinueOrRetry( EContinue );
+    __VTPRINTEXIT( "Intlzr.RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::DoCancel
+// Cancels initialization
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::DoCancel()
+    {
+    __VTPRINTENTER( "Intlzr.DoCancel" )    
+    if ( iStatus == KRequestPending )
+        {
+        __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.DoCancel step=%d", iStep )
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrCancel );
+        }
+    iStep = EInitNone;
+    iCallback = NULL;
+    __VTPRINTEXIT( "Intlzr.DoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::RunError
+// Handler error on initialization.
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngInitializer::RunError( TInt aError )
+    {
+    __VTPRINTENTER( "Intlzr.RunError" )
+    __VTPRINT2( DEBUG_GEN, "Intlzr.RunError %d", aError )
+    if ( iRetrials )
+        {
+        __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL, "Intlzr.retrials %d", iRetrials )
+        TCallBack callback( CVtEngInitializer::HandleTimer, this );
+        iTimer->Start(
+            KVtEngInitializerRetrialTimeout,
+            KVtEngInitializerRetrialTimeout,
+            callback );
+        }
+    else
+        {
+        Notify( aError );
+        }
+    __VTPRINTEXIT( "Intlzr.RunError" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::HandleTimer
+// Handler for retrial timer.
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngInitializer::HandleTimer( TAny* aAny )
+    {
+    CVtEngInitializer* handler =
+        reinterpret_cast<CVtEngInitializer*>( aAny );
+    handler->DoHandleTimer();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::DoHandleTimer
+// Handler for retrial timer.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::DoHandleTimer()
+    {
+    iTimer->Cancel();
+    ContinueOrRetry( ERetry );
+    }
+
+TBool CVtEngInitializer::ActivateAndSignal( TInt aSignalValue )
+    {
+    __VTPRINTENTER( "Intlzr.ActivateAndSignal" )
+    TRequestStatus* status = &iStatus;
+    TBool signaled = EFalse;
+    if ( iStatus.Int() != KRequestPending && !IsActive() )
+        {
+        iStatus = KRequestPending;
+        SetActive();
+        User::RequestComplete( status, aSignalValue );
+        signaled = ETrue;
+        }                
+    __VTPRINTEXITR( "Intlzr.ActivateAndSignal signaled=%d", signaled )
+    return signaled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::CreateDtmfHandlerL
+// Creates handler for DTMF sending.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::CreateDtmfHandlerL( MVtH324ConfigCommand* aH324Config )
+    {
+    iHandlers.CreateDtmfHandlerL( aH324Config );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::ContinueOrRetry
+// Proceed to next step, retry on failure or notify observer.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::ContinueOrRetry( const TProcess aOperation )
+    {
+      __VTPRINTENTER( "Intlzr.ContinueOrRetry" )
+    __VTPRINT2( DEBUG_GEN, "Intlzr.CoR op=%d", aOperation )
+    if ( aOperation == EContinue )
+        {
+        const TBool resetComplete( iStep == EResetMediaPhase2 );
+        // check if last step complete and notify observer
+        if ( iStep == EInitComplete || resetComplete )
+            {
+            if ( resetComplete && 
+                // resetComplete is true also when clearing state is entered
+                // while waiting for dataport. In that case Final Uninit must
+                // not be done because MediaHandler's state is not ready for
+                // it => need to wait for KVtEngResetEngine from UI
+                iCallback->Command() == KVtEngResetEngine )
+                {
+                CVtEngMediaHandler* media =
+                    static_cast<CVtEngMediaHandler*>( &iHandlers.Media() );
+                media->FinalizeUninitialization();
+                iStep = EInitNone;
+                }
+            Notify( KErrNone );
+            __VTPRINT2( DEBUG_GEN, "Intlzr.CoR op=EContinue, branch=%d", 1 )
+            return;
+            }
+		else if( iStep == EInitProto )
+			{
+			__VTPRINT2( DEBUG_GEN, "Intlzr.CoR op=EContinue, branch=%d", 2 )
+			return;
+			}
+        __VTPRINT2( DEBUG_GEN, "Intlzr.CoR op=EContinue, branch=%d", 3 )
+        iStep++;
+        iRetrials = KVtEngInitializerRetrials;
+        }
+    else if ( aOperation == EReset )
+        {
+        __VTPRINT( DEBUG_GEN, "Intlzr.CoR op=EReset")
+        iRetrials = KVtEngInitializerRetrials;
+        const TInt step( iStep );
+        if ( step != EInitComplete && IsActive() )
+            {
+            // Reset requested while init ongoing but
+            // Protocol InitL not yet issued
+            if ( CancelInit() == EFalse )
+                { // AO still active, must return here because end of this method 
+                __VTPRINT( DEBUG_GEN, " Initializer CoR 2")
+                __VTPRINTEXIT( "Intlzr.ContinueOrRetry" )
+                return;
+                }
+            }
+        iStep = EResetMedia;
+        if ( ( step == EInitProto ||
+               step == EInitSession ) && !IsActive() )
+            {
+            // Protocol InitL is pending. Wait until it completes.
+            // GetSessionCommand is called and there we this is
+            // again called.
+            __VTPRINT( DEBUG_GEN, " Initializer reset while InitL")
+            __VTPRINTEXIT( "Intlzr.ContinueOrRetry" )
+            return;
+            }
+        }
+    else
+        {
+        iRetrials--;
+        }
+    ActivateAndSignal( KErrNone );    
+    __VTPRINTEXIT( "Intlzr.ContinueOrRetry" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::Notify
+// Notifies observer on completion or error.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::Notify( const TInt aResult )
+    {
+    __VTPRINTENTER( "Intlzr.Notify" )
+    if ( iStep == EInitComplete )
+        {
+        CVtEngStateManager* states = CVtEngUtility::StateManager();
+        states->Update();
+        }
+
+    if ( iCallback )
+        {
+        if ( aResult != KErrCancel )
+            { // UI is not interested on cancel completion
+            iCallback->HandleOpComplete( aResult );
+            }
+        iCallback = NULL;
+        __VTPRINT2( DEBUG_GEN, "Intlzr.Notify res=%d", aResult )
+        }
+    __VTPRINTEXIT( "Intlzr.Notify" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::BitReversalUsed
+// Checks if bit reversal should be used from locally variated information.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngInitializer::BitReversalUsed()
+    {
+    __VTPRINT( DEBUG_GEN, "Intlzr.BitReversalUsed" )
+    return CVtEngUtility::Settings().CheckBits(
+        KVTLVFlagEnableBitReversal );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::HandleSettingChangedL
+// Notification of received dataport name.
+// -----------------------------------------------------------------------------
+//
+void CVtEngInitializer::HandleSettingChangedL( 
+    CVtEngSettings::TSettingId aId, 
+    const TDesC& /*aValue*/ )
+    {
+    __VTPRINTENTER( "Intlzr.HandleSettingChangedL" )
+    if ( !( iDataportHandled & EDataportReceived ) && 
+            aId == CVtEngSettings::EDataportInfo && 
+            iStatus == KRequestPending )
+     
+        {        
+        iDataportHandled |= EDataportReceived;
+        //dataport will be fetched in runl, otherwise, cancelinit can not work
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        }    
+    __VTPRINTEXIT( "Intlzr.HandleSettingChangedL" )
+    }      
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::GetVtComms
+// Return pointer to communication port.
+// -----------------------------------------------------------------------------
+//
+MCommServer* CVtEngInitializer::GetVtComms()
+	{
+	return iComms;
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngModel.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,189 @@
+/*
+* 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:  Video telephony engine class implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngModel.h"
+#include    "CVtEngHandlerContainer.h"
+#include    "CVtEngCommandHandler.h"
+#include    "CVtEngEventManager.h"
+#include    "CVtEngStateManager.h"
+#include    "VtEngUtils.h"
+#include    "VtEngPanic.h"
+#include    <cvtlogger.h>
+#include    "CVtEngExtensions.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::CVtEngModel
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngModel::CVtEngModel()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngModel::ConstructL(
+            MVtEngEventObserver& aEventObserver,
+            MVtEngCommandObserver& aCommandObserver )
+    {
+    VTLOGINIT
+  __VTPRINTENTER( "Model.ConstructL" )
+
+    __VTPRINT( DEBUG_GEN | DEBUG_CONSTRUCT, "Model.ConL" )
+    iUtils = CVtEngUtility::NewL( );
+    iHandlers = CVtEngHandlerContainer::NewL( );
+
+    // Create extensions
+    iExtensions = CVtEngExtensions::NewL();
+
+    iUtils->PrepareL(
+        *iHandlers,
+        iStateManager,
+        iEventManager,
+        iExtensions );
+    iCommandHandler = CVtEngCommandHandler::NewL( *iHandlers );
+    iCommandHandler->AddObserverL( aCommandObserver );
+    iEventManager = CVtEngEventManager::NewL( aEventObserver );
+    iStateManager = CVtEngStateManager::NewL( *iHandlers, *iEventManager );
+    __VTPRINTEXIT( "Model.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVtEngModel* CVtEngModel::NewL(
+            MVtEngEventObserver& aEventObserver,
+            MVtEngCommandObserver& aCommandObserver)
+    {
+    CVtEngModel* self = new( ELeave ) CVtEngModel;
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aEventObserver, aCommandObserver );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// Destructor
+CVtEngModel::~CVtEngModel()
+    {
+    __VTPRINTENTER( "Model.~" )
+    delete iStateManager;
+    delete iCommandHandler;
+    delete iHandlers;
+    delete iUtils;
+    delete iEventManager;
+    delete iExtensions;
+    __VTPRINTEXIT( "Model.~" )
+    VTLOGUNINIT
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::CommandHandler
+// Returns command handler reference.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtEngCommandHandler& CVtEngModel::CommandHandler() const
+    {
+    return *iCommandHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::Session
+// Returns session reference.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtEngSessionInfo& CVtEngModel::Session() const
+    {
+    return iHandlers->Session();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::Media
+// Returns media reference.
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtEngMedia& CVtEngModel::Media() const
+    {
+    return iHandlers->Media();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::Audio
+// Returns audio reference.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtEngAudio& CVtEngModel::Audio() const
+    {
+    return iHandlers->Audio();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngModel::Extension
+// Returns extension pointer (currently none)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TAny* CVtEngModel::Extension( const TUid& aExtensionUid )
+    {
+    __VTPRINTENTER( "Model.Extension" )
+
+    // init local variables
+    TInt error = KErrNone;
+    TAny* interfacePtr = NULL;
+    
+    // get mediahandler handle
+    MVtEngMedia& msession = iHandlers->Media();
+    CVtEngMediaHandler& handler = static_cast<CVtEngMediaHandler&>( msession );
+    
+    // get API IF from extension
+    error = iExtensions->GetClientInterface( &interfacePtr, aExtensionUid ,
+    	handler );
+    
+    // in case of error	
+    if ( error != KErrNone )
+        {
+        __VTPRINTEXITR( "Model.Extension GetClientInterface failed %d", error)
+        return NULL;
+        }
+
+    __VTPRINTEXIT( "Model.Extension" )
+    return interfacePtr;
+    }
+
+// Engine's internal panic function
+void Panic( TVtEngPanic aPanic )
+    {
+    __VTPRINT2( DEBUG_GEN, "EnginePanic %d", aPanic)
+    User::Panic( KVtEngPanicCategory, aPanic );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngPubSubsListener.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,161 @@
+/*
+* 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:  Publish and subscribe settings listener.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVTEngPubSubsListener.h"
+#include    "MVtEngSettingPSObserver.h"
+#include    <cvtlogger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::CVtEngPubSubsListener
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngPubSubsListener::CVtEngPubSubsListener(
+    const TUid aUid, const TInt aKey, MVtEngSettingPSObserver* aObserver ) :
+        CActive( CActive::EPriorityStandard ),
+        iUid( aUid ), iId( aKey ), iCallback( aObserver )
+    {
+    __VTPRINT( DEBUG_CONSTRUCT, "CVtEngPubSubsListener C++" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::~CVtEngPubSubsListener
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngPubSubsListener::~CVtEngPubSubsListener()
+    {
+    __VTPRINTENTER( "PSLis.~" )
+    Cancel();
+    iProperty.Close();
+    __VTPRINTEXIT( "PSLis.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::RunL
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+void CVtEngPubSubsListener::RunL()
+    {
+    __VTPRINTENTER( "PSLis.RunL" )
+    const TRequestStatus status( iStatus );
+    StartListening();
+    iCallback->HandleNotifyPSL( iUid, iId, status );
+    __VTPRINTEXIT( "PSLis.RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::DoCancel
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+void CVtEngPubSubsListener::DoCancel()
+    {
+    __VTPRINTENTER( "PSLis.DoCancel" )
+    iProperty.Cancel();
+    __VTPRINTEXIT( "PSLis.DoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::RunError
+// From CActive.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngPubSubsListener::RunError( TInt /*aError*/ )
+    {
+    __VTPRINTENTER( "PSLis.RunError" )
+    __VTPRINTEXIT( "PSLis.RunError" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::NewL
+// -----------------------------------------------------------------------------
+//
+CVtEngPubSubsListener* CVtEngPubSubsListener::NewL( const TUid aUid, 
+    const TInt aKey, MVtEngSettingPSObserver* aObserver )
+    {
+    __VTPRINTENTER( "PSLis.NewL" )
+    CVtEngPubSubsListener* self = new( ELeave ) 
+        CVtEngPubSubsListener( aUid, aKey, aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "PSLis.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::StartListening
+// -----------------------------------------------------------------------------
+//
+void CVtEngPubSubsListener::StartListening() 
+    {
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtEngPubSubsListener::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    
+    User::LeaveIfError ( iProperty.Attach( iUid, iId, EOwnerThread ) );
+    StartListening();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::Get
+// Read integer value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngPubSubsListener::Get( TInt& aVal )
+    {
+    return iProperty.Get( iUid, iId, aVal );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::Get
+// Read binary value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngPubSubsListener::Get( TDes8& aVal )
+    {
+    return iProperty.Get( iUid, iId, aVal );
+    }
+  
+// -----------------------------------------------------------------------------
+// CVtEngPubSubsListener::Get
+// Read string value.
+// -----------------------------------------------------------------------------
+//      
+TInt CVtEngPubSubsListener::Get( TDes16& aVal )
+    {
+    return iProperty.Get( iUid, iId, aVal );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngSATClient.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* 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:  SAT listener.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngStateManager.h"
+#include    "CVtEngSATClient.h"
+#include    "VtEngUtils.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::CVtEngSATClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngSATClient::CVtEngSATClient() : 
+    iSatSession(),
+    iSatRefresh( *this )
+    {
+    __VTPRINT( DEBUG_GEN | DEBUG_CONSTRUCT, "CSATClient.C++" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSATClient* CVtEngSATClient::NewL( )
+    {
+    __VTPRINTENTER( "CSATClient.NewL" )
+    CVtEngSATClient* self = new( ELeave ) CVtEngSATClient;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __VTPRINTEXIT( "CSATClient.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::~CVtEngSATClient
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSATClient::~CVtEngSATClient()
+    {
+    __VTPRINTENTER( "CSATClient.~" )
+    iSatRefresh.Close();
+    iSatSession.Close();
+    __VTPRINTEXIT( "CSATClient.~" )
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::ConstructL
+// 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSATClient::ConstructL()
+    {
+    iSatSession.ConnectL();
+    iSatRefresh.OpenL( iSatSession );
+    iSatRefresh.NotifyFileChangeL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::AllowRefresh
+// Callback from SAT.
+// -----------------------------------------------------------------------------
+//    
+TBool CVtEngSATClient::AllowRefresh( 
+    TSatRefreshType  aType, 
+    const TSatRefreshFiles& /*aFiles*/ )
+    {
+    __VTPRINTENTER( "CSATClient.AllowRefresh" )    
+    TBool ret( EFalse );
+    const MVtEngSessionInfo::TSessionState state( 
+        CVtEngUtility::StateManager()->SessionState() );
+    if ( state == MVtEngSessionInfo::EIdle || aType == EFileChangeNotification )
+        {
+        __VTPRINT2( DEBUG_GEN, " TSatRefreshType aType=%d", aType )
+        ret = ETrue;
+        }
+    __VTPRINTEXITR( "CSATClient.AllowRefresh ret=%d", ret )            
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSATClient::Refresh
+// Callback from SAT.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSATClient::Refresh( 
+    TSatRefreshType /* aType */,
+    const TSatRefreshFiles& /* aFiles */ )
+    {
+    // Not needed.
+    __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "CSATClient.Refresh" )
+    iSatRefresh.RefreshEFRead( EFalse );
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/CVtEngSettings.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,946 @@
+/*
+* 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:  Video call setting data
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngSettings.h"
+#include    <cvtlogger.h>
+#include    "MVtEngSettingObserver.h"
+#include    "VtEngUtils.h"
+#include    "VtEngPanic.h"
+#include    <telincallvolcntrlcrkeys.h>
+#include    <rphcltserver.h>
+#include    <cphcltimagehandler.h>
+#include    <videotelephonyinternalcrkeys.h>
+#include    <logsdomaincrkeys.h>
+#include    <settingsinternalcrkeys.h>
+#include    <videotelephonyvariant.hrh>
+
+// CONSTANTS
+// Granularity for observer array.
+const TInt KVtEngObserverArrayGranularity = 2;
+
+// Volume default level.
+const TInt KVtEngVolumeDefaultLevel = 4;
+
+// Video quality frame rate configuration buffer size
+const TInt KVtEngVQFRBufferSize = 32;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CVtEngSettings
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings::CVtEngSettings() :
+    iVariantReadOnlyValues( KErrNotReady )
+    {
+    iCLI.iValid = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::ConstructL()
+    {
+    __VTPRINTENTER( "Settings.ConstructL" )
+    iSelectVolumeIdle = CIdle::NewL( CActive::EPriorityHigh );
+    iObserverItems = new ( ELeave ) 
+        CArrayFixFlat<TObserverItem>( KVtEngObserverArrayGranularity );
+
+    // Ear volume CR listener.
+    iCRProxy = &CVtEngUtility::CRProxy();
+    CreateDataObserverL( this, KCRUidInCallVolume, KTelIncallEarVolume, 
+        CCenRepNotifyHandler::EIntKey );   
+    
+    // IHF volume listener.
+    CreateDataObserverL( 
+        this, KCRUidInCallVolume, KTelIncallLoudspeakerVolume,
+        CCenRepNotifyHandler::EIntKey );
+    
+    // Call duration listener.
+    CreateDataObserverL( this, KCRUidLogs, KLogsShowCallDuration, 
+        CCenRepNotifyHandler::EIntKey );
+
+    // Still image listener.
+    CreateDataObserverL( this, KCRUidTelephonySettings, KSettingsVTStillImage,
+        CCenRepNotifyHandler::EIntKey );
+
+    // Still image path listener.
+    CreateDataObserverL( 
+        this, KCRUidTelephonySettings, KSettingsVTStillImagePath,
+        CCenRepNotifyHandler::EStringKey );
+
+    ReadVariationsL();
+    ResetAll();
+
+
+    TInt validImage( 0 );
+    TInt err = iCRProxy->Get( KCRUidTelephonySettings, 
+        KSettingsVTStillImage, validImage );
+    __VTPRINT3( DEBUG_DETAIL, "Settings.ConL: use image", err, validImage )
+    if ( !err && validImage )
+        {
+        __VTPRINT( DEBUG_DETAIL, "Settings.ConL: VALID" )
+        iConfig.iVideo.iImageIsValid = ETrue;
+        }
+
+    TInt value( 0 ); // not shown
+    err = iCRProxy->Get( KCRUidLogs, KLogsShowCallDuration, value );
+    if ( err == KErrNone )
+        {
+        iConfig.iCallTimerOn = ( value == 1 ) ? ETrue : EFalse;
+        }
+    
+    // Initialize the volume levels.
+    // If value retrieval fails, use defaults.
+    if ( iCRProxy->Get( KCRUidInCallVolume, 
+        KTelIncallEarVolume, iConfig.iAudio.iVolume.iHandsetVolume ) 
+        != KErrNone )
+        {
+        iConfig.iAudio.iVolume.iHandsetVolume = KVtEngVolumeDefaultLevel;
+        }
+
+    if ( iCRProxy->Get( KCRUidInCallVolume, KTelIncallLoudspeakerVolume, 
+        iConfig.iAudio.iVolume.iHandsfreeVolume ) != KErrNone )       
+        {
+        iConfig.iAudio.iVolume.iHandsfreeVolume = KVtEngVolumeDefaultLevel;
+        }
+
+    // Open connection to phone server
+    RPhCltServer phoneClient;
+    User::LeaveIfError( phoneClient.Connect() );
+    CleanupClosePushL( phoneClient );
+	
+	CPhCltImageHandler* stillH;
+	stillH = CPhCltImageHandler::NewL();
+    CleanupStack::PushL( stillH );
+
+	// Load images
+	RFile file;
+	TInt res = stillH->OpenDefaultVtImage( file );
+	file.Close();
+	iDefaultStillImageDefined = ( res == KErrNone ) ? ETrue : EFalse;
+     // Cleanup
+	CleanupStack::PopAndDestroy( 2 ); // phoneClient, stillH, imageParams
+
+    __VTPRINTEXIT( "Settings.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings* CVtEngSettings::NewL()
+    {
+    CVtEngSettings* self = new( ELeave ) CVtEngSettings;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::~CVtEngSettings
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings::~CVtEngSettings()
+    {
+    __VTPRINTENTER( "Settings.~" )
+    delete iSelectVolumeIdle;
+    delete iObserverItems;
+    delete iDataportInfo;
+    __VTPRINTEXIT( "Settings.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::Config
+// Returns configuration.
+// -----------------------------------------------------------------------------
+//
+const CVtEngSettings::TVtEngVideoCallConfig& CVtEngSettings::Config() const
+    {
+    return iConfig;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetCurrentVolume
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetCurrentVolume( TBool aVolume )
+    {
+    TBool old = iConfig.iAudio.iCurrentVolume;
+    iConfig.iAudio.iCurrentVolume = aVolume;
+
+    if ( iSelectVolumeObserver && ( !old && aVolume ) || ( old && !aVolume ) )
+        {
+        iSelectVolumeIdle->Cancel();
+        iSelectVolumeIdle->Start(
+            TCallBack( DoInformSelectVolumeObserver, this ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CurrentVolume
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngSettings::CurrentVolume() const
+    {
+    return iConfig.iAudio.iCurrentVolume;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetVolume
+// Sets output volue setting.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSettings::SetVolume( 
+        const TInt aHandsetVolume, 
+        const TInt aHandsfreeVolume,
+        const TBool aInternal )
+    {
+    __VTPRINTENTER( "Settings.SetVolume" )
+    __VTPRINT3( DEBUG_DETAIL, "Settings:SetVolume hs=%d, ihf=%d", 
+        aHandsetVolume, aHandsfreeVolume  )
+    __VTPRINT2( DEBUG_DETAIL, "Settings:Internal=%d", aInternal )
+    
+    TInt volume ( 0 );    
+
+    TInt res( KErrNone );
+    if ( aInternal )
+        {
+        if ( iConfig.iAudio.iVolume.iHandsfreeVolume != aHandsfreeVolume )
+            {
+            iConfig.iAudio.iVolume.iHandsfreeVolume = 
+                ValidVolume( aHandsfreeVolume );
+            }
+        if ( iConfig.iAudio.iVolume.iHandsetVolume != aHandsetVolume )
+            {
+            iConfig.iAudio.iVolume.iHandsetVolume = 
+                ValidVolume( aHandsetVolume );
+            }
+        }
+    else
+        {        
+	    iCRProxy->Get( KCRUidInCallVolume, 
+	        KTelIncallEarVolume, volume );
+	    if ( volume != aHandsetVolume ) 
+	        {
+	        iCRProxy->Set( KCRUidInCallVolume, 
+	            KTelIncallEarVolume, aHandsetVolume );
+	        }
+	        
+	    iCRProxy->Get( KCRUidInCallVolume, 
+	        KTelIncallLoudspeakerVolume, volume );
+	    if ( volume != aHandsfreeVolume )
+	        {
+	        iCRProxy->Set( KCRUidInCallVolume, 
+	            KTelIncallLoudspeakerVolume, aHandsfreeVolume );         
+	        }
+        }
+    __VTPRINTEXITR( "Settings.SetVolume res=%d", res )
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetVolume
+// Gets audio volume.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSettings::GetVolume(
+    TInt& aVolume, 
+    const TBool aHandsfree,
+    const TBool aInternal ) const
+    {
+    __VTPRINTEXIT( "Settings.GetVolume" )
+    TInt res( KErrNone );
+    if ( aInternal )
+        {
+        if ( aHandsfree )
+            {
+            aVolume = iConfig.iAudio.iVolume.iHandsfreeVolume;
+            }
+        else
+            {
+            aVolume = iConfig.iAudio.iVolume.iHandsetVolume;
+            }
+        }
+    else
+        {
+        if ( aHandsfree )
+            {          
+            res = iCRProxy->Get( KCRUidInCallVolume,
+                KTelIncallLoudspeakerVolume, aVolume );
+            }
+        else
+            {
+            res = iCRProxy->Get( KCRUidInCallVolume, 
+                KTelIncallEarVolume, aVolume );              
+            }
+        }
+    __VTPRINTEXITR( "Settings.GetVolume res=%d", res )
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetRouting
+// Sets audio routing setting.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetRouting( 
+    const MVtEngAudio::TVtEngRoutingSetting& aState )
+    {
+    iConfig.iAudio.iRouting = aState;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetVideoEnabled
+// Sets video enabled setting.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetVideoEnabled( const TBool aEnabled )
+    {
+    __VTPRINT2( DEBUG_GEN , "Settings.SVE",aEnabled )
+    iConfig.iVideo.iVideoEnabled = aEnabled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetConnectReady
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetConnectReady()
+    {
+    iConfig.iReadyForConnect = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetDataportLoaned
+// Sets dataport loaning status
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::SetDataportLoaned( TBool aLoaned )
+	{
+	__VTPRINTENTER( "Settings.SetDataportLoaned" )
+	iConfig.iIsDataportLoaned = aLoaned;
+	__VTPRINTEXIT( "Settings.SetDataportLoaned" )
+	}
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ResetAll
+// Reset all settings.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::ResetAll()
+    {
+    __VTPRINT( DEBUG_GEN , "Settings.RA" )
+    iConfig.iAudio.iRouting = KVtEngDefaultAudioRouting;
+    iConfig.iVideo.iVideoEnabled = ETrue;
+    iConfig.iReadyForConnect = EFalse;
+	iConfig.iIsDataportLoaned = EFalse;
+    // call duration setting not cleared
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::NotifyChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::NotifyChangeL( 
+            TSettingId aId,
+            MVtEngSettingObserver& aObserver )
+    {
+    __VTPRINTENTER( "Settings.NotifyChangeL" )
+    __VTPRINT2( DEBUG_GEN, "Settings.NC id %d", aId )
+    switch ( aId )
+        {
+        case ESelectVolume:
+            iSelectVolumeObserver = &aObserver;
+            break;
+        case EDataportInfo:
+            iDataportObserver = &aObserver;
+            break;
+        // others are CenRep items
+        default:
+        {
+        const TInt count( iObserverItems->Count() );
+        for ( TInt index = 0; index < count; index++ )
+            {
+            TObserverItem& item = iObserverItems->At( index );
+            if ( item.iId == aId && item.iObserver == &aObserver )
+                {
+                __VTPRINT( DEBUG_GEN, "Settings.NC.already" )
+                __VTPRINTEXIT( "Settings.NotifyChangeL" )
+                return;
+                }
+            }
+
+        TObserverItem item;
+        item.iId = aId;
+        switch ( aId )
+            {
+            case EStillImage:
+                item.iIntKey = KSettingsVTStillImage;
+                item.iUid = KCRUidTelephonySettings;
+                break;
+            case EStillImagePath:
+                item.iIntKey = KSettingsVTStillImagePath;
+                item.iUid = KCRUidTelephonySettings;
+                break;
+            case ECallTimer:
+                item.iIntKey = KLogsShowCallDuration;
+                item.iUid = KCRUidLogs;
+                break;
+            case EHandsetVolume:           
+                item.iIntKey = KTelIncallEarVolume;
+                item.iUid = KCRUidInCallVolume;
+                break;
+            case EHandsfreeVolume:
+                item.iIntKey = KTelIncallLoudspeakerVolume;
+                item.iUid = KCRUidInCallVolume;              
+                break;
+            default:
+                break;
+            }
+        item.iObserver = &aObserver;
+        iObserverItems->AppendL( item );
+        }
+        }
+    __VTPRINTEXIT( "Settings.NotifyChangeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CancelNotifyChange
+// Cancels receiving change events.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::CancelNotifyChange( 
+    TSettingId aId, const MVtEngSettingObserver& aObserver )
+    {
+    __VTPRINTENTER( "Settings.CancelNotifyChange" )
+    if ( aId == ESelectVolume )
+        {
+        if ( &aObserver == iSelectVolumeObserver )
+            {
+            iSelectVolumeObserver = NULL;
+            }
+        }
+    else if ( &aObserver == iDataportObserver )
+        {
+        iDataportObserver = NULL;
+        // also free space used for dataport info
+        delete iDataportInfo;
+        iDataportInfo = NULL;
+        }
+    else
+        {
+        TInt count( iObserverItems->Count() );
+        while ( count-- )
+            {
+            const TObserverItem& item = iObserverItems->At( count );
+            if ( item.iId == aId &&
+                item.iObserver == &aObserver )
+                {
+                iObserverItems->Delete( count );
+                count = 0; // breaks loop
+                }
+            }
+        }
+    __VTPRINTEXIT( "Settings.CancelNotifyChange" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::HandleNotifyInt
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::HandleNotifyInt( const TUid aUid, 
+    const TUint32 aId, TInt aNewValue )
+    {
+    TBool informObserver = ETrue;       
+    if ( aUid == KCRUidInCallVolume )   
+        {
+        switch ( aId )
+            {
+            case KTelIncallLoudspeakerVolume:
+                {
+                __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: HF volume" )
+                if ( iConfig.iAudio.iVolume.iHandsfreeVolume == aNewValue )
+                    {
+                    informObserver = EFalse;
+                    }
+                else
+                    {                
+                    iConfig.iAudio.iVolume.iHandsfreeVolume = aNewValue;
+                    }
+                }
+                break;
+            case KTelIncallEarVolume:           
+                {
+                __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: HandsetVolume" )
+                if ( iConfig.iAudio.iVolume.iHandsetVolume == aNewValue )
+                    {
+                    informObserver = EFalse;
+                    }
+                else
+                    {
+                    iConfig.iAudio.iVolume.iHandsetVolume = aNewValue;
+                    }
+                }
+                break;
+            default:
+                __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: Non-ordered" );
+                break;
+            }
+        }
+    else if ( aUid == KCRUidLogs )
+        {
+        switch ( aId )
+            {
+            case KLogsShowCallDuration:
+                {
+                __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: call duration" )
+                iConfig.iCallTimerOn = aNewValue > 0 ? ETrue : EFalse;
+                }
+                break;
+            default:
+                __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: Non-ordered" );
+                break;
+            }
+        }
+    else if ( aUid == KCRUidTelephonySettings )
+        {
+        switch ( aId )
+            {
+            case KSettingsVTStillImage:
+                {
+                __VTPRINT( DEBUG_GEN, "HandleNotifyInt still" )
+                if ( aNewValue == 0 )
+                    {
+                    __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt disabled")
+                    // still image disabled in settings
+                    iConfig.iVideo.iStillImageFile.Zero();
+                    iConfig.iVideo.iImageIsValid = EFalse;
+                    }
+                else
+                    {
+                    __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt enabled")
+                    iConfig.iVideo.iImageIsValid = ETrue;
+                    }
+                }
+                break;
+            default:
+                __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: Non-ordered" );
+                break;
+            }
+        }
+
+    TObserverItem* item = FindItem( aUid, aId );
+    if ( informObserver && item && item->iObserver ) 
+        {
+        // The observer does not need the new value
+        // Plain notification is all.
+        TRAP_IGNORE( item->iObserver->HandleSettingChangedL( item->iId, KNullDesC16 ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::HandleNotifyReal
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::HandleNotifyReal( const TUid /*aUid*/, 
+    const TUint32 /*aId*/ , TReal /* aNewValue*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::HandleNotifyString
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSettings::HandleNotifyString( const TUid aUid, const TUint32 aId, 
+    const TDesC16& aNewValue )
+    {
+    __VTPRINTENTER( "Settings.HN" )
+    if ( aNewValue.Compare( iConfig.iVideo.iStillImageFile ) != 0 )
+        {
+        if( aId == KSettingsVTStillImagePath )
+            {
+            __VTPRINT( DEBUG_GEN, "Settings.HN  KGSVTStillImagePath" )
+            iConfig.iVideo.iStillImageFile.Copy( aNewValue );
+            }
+        }
+    TObserverItem* item = FindItem( aUid, aId );
+    if ( item && item->iObserver ) 
+        {
+        TRAP_IGNORE( item->iObserver->HandleSettingChangedL( item->iId, aNewValue ) );
+        }
+    __VTPRINTEXIT( "Settings.HN" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::FindItem
+// Finds observer item.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings::TObserverItem* CVtEngSettings::FindItem( 
+    const TUid& aUid, 
+    const TDesC& aKey ) const
+    {
+    TInt count( iObserverItems->Count() );
+    TObserverItem* item = NULL;
+    TBool found( EFalse );
+    while ( count-- && !found )
+        {
+        item = &iObserverItems->At( count );
+        if ( item->iUid == aUid &&
+             item->iKey.Compare( aKey ) == 0 )
+            {
+            found = ETrue;
+            }
+        }
+
+    // Just NULL the item if not found
+    if( !found )
+        {
+        item = NULL;
+        }
+    return item;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::FindItem
+// Finds observer item.
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings::TObserverItem* CVtEngSettings::FindItem( 
+    const TUid& aUid,const TInt& aKey ) const
+    {
+    TInt count( iObserverItems->Count() );
+    TObserverItem* item = NULL;
+    TBool found( EFalse );
+    while ( count-- && !found )
+        {
+        item = &iObserverItems->At( count );
+        if ( item->iUid == aUid &&
+            item->iIntKey == aKey )
+            {
+            found = ETrue;
+            }
+        }
+
+    // Just NULL the item if not found
+    if( !found )
+        {
+        item = NULL;
+        }
+    return item;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SettingAsTInt
+// Returns setting as integer value.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSettings::SettingAsTInt( const TDesC& aValue )
+    {
+    TInt value( 0 );
+    const TInt err = TLex( aValue ).Val( value );
+    if ( err != KErrNone ) 
+        {
+        value = err;
+        }
+    return value;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::DoInformSelectVolumeObserver
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSettings::DoInformSelectVolumeObserver( TAny* aAny )
+    {
+    CVtEngSettings* self = static_cast< CVtEngSettings* >( aAny );
+
+    if ( self->iSelectVolumeObserver )
+        {
+        TRAP_IGNORE( self->iSelectVolumeObserver->HandleSettingChangedL( 
+            ESelectVolume, 
+            KNullDesC ) );
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ReadVariationsL
+// Reads local variations.
+// -----------------------------------------------------------------------------
+//      
+void CVtEngSettings::ReadVariationsL() 
+    {
+    __VTPRINTENTER( "Settings.ReadVariations" )
+    User::LeaveIfError( iCRProxy->Get( KCRUidVTVariation, 
+        KVTLocalVariationFlags, iVariantReadOnlyValues ));
+    TBuf< KVtEngVQFRBufferSize > buffer;                    
+   User::LeaveIfError( iCRProxy->Get( KCRUidVTConfiguration, 
+        KVTVideoFrameRates, buffer ));
+    ParseFrameRates( iVQFRConfig, buffer );             
+    __VTPRINTEXIT( "Settings.ReadVariations" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetCameraOrientations
+// Reads camera orientations from CR
+// -----------------------------------------------------------------------------
+//     
+
+void CVtEngSettings::GetCameraOrientations( 
+    MVtEngMedia::TCameraOrientation& aPrimaryCameraOrientation,
+    MVtEngMedia::TCameraOrientation& aSecondaryCameraOrientation ) const
+    {
+    /*
+    * Defines layout (screen orientation) used by 
+    * Video Telephone application per active camera.
+    * Each camera has one of the following values:
+    * 1) "LS" = Landscape
+    * 2) "PR" = Portrait
+    * 3) "OL" = Obey layout in specific device mode (normal operation)
+    * Camera values are:
+    * 1) "C1" = VT primary camera (inwards)
+    * 2) "C2" = VT secondary camera (outwards)
+    * Example value (portrait for cam1, landscape for cam2):
+    * C1:PR C2:LS
+    */
+    
+    __VTPRINTENTER( "Settings.GetCameraOrientations" )
+    const TInt KMaxKVTCameraLayoutValue = 11;
+    const TInt KAbbreviationLength = 2;
+    const TInt KSkipChars = 3;
+    
+    _LIT( KCameraOrientationLS, "LS" ); // landscape
+    _LIT( KCameraOrientationPR, "PR" ); // portrait
+    
+    TBuf< KMaxKVTCameraLayoutValue > cameraOrientations;  
+    TInt err = iCRProxy->Get( KCRUidVTConfiguration, 
+       KVTCameraLayout, cameraOrientations );
+
+    // parse cenrep value
+    if( cameraOrientations.Length() > 0 )
+        {            
+        TBuf<KAbbreviationLength> abbreviation; 
+        TLex lex( cameraOrientations );
+        lex.SkipAndMark(KSkipChars);
+        abbreviation.Append( lex.Get() );
+        abbreviation.Append( lex.Get() );
+        
+        // primary camera value
+        if ( abbreviation.CompareF( KCameraOrientationLS ) == 0 )
+           {
+           __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.prim:LS" );
+           aPrimaryCameraOrientation = MVtEngMedia::EOrientationLandscape;
+           }
+        else if ( abbreviation.CompareF( KCameraOrientationPR ) == 0 )
+           {
+           aPrimaryCameraOrientation = MVtEngMedia::EOrientationPortrait;
+           __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.prim:PR" );
+           }
+        else
+           {
+           __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.prim:OL" );
+           aPrimaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch;
+           }  
+           
+        abbreviation.Zero();
+        lex.SkipSpace();
+        lex.SkipAndMark(KSkipChars);
+        abbreviation.Append( lex.Get() );
+        abbreviation.Append( lex.Get() );
+
+         //secondary camera value
+        if ( abbreviation.CompareF( KCameraOrientationLS ) == 0)
+           {
+           __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.sec:LS" );
+           aSecondaryCameraOrientation = MVtEngMedia::EOrientationLandscape;
+           }
+        else if ( abbreviation.CompareF( KCameraOrientationPR ) == 0)
+           {
+           __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.sec:PR" );
+           aSecondaryCameraOrientation = MVtEngMedia::EOrientationPortrait;
+           }
+        else
+           {
+           __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.sec:OL" );
+           aSecondaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch;
+           } 
+        }
+    else
+        {
+        // reading from cenrep failed
+        // set default values for camera orientation
+        aPrimaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch;
+        aSecondaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch;
+        }
+    __VTPRINTEXIT( "Settings.ReadVariations" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CheckBit
+// Checks if a certain bit is turned on in locally variated features.
+// -----------------------------------------------------------------------------
+//      
+TBool CVtEngSettings::CheckBits( const TInt aBits ) 
+    {
+    __VTPRINT2( DEBUG_GEN, "Settings.CheckBit: %d", aBits )
+    __VTPRINT2( DEBUG_GEN, "Settings.CheckBit=%d", 
+        iVariantReadOnlyValues & aBits ? 1 : 0 )
+    return iVariantReadOnlyValues & aBits;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::VideoQualityFrameRateConfig
+// Returns video quality frame rate configuration.
+// -----------------------------------------------------------------------------
+//      
+const CVtEngSettings::TVtEngVideoQualityFrameRateConfig& 
+    CVtEngSettings::VideoQualityFrameRateConfig() const
+    {
+    __VTPRINTENTER( "Settings.VideoQualityFrameRateConfig" ) 
+    __VTPRINTEXIT( "Settings.VideoQualityFrameRateConfig" ) 
+    return iVQFRConfig;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::CreateDataObserverL
+// Creates a shared data observer. Ownership transferred.
+// -----------------------------------------------------------------------------
+// 
+void  CVtEngSettings::CreateDataObserverL( MVtEngCRSettingObserver* aObserver,
+    TUid aUid, TUint32 aKey, CCenRepNotifyHandler::TCenRepKeyType aType )
+    {
+    CVtEngCRObserverItem* item = CVtEngCRObserverItem::NewL(
+        aObserver, aUid, aKey, aType  );
+    CleanupStack::PushL( item );
+    iCRProxy->RegisterInterestedL( item );
+    CleanupStack::Pop( item );
+    }
+   
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::ParseFrameRates
+// Parses VQ frame rates read from cenrep.
+// -----------------------------------------------------------------------------
+// 
+void CVtEngSettings::ParseFrameRates( TVtEngVideoQualityFrameRateConfig& aVQFR, 
+    const TDesC& aBuffer )
+    {
+    __VTPRINTENTER( "Settings.ParseFrameRates" ) 
+    Mem::FillZ( &aVQFR, sizeof( aVQFR ) );
+    if( aBuffer.Length() > 0 )
+        {            
+        TLex lex( aBuffer );
+        lex.Val( aVQFR.iDetail );
+        __VTPRINT2( DEBUG_GEN, "Settings.ParseFrameRates iDetail=%d", aVQFR.iDetail );
+        lex.SkipSpace();
+        lex.Val( aVQFR.iNormal );
+        __VTPRINT2( DEBUG_GEN, "Settings.ParseFrameRates iNormal=%d", aVQFR.iNormal );
+        lex.SkipSpace();
+        lex.Val( aVQFR.iMotion );
+        __VTPRINT2( DEBUG_GEN, "Settings.ParseFrameRates iMotion=%d", aVQFR.iMotion );
+        }
+    __VTPRINTEXIT( "Settings.ParseFrameRates" )     
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::IsDefaultStillImageDefined
+// Checks if still image exists.
+// -----------------------------------------------------------------------------
+//   
+TBool CVtEngSettings::IsDefaultStillImageDefined()
+    {
+    __VTPRINTENTER( "Settings.IsDefaultStillImageDefined" ) 
+    __VTPRINTEXITR( "Settings.IsDefaultStillImageDefined%d",iDefaultStillImageDefined )
+    return iDefaultStillImageDefined;
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetCLI
+// 
+// -----------------------------------------------------------------------------
+//   
+void CVtEngSettings::SetCLI( const MVtEngSessionInfo::TCLI& aCLI )
+    {
+    __VTPRINTENTER( "Settings.SetCLI" )
+    iCLI.iCallId = aCLI.iCallId;
+    iCLI.iName = aCLI.iName;
+    iCLI.iVoiceCallPossible = aCLI.iVoiceCallPossible;
+    iCLI.iValid = ETrue;
+    __VTPRINT2( DEBUG_GEN, "iVoiceCallPossible=%d,", iCLI.iVoiceCallPossible )
+    __VTPRINTEXIT( "Settings.SetCLI" ) 
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::GetCLI
+// 
+// -----------------------------------------------------------------------------
+//   
+TBool CVtEngSettings::GetCLI( MVtEngSessionInfo::TCLI& aCLI ) const
+    {
+    aCLI.iCallId = iCLI.iCallId;
+    aCLI.iVoiceCallPossible = iCLI.iVoiceCallPossible;
+    aCLI.iName = iCLI.iName;
+    return iCLI.iValid;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::SetDataportInfoL
+// 
+// -----------------------------------------------------------------------------
+//   
+void CVtEngSettings::SetDataportInfoL( const TDesC& aPortInfo )
+    {
+    delete iDataportInfo;
+    iDataportInfo = NULL;
+    iDataportInfo = HBufC::NewL( aPortInfo.Length() );
+    *iDataportInfo = aPortInfo;
+    SetConnectReady();
+    if ( iDataportObserver )
+        {
+        iDataportObserver->HandleSettingChangedL( EDataportInfo,
+            *iDataportInfo );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSettings::DataportInfo
+// 
+// -----------------------------------------------------------------------------
+//   
+const TDesC* CVtEngSettings::DataportInfo() const
+    {
+    return iDataportInfo;
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/VtEngUtils.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,217 @@
+/*
+* 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:  Video telephony engine TLS container.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngCRProxy.h"
+#include    "CVtEngAccessoryHandler.h"
+#include    "CVtEngSATClient.h"
+#include    "VtEngUtils.h"
+#include    "VtEngPanic.h"
+#include    "CVtEngInitializer.h"
+#include    "CVtEngSettings.h"
+#include    "CVtEngDeviceLockMonitor.h"
+
+#include    "CVtEngExtensions.h"
+#include    "cvtengmdtrmessagelistener.h"
+#include    "cvtengmdtrcommandsender.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::CVtEngUtility
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngUtility::CVtEngUtility()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::ConstructL( )
+    {
+    __ASSERT_DEBUG( Dll::Tls() == NULL, Panic( EVtEngPanicTlsPanic ));
+    Dll::SetTls( this );
+    iCRProxy = CVtEngCRProxy::NewL();
+    iAccessoryHandler = CVtEngAccessoryHandler::NewL();
+    iSettings = CVtEngSettings::NewL();
+    
+    iLockMonitor = CVtEngDeviceLockMonitor::NewL();  
+    iMdtrCommandSender = CVtEngMdtrCommandSender::NewL( *this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngUtility* CVtEngUtility::NewL()
+    {
+    CVtEngUtility* self = new( ELeave ) CVtEngUtility;
+
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// Destructor
+CVtEngUtility::~CVtEngUtility()
+    {
+    delete iMdtrMessageListener;
+    delete iMdtrCommandSender;            
+    delete iCRProxy;
+	delete iAccessoryHandler;
+    delete iEngineInit;
+    delete iSettings;
+    delete iSATClient;
+    delete iLockMonitor;  
+    Dll::SetTls( NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::EngineUtils
+// Return pointer to Engine Utility.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngUtility* CVtEngUtility::EngineUtils()
+    {
+    return reinterpret_cast<CVtEngUtility*>( Dll::Tls() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::StateManager
+// Returns state manager.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngStateManager* CVtEngUtility::StateManager()
+    {
+    return *(CVtEngUtility::EngineUtils()->iStateManager);
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::EventManager
+// -----------------------------------------------------------------------------
+//
+CVtEngEventManager& CVtEngUtility::EventManager()
+    {
+    return **CVtEngUtility::EngineUtils()->iEventManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::PrepareL
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::PrepareL(
+    CVtEngHandlerContainer& aHandlers,
+    CVtEngStateManager*& aStateManagerPtr,
+    CVtEngEventManager*& aEventManagerPtr,
+    CVtEngExtensions* aExtensionPtr )
+    {
+    iEngineInit = CVtEngInitializer::NewL( aHandlers );
+    iStateManager = &aStateManagerPtr;
+    iEventManager = &aEventManagerPtr;
+    iExtensions = aExtensionPtr;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::StartMediatorListenerL    
+// Creates mediator message (event/command) listener. Cannot be done in
+// constructor because session control may be unavailable when we would
+// receive first mediator event => session state is still uninitialized.
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::StartMediatorListenerL()
+    {
+    iMdtrMessageListener = CVtEngMdtrMessageListener::NewL( *this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::Settings
+// -----------------------------------------------------------------------------
+//
+CVtEngSettings& CVtEngUtility::Settings()
+    {
+    return *CVtEngUtility::EngineUtils()->iSettings;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngUtility::MediatorCommands
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrCommandSender& CVtEngUtility::MediatorCommands()    
+    {
+    return *CVtEngUtility::EngineUtils()->iMdtrCommandSender;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::CRProxy
+// -----------------------------------------------------------------------------
+//
+CVtEngCRProxy& CVtEngUtility::CRProxy()
+    {
+    return *CVtEngUtility::EngineUtils()->iCRProxy;
+	}
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::AccessoryHandler
+// -----------------------------------------------------------------------------
+//
+CVtEngAccessoryHandler& CVtEngUtility::AccessoryHandler()
+    {
+    return *CVtEngUtility::EngineUtils()->iAccessoryHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::StartSATListenL
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::StartSATListenL()
+    {
+    iSATClient = CVtEngSATClient::NewL();    
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngUtility::NotifyLockState
+// -----------------------------------------------------------------------------
+//
+void CVtEngUtility::NotifyLockState()
+    {
+    iLockMonitor->NotifyState();
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngUtility::Extensions
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensions* CVtEngUtility::Extensions()
+    {   
+    return CVtEngUtility::EngineUtils()->iExtensions;
+    }    
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/cvtengincomingcallmonitor.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* 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:  Monitors device incoming call state
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cvtengincomingcallmonitor.h"
+#include    "CVTEngPubSubsListener.h"
+#include    "CVtEngEventManager.h"
+#include    "cvtlogger.h"
+
+#include 	<ctsydomainpskeys.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngIncomingCallMonitor* CVtEngIncomingCallMonitor::NewL()
+    {
+    CVtEngIncomingCallMonitor* self = new ( ELeave ) CVtEngIncomingCallMonitor();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// 
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::~
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngIncomingCallMonitor::~CVtEngIncomingCallMonitor()
+    {
+    delete iIncomingCallListener;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::NotifyState
+// Notifies UI about device incoming call state
+// -----------------------------------------------------------------------------
+//
+void CVtEngIncomingCallMonitor::NotifyState() const
+    {
+    __VTPRINTENTER( "IncomingCall.NotifyState" )
+	
+	// Initialize state as first valuea of call state enum
+    TInt state = EPSCTsyCallStateUninitialized;
+	
+	// Get incomig call state and send event to UI
+    if ( iIncomingCallListener->Get( state ) == KErrNone ) 
+    	{
+    	__VTPRINT2( DEBUG_SESSION, "IncomingCall.NotifyState=%d", state )
+        const TInt event = ( state == EPSCTsyCallStateRinging ) ?
+                KVtEngSessionWaitingCallActive : KVtEngSessionWaitingCallInactive;
+        CVtEngEventManager::NotifyEvent( event );
+        }
+    __VTPRINTEXIT( "IncomingCall.NotifyState" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitoronitor::HandleNotifyPSL
+// Callback for incoming call state change
+// -----------------------------------------------------------------------------
+//
+void CVtEngIncomingCallMonitor::HandleNotifyPSL(
+    const TUid aUid,
+    const TInt& aKey,
+    const TRequestStatus& aStatus )
+    {
+    if ( aStatus == KErrNone &&
+         aUid == KPSUidCtsyCallInformation &&
+         aKey == KCTsyCallState )
+        {
+        NotifyState();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::CVtEngIncomingCallMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngIncomingCallMonitor::CVtEngIncomingCallMonitor()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngIncomingCallMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngIncomingCallMonitor::ConstructL()
+    {
+    __VTPRINTENTER( "IncomingCall.ConstructL" )
+    // Listener for incoming call state
+    iIncomingCallListener = CVtEngPubSubsListener::NewL(
+    	KPSUidCtsyCallInformation, KCTsyCallState, this );
+    __VTPRINTEXIT( "IncomingCall.ConstructL" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/cvtengmdtrcommandsender.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,460 @@
+/*
+* Copyright (c) 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:  Mediator command sender implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cvtengmdtrcommandsender.h"
+#include    "CVtEngEventManager.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngSettings.h"
+#include    "CVtEngOperation.h"
+#include    "vtengcommands.h"
+#include    "CVtEngStateManager.h"
+#include    "VtEngPanic.h"
+#include    <mediatorcommandinitiator.h>
+#include    <mediatordomainuids.h> 
+#include    <mediatorcommandstotelephonyapi.h>
+#include    <mediatoraudiocommandstotelephonyapi.h>
+#include    <videoteltophonecommandsapi.h>
+#include    <cvtlogger.h>
+
+
+/**
+* Three state classes for handling audio mute/unmute commands towards mediator when mute state
+* is changed locally faster than mediator gives response.
+
+        
+                                             IDLE <-------------------------|    
+                                               |                            |
+             NotifyOutgoingAudioState( x ) / mediator.Send( x )             |
+                                               |                            |
+                                               v                            |
+    |--------------------------------------> SENDING -- CommandResponseL ---| 
+    |                                           |
+    |                           NotifyOutgoingAudioState( y ) / saveCommand( y )
+    |                                           |
+    |                                           v
+    |- CommandResponseL( x ) / Send( y ) ---- BUFFERED
+                             
+                             
+                             
+  
+*/
+NONSHARABLE_CLASS( TVtMdtrStateIdle ) : public CBase
+{
+    public:  
+        TVtMdtrStateIdle( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator );
+        virtual void SendL( TUid aDomain, TUid aCategory, TInt aCommand );       
+        virtual void CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus );
+        
+        TInt DoSend( TUid aDomain, TUid aCategory, TInt aCommand );
+        
+    CVtEngMdtrCommandSender& iSender;
+    CMediatorCommandInitiator& iMediator;
+};
+
+NONSHARABLE_CLASS( TVtMdtrStateSending ) : public TVtMdtrStateIdle
+{
+    public:
+        TVtMdtrStateSending( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator );
+        void SendL( TUid aDomain, TUid aCategory, TInt aCommand );
+        void CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus );        
+};
+
+NONSHARABLE_CLASS( TVtMdtrStateBuffered ) : public TVtMdtrStateIdle
+{
+    public:
+        TVtMdtrStateBuffered( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator );
+        void SendL( TUid aDomain, TUid aCategory, TInt aCommand );
+        void CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus );
+        
+        TUid iDomain;
+        TUid iCategory;
+        TInt iCommand;
+};
+
+    
+// CONSTANTS
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrCommandSender* CVtEngMdtrCommandSender::NewL( CVtEngUtility& aUtils )
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.NewL" )
+    CVtEngMdtrCommandSender* self = new ( ELeave )
+        CVtEngMdtrCommandSender( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+
+    __VTPRINTEXIT( "CVtEngMdtrCommandSender.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::~CVtEngMdtrCommandSender
+// destructor
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrCommandSender::~CVtEngMdtrCommandSender()
+    {
+    iUtils.EventManager().RemoveObserver( this );
+    delete iMediatorInitiator;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::EndCall
+// Sends end call command via Mediator
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::EndCall( )
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.EndCall" )
+    const TVersion KTelephonyCmdVersion(
+        KTelephonyCommandsVersionMajor,
+        KTelephonyCommandsVersionMinor,
+        KTelephonyCommandsVersionBuild );
+    const TInt res =
+        iMediatorInitiator->IssueCommand(
+           KMediatorTelephonyDomain,
+           KCatCommandsToTelephony,
+           EPhoneCmdEndActiveCall,
+           KTelephonyCmdVersion,
+           KNullDesC8() );
+    
+    __VTPRINTEXITR( "CVtEngMdtrCommandSender.EndCall res=%d", res )
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::VoiceFallback
+// Sends voice fallback command to telephony via Mediator
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::VoiceFallback()
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.VoiceFallback" )
+    const TVersion KVtToPhoneCmdVersion(
+        KVideoTelToPhoneCmdVersionMajor,
+        KVideoTelToPhoneCmdVersionMinor,
+        KVideoTelToPhoneCmdVersionBuild );
+#ifdef _DEBUG
+    TInt err =
+#endif
+    iMediatorInitiator->IssueCommand(
+        KMediatorTelephonyDomain,
+        KCatVideoTelToPhoneCommands,
+        EVtCmdFallback,
+        KVtToPhoneCmdVersion,
+        KNullDesC8() );
+    // response is not awaited
+    __VTPRINTEXITR( "CVtEngMdtrCommandSender.VoiceFallback %d>", err )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::SwitchToVoiceL
+// Sends switch to voice command to telephony via Mediator
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::SwitchToVoiceL( CVtEngOperation& aOperation )
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.SwitchToVoiceL" )
+    iOperation = &aOperation;
+    // add this as observer. Mediator command is sent when idle state
+    // is reached (i.e. Protocol has released dataport and it can be recovered
+    // by telephony)
+    iUtils.EventManager().AddObserverL( this );
+    // let current state handle actual request
+    iUtils.StateManager()->HandleOperationL( aOperation );
+    __VTPRINTEXIT( "CVtEngMdtrCommandSender.SwitchToVoiceL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::NotifyOutgoingAudioState
+// Sends microphone state to telephony via Mediator
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::NotifyOutgoingAudioState( 
+    const TBool aMicEnabled )
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.NotifyOutgoingAudioState" )    
+
+    const TInt command = ( aMicEnabled ) 
+        ? EAudioCmdUnmute : EAudioCmdMute;        
+#ifdef _DEBUG
+    TRAPD( res, iSenderState->SendL(
+            KMediatorTelephonyDomain,
+            KCatAudioCommandsToTelephony,
+            command ) );
+#else 
+    TRAP_IGNORE(iSenderState->SendL(
+            KMediatorTelephonyDomain,
+            KCatAudioCommandsToTelephony,
+            command ) );
+#endif
+            
+    __VTPRINTEXITR( "CVtEngMdtrCommandSender.NotifyOutgoingAudioState %d", res )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::SetSenderState
+// sets new mediator sender state for audio command
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::SetSenderState( TVtMdtrStateIdle& aNewState )
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.SetSenderState" )
+    __VTPRINT2( DEBUG_GEN, " delete old state %x", (TInt) iSenderState )
+    __ASSERT_DEBUG( iSenderState != &aNewState, 
+        Panic( EVtEngPanicWrongMediatorSenderState ) );
+    delete iSenderState;
+    iSenderState = &aNewState;
+    __VTPRINTEXITR( "CVtEngMdtrCommandSender.SetSenderState %x", (TInt) iSenderState )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::CommandResponseL
+// Mediator framework callback
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::CommandResponseL( TUid aDomain,
+    TUid aCategory, 
+    TInt aCommandId,
+    TInt aStatus,
+    const TDesC8& /*aData*/ )
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.CommandResponseL" )
+    switch ( aCommandId )
+        {
+    case EAudioCmdUnmute:
+    case EAudioCmdMute:
+        iSenderState->CommandResponseL( aDomain, aCategory, aCommandId, aStatus );
+        break;
+    default:
+        // ignored for other commands (so far)
+        break;
+        }             
+    __VTPRINT2( DEBUG_GEN, " mediator command id=%d", aCommandId )
+    __VTPRINTEXITR( "CVtEngMdtrCommandSender.CommandResponseL res=%d", aStatus )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::HandleVtEventL
+// Handles state change event associated with "switch to voice" and "TerminateSession" command
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::HandleVtEventL( TInt aEvent )
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.HandleVtEventL" )
+#ifdef _DEBUG
+        TInt err = KErrNone;
+#endif     
+    if ( aEvent == KVtEngSessionStateChanged &&
+         iOperation && iOperation->Command() == KVtEngSwitchToVoice )
+        {
+        const TVersion KVtToPhoneCmdVersion(
+            KVideoTelToPhoneCmdVersionMajor,
+            KVideoTelToPhoneCmdVersionMinor,
+            KVideoTelToPhoneCmdVersionBuild );
+        
+        iUtils.EventManager().RemoveObserver( this );
+        // send command (ignore possible error - no way to recover from it)
+#ifdef _DEBUG
+        err =
+#endif        
+        iMediatorInitiator->IssueCommand(
+            //KMediatorVideoTelephonyDomain,
+            KMediatorTelephonyDomain,
+            KCatVideoTelToPhoneCommands,
+            EVtCmdSwitchToVoice,
+            KVtToPhoneCmdVersion,
+            KNullDesC8() );
+        iOperation->HandleOpComplete( KErrNone );
+        iOperation = NULL;
+        }
+    __VTPRINTEXITR( "CVtEngMdtrCommandSender.HandleVtEventL %d", err )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::
+// c++ constructor
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrCommandSender::CVtEngMdtrCommandSender( CVtEngUtility& aUtils ) :
+    iUtils( aUtils )
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.CVtEngMdtrCommandSender" )
+    __VTPRINTEXIT( "CVtEngMdtrCommandSender.CVtEngMdtrCommandSender" )
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngMdtrCommandListener::ConstructL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrCommandSender::ConstructL()
+    {
+    __VTPRINTENTER( "CVtEngMdtrCommandSender.ConstructL" )
+    iMediatorInitiator = CMediatorCommandInitiator::NewL( this );
+    
+    // set initial mediator command sender state
+    iSenderState = new ( ELeave ) TVtMdtrStateIdle( *this, *iMediatorInitiator );
+    __VTPRINTEXIT( "CVtEngMdtrCommandSender.ConstructL" )
+    }
+
+TVtMdtrStateIdle::TVtMdtrStateIdle( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator ) 
+: iSender( aSender), iMediator( aMediator )
+    {
+    __VTPRINTENTER( "TVtMdtrStateIdle.ctr" )
+    __VTPRINTEXITR( "TVtMdtrStateIdle.ctr %x", (TInt) this )
+    }
+
+void TVtMdtrStateIdle::SendL( TUid aDomain, TUid aCategory, TInt aCommand )
+    {
+    __VTPRINTENTER( "TVtMdtrStateIdle.SendL" )
+    TVtMdtrStateIdle* nextState = NULL;
+    const TInt res = DoSend( aDomain, aCategory, aCommand );
+    if ( res == KErrInUse )
+        {
+        nextState = new ( ELeave ) TVtMdtrStateBuffered( iSender, iMediator );
+        CleanupStack::PushL( nextState );
+        nextState->SendL( aDomain, aCategory, aCommand );
+        CleanupStack::Pop( nextState );
+        }
+    else
+        {
+        nextState = new ( ELeave ) TVtMdtrStateSending( iSender, iMediator );
+        }
+    iSender.SetSenderState( *nextState );            
+    __VTPRINTEXIT( "TVtMdtrStateIdle.SendL" )
+    }
+
+TInt TVtMdtrStateIdle::DoSend( TUid aDomain, TUid aCategory, TInt aCommand )
+    {
+    __VTPRINTENTER( "TVtMdtrStateIdle.DoSend" )
+    const TVersion KVtToPhoneCmdVersion(
+        KVideoTelToPhoneCmdVersionMajor,
+        KVideoTelToPhoneCmdVersionMinor,
+        KVideoTelToPhoneCmdVersionBuild );
+        
+    TInt res = iMediator.IssueCommand(
+        aDomain,
+        aCategory,
+        aCommand,
+        KVtToPhoneCmdVersion,
+        KNullDesC8() );
+    __VTPRINTEXITR( "TVtMdtrStateIdle.DoSend res=%d", res )
+    return res;
+    }
+
+void TVtMdtrStateIdle::CommandResponseL( TUid /*aDomain*/, TUid /*aCategory*/, TInt /*aCommand*/, TInt /*aStatus*/ )
+    {
+    __VTPRINTENTER( "TVtMdtrStateIdle.CommandResponseL" )
+    // base class method should never be possible to call
+    __VTPRINTEXIT( "TVtMdtrStateIdle.CommandResponseL" )
+    }
+
+TVtMdtrStateSending::TVtMdtrStateSending( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator )
+: TVtMdtrStateIdle( aSender, aMediator )
+    {
+    __VTPRINTENTER( "TVtMdtrStateSending.ctr" )
+    __VTPRINTEXITR( "TVtMdtrStateSending.ctr %x", (TInt) this )
+    }
+
+void TVtMdtrStateSending::SendL( TUid aDomain, TUid aCategory, TInt aCommand )
+    { 
+    __VTPRINTENTER( "TVtMdtrStateSending.SendL" )    
+    TVtMdtrStateIdle* buffered = new ( ELeave )TVtMdtrStateBuffered( iSender, iMediator );
+    CleanupStack::PushL( buffered );
+    buffered->SendL( aDomain, aCategory, aCommand );
+    CleanupStack::Pop( buffered );
+    iSender.SetSenderState( *buffered );
+    __VTPRINTEXIT( "TVtMdtrStateSending.SendL" )
+    }
+
+void TVtMdtrStateSending::CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus )
+    {
+    __VTPRINTENTER( "TVtMdtrStateSending.CommandResponseL" )
+    __VTPRINT2( DEBUG_GEN, " command=%d", aCommand )    
+    __VTPRINT2( DEBUG_GEN, " response=%d", aStatus )    
+    TVtMdtrStateIdle* idle = new ( ELeave ) TVtMdtrStateIdle( iSender, iMediator );    
+    iSender.SetSenderState( *idle );
+    __VTPRINTEXIT( "TVtMdtrStateSending.CommandResponseL" )
+    }
+
+TVtMdtrStateBuffered::TVtMdtrStateBuffered( CVtEngMdtrCommandSender& aSender, CMediatorCommandInitiator& aMediator )
+: TVtMdtrStateIdle( aSender, aMediator )
+    {
+    __VTPRINTENTER( "TVtMdtrStateBuffered.ctr" )
+    __VTPRINTEXITR( "TVtMdtrStateBuffered.ctr %x", (TInt) this )
+    }
+
+void TVtMdtrStateBuffered::SendL( TUid aDomain, TUid aCategory, TInt aCommand )
+    {
+    __VTPRINTENTER( "TVtMdtrStateBuffered.SendL" )    
+    
+    iDomain = aDomain;
+    iCategory = aCategory;
+    iCommand = aCommand;
+    // iCommand is sent in CommandResponseL
+    __VTPRINTEXIT( "TVtMdtrStateBuffered.SendL" )
+    }
+
+void TVtMdtrStateBuffered::CommandResponseL( TUid aDomain, TUid aCategory, TInt aCommand, TInt aStatus )
+    {
+    __VTPRINTENTER( "TVtMdtrStateBuffered.CommandResponseL" )    
+    const TVersion KVtToPhoneCmdVersion(
+        KVideoTelToPhoneCmdVersionMajor,
+        KVideoTelToPhoneCmdVersionMinor,
+        KVideoTelToPhoneCmdVersionBuild );
+    TBool nextStateIdle = ETrue;
+    TInt res = KErrNone;
+    if ( aCommand != iCommand )    
+        {
+        res = iMediator.IssueCommand(
+            KMediatorTelephonyDomain,
+            KCatAudioCommandsToTelephony,
+            iCommand,
+            KVtToPhoneCmdVersion,
+            KNullDesC8() );
+        if ( res == KErrNone )
+            {    
+            nextStateIdle = EFalse;
+            }        
+        }
+    TVtMdtrStateIdle* nextState = NULL;
+    if ( nextStateIdle )
+        {
+        __VTPRINT2( DEBUG_GEN, " failed to send buffered command with error=%d", res )
+        nextState = new ( ELeave ) TVtMdtrStateIdle( iSender, iMediator );
+        }
+    else
+        {
+        nextState = new ( ELeave ) TVtMdtrStateSending( iSender, iMediator );
+        CleanupStack::PushL( nextState );
+        nextState->SendL( iDomain, iCategory, iCommand );
+        CleanupStack::Pop( nextState );
+        }
+    iSender.SetSenderState( *nextState );    
+    __VTPRINTEXIT( "TVtMdtrStateBuffered.CommandResponseL" )
+    }
+        
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/cvtengmdtrmessagelistener.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,321 @@
+/*
+* Copyright (c) 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:  Mediator event listener implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cvtengmdtrmessagelistener.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngSettings.h"
+#include    "CVtEngEventManager.h"
+#include    "cvtengmediatorservice.h"
+
+#include    <cvtlogger.h>
+#include    <videotelcontrolmediatorapi.h>
+#include    <mediatorcommandresponder.h>
+#include    <mediatordomainuids.h>
+#include    <mediatoreventsfromtelephonyapi.h>
+#include    <vtinternalmediatorapi.h>
+
+// CONSTANTS
+
+// mediator command timeout
+static const TInt KVtEngMdtrCmdTimeout = 500000;
+
+// array granularity is 2 (enable mic, disable mic commands)
+static const TInt KVtEngMdtrCmdArrayGranularity = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrMessageListener* CVtEngMdtrMessageListener::NewL(
+    CVtEngUtility& aUtils )
+    {
+    __VTPRINTENTER( "CVtEngMdtrMessageListener.NewL" )
+    CVtEngMdtrMessageListener* self = new( ELeave ) 
+        CVtEngMdtrMessageListener( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtEngMdtrMessageListener.NewL" )
+    return self;
+    }
+
+// Destructor
+CVtEngMdtrMessageListener::~CVtEngMdtrMessageListener()
+    {
+    // ignore error in unregistering
+    if ( iMediatorResponder )
+        {
+        iMediatorResponder->UnregisterCommand( 
+                KMediatorVideoTelephonyDomain,
+                KCatPhoneToVideotelCommands,
+                iCommandList );
+        iCommandList.Close();
+        iMediatorResponder->UnregisterCommand(
+                KMediatorVideoTelephonyDomain,
+                KCatVideotelInternalCommands,
+                EVtMediatorReleaseDataport );
+                
+        delete iMediatorResponder;
+        }
+    
+             
+    // ignore error in unregistering
+    if ( iMediatorEvents )
+        {
+        iMediatorEvents->UnsubscribeEvent( KMediatorVideoTelephonyDomain,
+                KCatVideotelInternalEvents,
+                EVtMediatorEventVideoCallInformation );
+        delete iMediatorEvents;
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::MediatorCommandL
+// Receives mediator command and passes it to service object
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::MediatorCommandL( 
+    TUid /*aDomain*/,
+    TUid aCategory, 
+    TInt aCommandId, 
+    TVersion /*aVersion*/,
+    const TDesC8& /*aData*/ )
+    {
+    __VTPRINTENTER( "CVtEngMdtrMessageListener.MediatorCommandL" )
+    // service object destroys itself after sending command response
+    CVtEngMediatorService::StartLD( *iMediatorResponder, iUtils, aCategory, aCommandId );    
+    __VTPRINTEXIT( "CVtEngMdtrMessageListener.MediatorCommandL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::CancelMediatorCommand
+// Cancallation of mediator command. no-op, just returns response.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::CancelMediatorCommand( 
+    TUid /*aDomain*/,
+    TUid /*aCategory*/, 
+    TInt /*aCommandId*/ )
+    {
+    __VTPRINTENTER( "CVtEngMdtrMessageListener.CancelMediatorCommand" )
+    // No-op    
+    __VTPRINTEXIT( "CVtEngMdtrMessageListener.CancelMediatorCommand" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrEventListener::MediatorEventL
+// Receives mediator event from VT Mediator Plugin. The event
+// contains CLI and/or Dataport name.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::MediatorEventL( TUid /*aDomain*/,
+    TUid aCategory, 
+    TInt aEventId, 
+    const TDesC8& aData )
+    {
+    __VTPRINTENTER( "CVtEngMdtrMessageListener.MediatorEventL" )
+    if  ( aCategory == KCatVideotelInternalEvents && 
+        aEventId == EVtMediatorEventVideoCallInformation )
+        {        
+        TVtMediatorInfoPackage package;
+        package.Copy( aData );
+        TVtVideoTelephonyCallInformation data = package();
+        __VTPRINT2( DEBUG_GEN, " VT call info data validity value=%d", 
+            data.iEventDataValidity)
+        // if message contains dataport name save it
+        CVtEngSettings& settings = iUtils.Settings();
+        if ( data.iEventDataValidity & 
+            TVtVideoTelephonyCallInformation::EDataportValid )
+            {
+            //__VTPRINT(DEBUG_GEN, " Dataport is ready")
+            settings.SetDataportInfoL( data.iDataport );
+            }                                       
+        // if message contains CLI info handle it (save and notify if state 
+        // allows)
+        if ( data.iEventDataValidity & 
+            TVtVideoTelephonyCallInformation::EDisplayTextValid )
+            {            
+            MVtEngSessionInfo::TCLI cli;
+            cli.iCallId = data.iCallId;
+            cli.iName = data.iDisplayText.Left( cli.iName.MaxLength() );
+            cli.iVoiceCallPossible = data.iVoiceCallPossible;
+            settings.SetCLI( cli );
+            
+            // ready == call is answered (allows setting app to foreground)
+            if ( IsReadyForCLIEvent() )
+                {
+                // send event about CLI availability
+                CVtEngEventManager::NotifyEvent( KVtEngCLIAvailable );                
+                }
+            else
+                {
+                // Wait until connected state is reached (see HandleVtEventL)
+                __VTPRINT( DEBUG_GEN, 
+                    "CVtEngMdtrMessageListener defer CLI event" )
+                iUtils.EventManager().AddObserverL( this );
+                }
+            }
+        }
+    __VTPRINTEXIT( "CVtEngMdtrMessageListener.MediatorEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::HandleVtEventL
+//
+// Handles defered CLI event dispatching (to UI). CLI event was defered because
+// engine state was not suitable in MediatorEventL which then started observing
+// state changes.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::HandleVtEventL( TInt aEvent )
+    {
+    __VTPRINTENTER( "CVtEngMdtrMessageListener.HandleVtEventL" )
+    if ( aEvent == KVtEngSessionStateChanged &&
+         IsReadyForCLIEvent() ) // <- ready == call is answered
+        {
+        iUtils.EventManager().RemoveObserver( this );
+        __VTPRINT( DEBUG_GEN, 
+            "CVtEngMdtrMessageListener dispatch defered CLI event" )
+        CVtEngEventManager::NotifyEvent( KVtEngCLIAvailable );
+        }
+    
+    __VTPRINTEXIT( "CVtEngMdtrMessageListener.HandleVtEventL" )
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMdtrMessageListener::ConstructL()
+    {
+    __VTPRINTENTER( "CVtEngMdtrMessageListener.ConstructL" )
+    
+    // for sending command responses
+    iMediatorResponder = CMediatorCommandResponder::NewL( this );
+    
+    // for receiving events from VT Mediator Plugin (dataport/CLI info)
+    iMediatorEvents = CMediatorEventConsumer::NewL( this );
+    
+    TCapabilitySet capSet;
+    capSet.SetEmpty();
+    // for audio control
+    capSet.AddCapability( ECapabilityWriteDeviceData ); 
+    
+    // define common attributes for all commands that engine is responsible for
+    MediatorService::TCommand command;
+    command.iCaps = capSet;
+    command.iVersion = TVersion( 
+        KPhoneToVideotelCmdVersionMajor, 
+        KPhoneToVideotelCmdVersionMinor,
+        KPhoneToVideotelCmdVersionBuild );
+    command.iTimeout = KVtEngMdtrCmdTimeout;
+    
+    // enable microphone command
+    command.iCommandId = EVtCmdUnmute;
+    iCommandList.Append( command );
+    
+    // disable microphone command
+    command.iCommandId = EVtCmdMute;
+    iCommandList.Append( command );
+        
+    // register VT events that are raised by VT Mediator Plugin. 
+    // !!! Note !!!!
+    // event subscription must be done before command registration because
+    // command registration triggers raising the event in the plugin. Different 
+    // order would cause the engine to miss the event.
+    const TVersion commandVersion( 
+            KVideotelMdtrCommandsVersionMajor,
+            KVideotelMdtrCommandsVersionMinor,
+            KVideotelMdtrCommandsVersionBuild );
+    //capSet.SetEmpty();
+    //capSet.AddCapability( ECapabilityPowerMgmt );
+        
+    iMediatorResponder->RegisterCommand( 
+                KMediatorVideoTelephonyDomain,
+                KCatVideotelInternalCommands,
+                EVtMediatorReleaseDataport,
+                commandVersion,
+                capSet,
+                KVtEngMdtrCmdTimeout );
+    
+    const TVersion eventVersion( 
+                KTelephonyEventsVersionMajor,
+                KTelephonyEventsVersionMinor,
+                KTelephonyEventsVersionBuild );
+    
+    TInt res = iMediatorEvents->SubscribeEvent( KMediatorVideoTelephonyDomain,
+            KCatVideotelInternalEvents,
+            EVtMediatorEventVideoCallInformation, 
+            eventVersion );
+    
+    if ( res == KErrNone )
+        {
+        // register Mediator commands that we handle
+        res = iMediatorResponder->RegisterCommand( 
+            KMediatorVideoTelephonyDomain,
+            KCatPhoneToVideotelCommands,
+            iCommandList );
+        
+        }
+    __VTPRINTEXITR( "CVtEngMdtrMessageListener.ConstructL res=%d",res )
+    // registering must not fail
+    User::LeaveIfError( res );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::CVtEngMdtrMessageListener
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngMdtrMessageListener::CVtEngMdtrMessageListener( CVtEngUtility& aUtils)
+ : iUtils( aUtils ), iCommandList( KVtEngMdtrCmdArrayGranularity )
+    {    
+    __VTPRINTENTER( "CVtEngMdtrMessageListener.CVtEngMdtrMessageListener" )
+    __VTPRINTEXIT( "CVtEngMdtrMessageListener.CVtEngMdtrMessageListener" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMdtrMessageListener::IsReadyForCLIEvent
+// Checks if engine state is appropriate to send CLI event.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMdtrMessageListener::IsReadyForCLIEvent() const
+    {
+    __VTPRINTENTER( "CVtEngMdtrMessageListener.IsReadyForCLIEvent" )
+    const MVtEngSessionInfo::TSessionState state = 
+        iUtils.StateManager()->SessionState();
+    const TBool isReady =
+       ( state == MVtEngSessionInfo::EConnected || 
+         state == MVtEngSessionInfo::ENegotiating ||
+         state == MVtEngSessionInfo::EOpen );    
+    __VTPRINTEXITR( "CVtEngMdtrMessageListener.IsReadyForCLIEvent %d>", 
+        isReady )
+    return isReady;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Base/cvtengmediatorservice.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,301 @@
+/*
+* Copyright (c) 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:  Mediator service implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cvtengmediatorservice.h"
+#include    "cvtenginternaloperation.h"
+#include    "CVtEngStateManager.h"
+#include    "CVtEngEventManager.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngSettings.h"
+#include    <cvtlogger.h>
+#include    <mediatorcommandresponder.h>
+#include    <mediatordomainuids.h>
+#include    <videotelcontrolmediatorapi.h> 
+#include    <videoteltophonecommandsapi.h>
+#include    <vtinternalmediatorapi.h>
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::StartLD
+// Mediator service starter.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::StartLD( 
+        CMediatorCommandResponder& aResponder,
+        CVtEngUtility& aUtils,
+        const TUid aCategory,
+        const TInt aCommand )
+    {
+    __VTPRINTENTER( "CVtEngMediatorService.StartLD" )
+    CVtEngMediatorService* self = new ( ELeave ) CVtEngMediatorService(
+        aResponder, aUtils, aCategory, aCommand );
+    CleanupStack::PushL( self );
+    self->ConstructAndDoServiceL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtEngMediatorService.StartLD" )
+    }
+    
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVtEngMediatorService::~CVtEngMediatorService()
+    {
+    // ensure this is removed
+    __VTPRINTENTER( "CVtEngMediatorService::~CVtEngMediatorService" )
+    iUtils.EventManager().RemoveObserver( this );
+    
+    // send response if destructed due to leave in ConstructAndDoServiceL
+    SendMediatorResponseD( EFalse );
+    __VTPRINTEXIT( "CVtEngMediatorService::~CVtEngMediatorService" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::SetOperation
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::SetOperation( CVtEngOperation* /*aActiveOp*/ )
+    {
+    __VTPRINTENTER( "CVtEngMediatorService.SetOperation" )
+    // no-op
+    __VTPRINTEXIT( "CVtEngMediatorService.SetOperation" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::CommandCompleteL
+// callback to internal operation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::CommandCompleteL(
+    const TVtEngCommandId /*aCommand*/,
+    const TInt aResult )
+    {
+    __VTPRINTENTER( "CVtEngMediatorService.CommandCompleteL" )
+
+    iServiceStatus = aResult;
+
+    // Sends response to Telephony if not already sent by
+    // HandleVtEventL -> SendMediatorResponseD
+    SendMediatorResponseD( ETrue );
+    __VTPRINTEXITR( "CVtEngMediatorService.CommandCompleteL %d", aResult )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::HandleVtEventL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::HandleVtEventL( TInt aEvent )
+    {
+    __VTPRINTENTER( "CVtEngMediatorService.HandleVtEventL" )
+    
+    // This is registered event observer when shutdown mediator command was
+    // received. Now send response if state precondition is met
+    if ( aEvent == KVtEngSessionStateChanged &&
+         IsShuttingDown() )
+        {
+        // no interest on events any more, task fulfilled
+        iUtils.EventManager().RemoveObserver( this );
+        
+        // iServiceStatus used for mediator response
+        iServiceStatus = KErrNone;
+        
+        SendMediatorResponseD( EFalse );
+        }
+    __VTPRINTEXIT( "CVtEngMediatorService.HandleVtEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::CVtEngMediatorService
+// -----------------------------------------------------------------------------
+//
+CVtEngMediatorService::CVtEngMediatorService( 
+    CMediatorCommandResponder& aResponder, 
+    CVtEngUtility& aUtils,
+    const TUid aCategory,
+    const TInt aCommandId ) :
+    iResponder( aResponder ), 
+    iUtils( aUtils ),
+    iCategory( aCategory ),
+    iCommandId( aCommandId ),
+    iServiceStatus( KErrNotReady )
+    {
+    __VTPRINTENTER( "CVtEngMediatorService.CVtEngMediatorService" )
+    __VTPRINTEXIT( "CVtEngMediatorService.CVtEngMediatorService" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::ConstructAndDoServiceL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::ConstructAndDoServiceL()
+    {
+    __VTPRINTENTER( "CVtEngMediatorService.ConstructAndDoServiceL" )
+    __VTPRINT2( DEBUG_GEN, " CVtEngMediatorService.ConstructAndDoServiceL command id=%d", iCommandId )
+    // if starting of any operation below fails (StartOperationL leaves),
+    // this object is deleted. Destructor sends mediator response.
+    // non-supported command leads to leave+destructor also (see default case)
+    if ( KCatVideotelInternalCommands == iCategory)
+        {
+        switch ( iCommandId )
+            {
+            case EVtMediatorReleaseDataport:
+                if ( !IsShuttingDown()  )
+                    {
+                    // Mediator response is sent when state becomes appropriate, 
+                    // indicated by call to HandleVtEventL, or
+                    // when operation callback CommandCompleteL is called,
+                    // which ever comes first. However, this object is deleted
+                    // only after operation callback is received.
+                    iUtils.EventManager().AddObserverL( this );
+                    StartOperationL( KVtEngTerminateSession );
+                    }     
+                // if already shutting down this is no op (and self destructed)
+                // if get this command because endactivecall from vt menu, do not do any op from here
+                else 
+                    {
+                    SendMediatorResponseD(EFalse);
+                    }
+                break;
+            default:
+                // requested command that is not supported, issue "failed" response
+                iServiceStatus = KErrNotSupported;            
+                break;
+            }
+        }
+    else
+        {
+        switch ( iCommandId )
+            {
+            case EVtCmdUnmute:
+            case EVtCmdMute:
+                {
+                TVtEngCommandId engineCmd = ( iCommandId == 
+                    EVtCmdUnmute ) ? KVtEngUnmuteOutgoingAudio : 
+                    KVtEngMuteOutgoingAudio;
+                if ( !IsShuttingDown()  )
+                    {
+                    StartOperationL( engineCmd );
+                    }
+                else
+                    {
+                    SendMediatorResponseD(EFalse);
+                    }
+                }
+                break;
+            default:
+                // requested command that is not supported, issue "failed" response
+                iServiceStatus = KErrNotSupported;            
+                break;
+            }     
+        }
+    if ( iServiceStatus != KRequestPending && !IsShuttingDown() )
+        { // results in destruction of this object and sending of mediator 
+          // response with error
+        //__VTPRINT2( DEBUG_GEN, "CVtEngMediatorService.ConstructAndDoServiceL leave by iServiceStatus: %d", iServiceStatus )
+        User::Leave( iServiceStatus );
+        }
+     
+    __VTPRINTEXIT( "CVtEngMediatorService.ConstructAndDoServiceL" )
+    }
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::IsShuttingDown
+// Checks if shutdown is ongoing
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediatorService::IsShuttingDown() const
+    {
+    __VTPRINTENTER( "CVtEngMediatorService.IsShuttingDown" )
+    const MVtEngSessionInfo::TSessionState state = 
+        iUtils.StateManager()->SessionState();
+    TBool isShuttingDown = EFalse;
+    
+    // consider shutdown true if clearing or idle
+    if ( state == MVtEngSessionInfo::EClearing || 
+         state == MVtEngSessionInfo::EIdle )
+        {
+        isShuttingDown = ETrue;            
+        }
+    __VTPRINTEXITR( "CVtEngMediatorService.IsShuttingDown %d",
+        isShuttingDown )
+    return isShuttingDown;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::StartOperationL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::StartOperationL( const TVtEngCommandId aCommand )
+    {
+    __VTPRINTENTER( "CVtEngMediatorService.StartOperationL" )
+    iOperation = CVtEngInternalOperation::NewL( 
+        aCommand,
+        iUtils.StateManager()->Handlers(),
+        *this );        
+    iOperation->ExecuteL();
+    iServiceStatus = KRequestPending;
+    __VTPRINTEXIT( "CVtEngMediatorService.StartOperationL" )
+    }
+        
+// -----------------------------------------------------------------------------
+// CVtEngMediatorService::SendMediatorResponseD
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediatorService::SendMediatorResponseD( const TBool aDeleteThis )
+    {
+    __VTPRINTENTER( "CVtEngMediatorService.SendMediatorResponseD" )
+    __VTPRINT2( DEBUG_GEN, "CVtEngMediatorService.SendMediatorResponseD command: %d", iCommandId )
+    if ( iCommandId != KErrNotFound )
+        {
+        if ( iCategory == KCatVideotelInternalCommands && iCommandId == EVtMediatorReleaseDataport )
+            {
+            iResponder.IssueResponse(
+                KMediatorVideoTelephonyDomain,
+                KCatVideotelInternalCommands,
+                iCommandId,
+                iServiceStatus,
+                KNullDesC8() );
+              }
+        else
+            {
+            iResponder.IssueResponse(
+                KMediatorVideoTelephonyDomain,
+                KCatPhoneToVideotelCommands,
+                iCommandId,
+                iServiceStatus,
+                KNullDesC8() );
+            }
+            
+        // prevents further response because destructor also calls this method
+        iCommandId = KErrNotFound;
+        }
+    if ( aDeleteThis )
+        {
+        // note! check above is mandatory because this method is called
+        // also from destructor.
+        delete this;
+        }
+    __VTPRINTEXIT( "CVtEngMediatorService.SendMediatorResponseD" )
+    }
+        
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Commands/CVtEngCommandHandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,549 @@
+/*
+* 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:  Handles commands from user interface.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include    <e32std.h>
+#include    "CVtEngCommandHandler.h"
+#include    "CVtEngHandlerContainer.h"
+#include    "MVtEngCommandObserver.h"
+#include    "CVtEngOperation.h"
+#include    <cvtlogger.h>
+#include    "CVtEngStateManager.h"
+#include    <videotelephonyvariant.hrh>
+#include    "VtEngUtils.h"
+
+#include    "CVtEngStateIdle.h"
+#include    "CVtEngStateInitializing.h"
+#include    "CVtEngStateConnected.h"
+#include    "CVtEngStateRinging.h"
+#include    "CVtEngStateOpen.h"
+#include    "CVtEngStateNegotiating.h"
+#include    "CVtEngStateClearing.h"
+#include    "CVtEngStateAlerting.h"
+
+// CONSTANTS
+const TInt KVtEngCommandPoolCommands = 1;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CVtEngCommandHandler
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngCommandHandler::CVtEngCommandHandler(
+    CVtEngHandlerContainer& aHandlers ) :
+    iObservers( 1 ),
+    iHandlers( aHandlers )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::ConstructL()
+    {
+    __VTPRINTENTER( "CmdHlr.ConstructL" )
+    iCommandPool = new ( ELeave ) CVtEngCmdPool( KVtEngCommandPoolCommands );
+
+    // session termination
+    AddToPoolL( KVtEngInitializeEngine );
+    AddToPoolL( KVtEngInitializeEngineDiag );
+    AddToPoolL( KVtEngInitializeEngineTest );
+    AddToPoolL( KVtEngPrepareViewFinder );
+    AddToPoolL( KVtEngPrepareRemoteRenderDSA );
+    AddToPoolL( KVtEngPrepareRemoteRenderDP );
+    AddToPoolL( KVtEngPrepareRemoteRenderNGA );
+    AddToPoolL( KVtEngResetEngine );
+    __VTPRINTEXIT( "CmdHlr.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngCommandHandler* CVtEngCommandHandler::NewL( CVtEngHandlerContainer& aHandlers )
+    {
+    __VTPRINT( DEBUG_GEN | DEBUG_CONSTRUCT, "CmdHlr.New")
+    CVtEngCommandHandler* self = new( ELeave ) CVtEngCommandHandler( aHandlers );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// Destructor
+CVtEngCommandHandler::~CVtEngCommandHandler()
+    {
+    __VTPRINTENTER( "CmdHlr.~" )
+    iObservers.Close();
+    if ( iActiveOp )
+        {
+        if ( iCommandPool->Get( iActiveOp->Command() ) == NULL )
+            {
+            delete iActiveOp;
+            }
+        }
+    delete iCommandPool;
+    __VTPRINTEXIT( "CmdHlr.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::ExecuteL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::ExecuteL(
+            const TVtEngCommandId aCommandId,
+            TDesC8* aParams )
+    {
+    __VTPRINTENTER( "CmdHlr.ExecuteL" )
+
+    __VTPRINT2( DEBUG_GEN, "ComHlr:Exec cmdId=%d", aCommandId )
+    ValidateL( aCommandId, aParams );
+    CVtEngOperation* opFromPool = iCommandPool->Get( aCommandId );
+    CVtEngOperation* op = opFromPool;
+    if ( op == NULL )
+        {
+        op = CVtEngOperation::NewL( aCommandId, iHandlers, *this );
+        CleanupStack::PushL( op );
+        }
+
+    switch ( aCommandId )
+        {
+        case KVtEngInitializeEngine:
+        case KVtEngInitializeEngineTest:
+        case KVtEngInitializeEngineDiag:
+        case KVtEngResetEngine:
+        case KVtEngTerminateSession:
+        case KVtEngStartViewFinder:
+        case KVtEngStopViewFinder:
+        case KVtEngStartRenderRemote:
+        case KVtEngStopRenderRemote:
+        case KVtEngPauseRenderRemote:
+        case KVtEngMuteOutgoingAudio:
+        case KVtEngUnmuteOutgoingAudio:
+        case KVtEngStopDtmfTone:
+        case KVtEngRequestLastRemoteFrame:
+        // Handling of different UIIs
+        case KVtEngSetUIIDtmfSupport:
+        case KVtEngSetUIIBasicStringSupport:
+        case KVtEngSetUIIIA5StringSupport:
+        case KVtEngSetUIIGeneralStringSupport:
+        case KVtEngFreeze:
+        case KVtEngUnfreeze:
+        case KVtEngHandleLayoutChange:
+
+        // Media object sharing (no parameters )
+        case KVtEngStartShareImage:
+        case KVtEngStopShareImage:
+            op->ExecuteL( NULL );
+            break;
+        // Media
+        case KVtEngSetUIForeground:
+        case KVtEngPrepareCamera:
+        case KVtEngPrepareViewFinder:
+        case KVtEngPrepareViewFinderDSA:
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareViewFinderDP:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRenderNGA:
+        case KVtEngSetSource:
+        case KVtEngSetZoomStep:
+        case KVtEngSetAudioRouting:
+        case KVtEngSetAudioVolume:
+        case KVtEngIncreaseAudioVolume:
+        case KVtEngDecreaseAudioVolume:
+        case KVtEngSendDtmf:
+        case KVtEngStartDtmfTone:
+        case KVtEngSetVideoQuality:
+        case KVtEngSwitchToVoice:
+        // Extension commands
+        case KVtEngSetContrast:
+        case KVtEngSetBrightness:
+        case KVtEngSetWhiteBalance:
+        case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+        case KVtEngStartRecord:
+        case KVtEngStopRecord:
+#endif
+        // Media object sharing (with parameters )
+        case KVtEngInitializeShareImage:
+            // Flow through, ok to execute
+            op->ExecuteL( aParams );
+            break;
+        default:
+            User::Leave( KErrNotSupported );
+        }
+    if ( opFromPool == NULL )
+        {
+        CleanupStack::Pop( ); // op (deletes itself)
+        }
+    CVtEngStateManager* states = CVtEngUtility::StateManager();
+    states->Update();
+    __VTPRINTEXIT( "CmdHlr.ExecuteL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CancelCommand
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCommandHandler::CancelCommand( const TVtEngCommandId aCommandId )
+    {
+    __VTPRINTENTER( "CmdHlr.CancelCommand" )
+
+    __VTPRINT2( DEBUG_GEN, "ComHlr.Cancel cmd=%d", aCommandId )
+    TInt err( KErrGeneral );
+    if ( iActiveOp &&
+         iActiveOp->Command() == aCommandId &&
+         aCommandId != KVtEngResetEngine &&
+         aCommandId != KVtEngInitializeEngineTest &&
+         aCommandId != KVtEngInitializeEngineDiag)
+        {
+        iActiveOp->Cancel();
+        err = KErrNone;
+        }
+    __VTPRINT2( DEBUG_GEN | DEBUG_DETAIL, "ComHlr.Cancel res=%d",err )
+    __VTPRINTEXIT( "CmdHlr.CancelCommand" )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::GetCommandCaps
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngCommandHandler::GetCommandCaps(
+    const TVtEngCommandId aCommand )
+    {
+    TInt caps( 0 );
+    CheckAsynchronity( aCommand, caps );
+    CheckSupport( aCommand, caps );
+    CheckState( aCommand, caps );
+    return caps;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::PendingCommand
+//
+// -----------------------------------------------------------------------------
+//
+TVtEngCommandId CVtEngCommandHandler::PendingCommand()
+    {
+    if ( iActiveOp )
+        {
+        return iActiveOp->Command();
+        }
+    return KVtEngCommandNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::AddObserverL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::AddObserverL(
+    MVtEngCommandObserver& aObserver )
+    {
+    User::LeaveIfError( iObservers.Append( &aObserver ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::RemoveObserver
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::RemoveObserver(
+    MVtEngCommandObserver& aObserver )
+    {
+    const TInt pos( iObservers.Find( &aObserver ) );
+    if ( pos >= 0 )
+        {
+        iObservers.Remove( pos );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CommandCompleteL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::CommandCompleteL(
+            const TVtEngCommandId aCommand,
+            const TInt aResult )
+    {
+    __VTPRINTENTER( "CmdHlr.CommandCompleteL" )
+    __VTPRINT3( DEBUG_GEN, " completed cmd=%d,res=%d", aCommand, aResult )
+    TInt count( iObservers.Count() );
+    while ( count-- )
+        {
+        MVtEngCommandObserver* observer = iObservers[ count ];
+        observer->HandleVTCommandPerformedL( aCommand, aResult );
+        }
+    __VTPRINTEXIT( "CmdHlr.CommandCompleteL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::SetOperation
+// Sets active operation
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::SetOperation( CVtEngOperation* aActiveOp )
+    {
+    iActiveOp = aActiveOp;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::AddToPoolL
+// Adds a command to command pool. Only commands without parameters and
+// that don't delete themselfs can currently be added.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::AddToPoolL( TVtEngCommandId aCommand )
+    {
+    CVtEngOperation* op = CVtEngOperation::NewL(
+        aCommand, iHandlers, *this, EFalse );
+    CleanupStack::PushL( op );
+    iCommandPool->AppendL( op );
+    CleanupStack::Pop(); // op
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::ValidateL
+// Checks if command can be performed.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::ValidateL(
+            const TVtEngCommandId aCommandId,
+            TDesC8* /*aParams*/ )
+    {
+    // check if async command is already pending and new
+    // command is async
+    TInt caps( 0 );
+    CheckState( aCommandId, caps );
+    if ( !(caps & EAttribEnabled ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CheckAsynchronity
+// Checks if command is async
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::CheckAsynchronity(
+            const TVtEngCommandId aCommandId,
+            TInt& aCaps )
+    {
+    switch ( aCommandId )
+        {
+        case KVtEngInitializeEngine:
+        case KVtEngInitializeEngineTest:
+        case KVtEngInitializeEngineDiag:
+        case KVtEngResetEngine:
+        case KVtEngTerminateSession:
+        case KVtEngSetSource:
+        case KVtEngPrepareCamera:
+        case KVtEngSetAudioRouting:
+        case KVtEngMuteOutgoingAudio:
+        case KVtEngUnmuteOutgoingAudio:
+        case KVtEngSetAudioVolume:
+        case KVtEngHandleLayoutChange:
+        case KVtEngUnfreeze:
+
+        // Media object sharing
+        case KVtEngInitializeShareImage:
+        case KVtEngStartShareImage:
+        case KVtEngStopShareImage:
+        case KVtEngSwitchToVoice:
+            aCaps |= EAttribAsync;
+            break;
+        default:
+            aCaps &= (~EAttribAsync);
+            break;
+        }
+    __VTPRINT3( DEBUG_GEN | DEBUG_RETURN, "ComHlr:capsA cmd=%d,caps=%d", aCommandId, aCaps )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CheckSupport
+// Checks if command is supported
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::CheckSupport(
+            const TVtEngCommandId aCommandId,
+            TInt& aCaps )
+    {
+    switch ( aCommandId )
+        {
+        case KVtEngInitializeEngine:
+        case KVtEngInitializeEngineTest:
+        case KVtEngInitializeEngineDiag:
+        case KVtEngResetEngine:
+        case KVtEngTerminateSession:
+        case KVtEngStartViewFinder:
+        case KVtEngStopViewFinder:
+        case KVtEngPrepareViewFinder:
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRenderNGA:
+        case KVtEngStartRenderRemote:
+        case KVtEngStopRenderRemote:
+        case KVtEngSetAudioRouting:
+        case KVtEngSetAudioVolume:
+        case KVtEngIncreaseAudioVolume:
+        case KVtEngDecreaseAudioVolume:        
+        case KVtEngPauseRenderRemote:
+        case KVtEngMuteOutgoingAudio:
+        case KVtEngUnmuteOutgoingAudio:
+        case KVtEngSetSource:
+        case KVtEngPrepareCamera:
+        case KVtEngStartDtmfTone:
+        case KVtEngStopDtmfTone:
+        case KVtEngFreeze:
+        case KVtEngUnfreeze:
+        case KVtEngSetVideoQuality:
+        case KVtEngHandleLayoutChange:
+        // Handling of different UIIs, support is there
+        case KVtEngSetUIIDtmfSupport:
+        case KVtEngSetUIIBasicStringSupport:
+        case KVtEngSetUIIIA5StringSupport:
+        case KVtEngSetUIIGeneralStringSupport:
+        case KVtEngSetUIForeground:
+        case KVtEngRequestLastRemoteFrame:
+
+        // Media object sharing
+        case KVtEngInitializeShareImage:
+        case KVtEngStartShareImage:
+        case KVtEngStopShareImage:
+        case KVtEngSwitchToVoice:
+            aCaps |= EAttribSupported;
+            break;
+
+        // Extension commands
+	    case KVtEngSetContrast:
+	    case KVtEngSetBrightness:
+	    case KVtEngSetWhiteBalance:
+	    case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+	    case KVtEngStartRecord:
+	    case KVtEngStopRecord:
+#endif
+            aCaps |= EAttribSupported;
+            break;
+
+        default:
+            aCaps &= (~EAttribSupported);
+            __VTPRINT( DEBUG_GEN, "ComHlr.NOT SUPPORTED" )
+            break;
+        }
+    __VTPRINT3( DEBUG_GEN | DEBUG_DETAIL, "  capsSupport cmd=%d,caps=%d", aCommandId, aCaps )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CheckState
+// Checks if command is possible in current state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngCommandHandler::CheckState(
+    const TVtEngCommandId aCommandId,
+    TInt& aCaps )
+    {
+    aCaps &= (~EAttribEnabled);
+    if ( !(iActiveOp && ( aCaps & EAttribAsync ) ) )
+        {
+        const CVtEngStateManager* states = CVtEngUtility::StateManager();
+        if ( states->IsCommandPossible( aCommandId ) )
+            {
+            aCaps |= EAttribEnabled;
+            }
+#ifdef VTDEBUG
+        else
+            {
+            __VTPRINT( DEBUG_GEN, "ComHlr.ChkState INVALID" )
+            }
+#endif // VTDEBUG
+        }
+    __VTPRINT3( DEBUG_GEN | DEBUG_DETAIL, "  capsState cmd=%d,caps=%d", aCommandId, aCaps )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CVtEngCmdPool::CVtEngCmdPool
+// C++ constructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngCommandHandler::CVtEngCmdPool::CVtEngCmdPool( TInt aGranularity ) :
+    CArrayPtrFlat<CVtEngOperation>( aGranularity )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CVtEngCmdPool::CVtEngCmdPool
+// Destructor - deletes operations in the pool.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngCommandHandler::CVtEngCmdPool::~CVtEngCmdPool( )
+    {
+    ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCommandHandler::CVtEngCmdPool::Get
+// Returns pointer to an operation in the pool.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngOperation* CVtEngCommandHandler::CVtEngCmdPool::Get(
+            const TVtEngCommandId aId )
+    {
+    TInt count( Count() );
+    CVtEngOperation* ret = NULL;
+    while ( count-- )
+        {
+        CVtEngOperation* op = At( count );
+        if ( op->Command() == aId )
+            {
+            ret = op;
+            count = 0; // break
+            }
+        }
+    return ret;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Commands/CVtEngOperation.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,333 @@
+/*
+* 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:  Operation base class implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngOperation.h"
+#include    "CVtEngCommandHandler.h"
+#include    "TVtEngOperationUtils.h"
+#include    "VtEngUtils.h"
+#include    "cvtengmdtrcommandsender.h"
+#include    "cvtlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::NewL
+// Symbian two-phase constructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngOperation* CVtEngOperation::NewL(
+    TVtEngCommandId aCommandId,
+    CVtEngHandlerContainer& aHandlers,
+    MVtEngOperationObserver& aObserver,
+    TBool aDelete )
+    {
+    CVtEngOperation* self = new ( ELeave )
+    CVtEngOperation( aCommandId, aHandlers, aObserver, aDelete );
+    
+    CleanupStack::PushL( self );
+    self->iAsyncCallback = new ( ELeave )
+        CAsyncCallBack( CActive::EPriorityStandard );
+    self->iAsyncCallback->Set( TCallBack( ASyncHandleOpComplete, self ) );
+
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::CVtEngOperation
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngOperation::CVtEngOperation(
+    TVtEngCommandId aCommandId,
+    CVtEngHandlerContainer& aHandlers,
+    MVtEngOperationObserver& aObserver,
+    TBool aDelete ) :
+    iCommand( aCommandId ),
+    iHandlers( aHandlers ),
+    iObserver( aObserver ),
+    iDelete( aDelete )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::~CVtEngOperation
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngOperation::~CVtEngOperation()
+    {
+    Cancel();
+    delete iAsyncCallback;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::HandleOpCompleteL
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngOperation::HandleOpComplete( const TInt aResult )
+    {
+    __VTPRINTENTER( "EngOp.HandleOpComplete" )
+    iObserver.SetOperation( NULL );
+    CVtEngMdtrCommandSender& mediatorSender = 
+        CVtEngUtility::EngineUtils()->MediatorCommands();
+    switch( iCommand )
+        {
+    case KVtEngTerminateSession:
+        // send mediator command to telephony for call release        
+        mediatorSender.EndCall();
+        break;
+    case KVtEngMuteOutgoingAudio:
+    case KVtEngUnmuteOutgoingAudio:
+        // notify telephony subsystems about new microphone state
+        mediatorSender.NotifyOutgoingAudioState( 
+            iCommand == KVtEngUnmuteOutgoingAudio );
+        break;   
+    default:
+        break;
+    }
+#ifdef VTDEBUG
+    TRAPD( err, iObserver.CommandCompleteL( iCommand, aResult ) );
+    __VTPRINT2( DEBUG_GEN, "EngOp.Complete err=", err )
+#else
+    TRAP_IGNORE( iObserver.CommandCompleteL( iCommand, aResult ) );
+#endif // VTDEBUG
+    if ( iDelete )
+        {
+        delete this;
+        }
+    __VTPRINTEXITR( "EngOp.HandleOpComplete %d", aResult )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::ASyncHandleOpComplete
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngOperation::ASyncHandleOpComplete( TAny* aPtr )
+    {
+    __VTPRINTENTER( "EngOp.ASyncHandleOpComplete" )
+    CVtEngOperation* self = reinterpret_cast< CVtEngOperation* >( aPtr );
+    TInt error( self->iAsyncErr );
+    self->iAsyncErr = KErrNone;
+    self->HandleOpComplete( error );
+    __VTPRINTEXIT( "EngOp.ASyncHandleOpComplete" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::ExecuteL
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngOperation::ExecuteL( TDesC8* aParams )
+    {
+    __VTPRINTENTER( "EngOp.ExecuteL" )
+    TBool complete( EFalse );
+        
+    // Offer for synchronous handling.
+    TRAPD( err, complete = OfferExecuteSyncL( aParams ) );
+#ifdef VTDEBUG
+    if ( err < KErrNone )
+        {
+        __VTPRINT2( DEBUG_GEN, "EngOp.ExecuteL LEAVE = %d", err )
+        }
+#endif
+    User::LeaveIfError( err );
+    if ( !complete )
+        {
+        // async request
+        switch ( iCommand )
+            {
+            case KVtEngResetEngine:
+            case KVtEngInitializeEngine:
+            case KVtEngInitializeEngineTest:
+            case KVtEngInitializeEngineDiag:
+            case KVtEngTerminateSession:
+            case KVtEngSwitchToVoice:
+                TVtEngEngineInitUtil::HandleL( *this, iHandlers );
+                break;
+
+            case KVtEngSetSource:
+            case KVtEngPrepareCamera:
+            case KVtEngStartViewFinder:
+            case KVtEngPauseViewFinder:
+            case KVtEngStopViewFinder:
+            case KVtEngStartRenderRemote:
+            case KVtEngStopRenderRemote:
+            case KVtEngHandleLayoutChange:
+            case KVtEngUnfreeze:
+
+            // Media object sharing
+            case KVtEngStopShareImage:
+                TVtEngRenderUtil::HandleL( *this, iHandlers );
+                break;
+
+            // Media object sharing
+            // These two commands must be trapped and completed without leave
+            // because Application UI has to be able to act according to error.
+            case KVtEngInitializeShareImage:
+            case KVtEngStartShareImage:
+                TRAP( err, TVtEngRenderUtil::HandleL( *this, iHandlers ) );
+                break;
+
+            case KVtEngSetAudioRouting:
+                TVtEngAudioRoutingUtil::HandleL( *this );
+                break;
+
+            case KVtEngSetAudioVolume:
+            case KVtEngMuteOutgoingAudio:
+            case KVtEngUnmuteOutgoingAudio:
+                TVtEngAudioPlaybackUtil::HandleL( *this, iHandlers );
+                break;
+            default:
+                __VTPRINT( DEBUG_GEN, "EngOp.ExecuteL not handled" )
+                break;
+            }
+
+        iObserver.SetOperation( this );
+
+        if ( err != KErrNone )
+            {
+            __VTPRINT2( DEBUG_GEN, "EngOp.ExecuteL completing command %d", err )
+            iAsyncErr = err;
+            iAsyncCallback->CallBack();
+            }
+        }
+    else if ( iDelete )
+        {
+        delete this;
+        }
+    __VTPRINTEXITR( "EngOp.ExecuteL %d", complete )
+    return complete;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::Cancel
+// Cancels operation.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngOperation::Cancel()
+    {
+    __VTPRINTENTER( "EngOp.Cancel")
+    __VTPRINT2( DEBUG_GEN, "Command id = %d", iCommand)
+    switch ( iCommand )
+        {
+        case KVtEngInitializeEngine:
+            //TVtEngEngineInitUtil::Cancel( *this );
+            break;
+        case KVtEngInitializeShareImage:
+            TVtEngRenderUtil::Cancel( *this ,iHandlers);
+            break;
+        default:
+            break;
+        }
+    __VTPRINTEXIT( "EngOp.Cancel" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::OfferExecuteSyncL
+//
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngOperation::OfferExecuteSyncL( TDesC8* aParams )
+    {
+    __VTPRINTENTER( "EngOp.OfferExecuteSyncL" )
+    TBool complete( EFalse );
+    iParams = aParams; // reset back to null in ExecuteL
+    // test
+
+    switch ( iCommand )
+        {
+        case KVtEngIncreaseAudioVolume:
+        case KVtEngDecreaseAudioVolume:
+            TVtEngAudioPlaybackUtil::HandleL( *this, iHandlers );
+            complete = ETrue;
+            break;
+        case KVtEngPrepareViewFinder:
+        case KVtEngPrepareViewFinderDSA:
+        case KVtEngPrepareViewFinderDP:
+        case KVtEngStartViewFinder:
+        case KVtEngPauseViewFinder:
+        case KVtEngStopViewFinder:
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRenderNGA:
+        case KVtEngStartRenderRemote:
+        case KVtEngStopRenderRemote:
+        case KVtEngPauseRenderRemote:
+        case KVtEngSetZoomStep:
+        case KVtEngFreeze:
+            TVtEngViewFinderConfigureUtil::HandleL( *this, iHandlers );
+            complete = ETrue;
+            break;
+        case KVtEngPrepareRemoteRender:
+            break;
+        case KVtEngStartDtmfTone:
+        case KVtEngStopDtmfTone:
+            // Handling of different UIIs, support is there
+        case KVtEngSetUIIDtmfSupport:
+        case KVtEngSetUIIBasicStringSupport:
+        case KVtEngSetUIIIA5StringSupport:
+        case KVtEngSetUIIGeneralStringSupport:
+
+             TVtEngMediaTransportUtil::HandleL( *this, iHandlers );
+             complete = ETrue;
+            break;
+
+        case KVtEngSetUIForeground:
+        case KVtEngSetVideoQuality:
+        case KVtEngRequestLastRemoteFrame:
+            TVtEngRenderUtil::HandleL( *this, iHandlers );
+            complete = ETrue;
+            break;
+
+            // Extension commands
+        case KVtEngSetContrast:
+        case KVtEngSetBrightness:
+        case KVtEngSetWhiteBalance:
+        case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+        case KVtEngStartRecord:
+        case KVtEngStopRecord:
+#endif
+            TVtEngExtensionUtil::HandleL( *this );
+            complete = ETrue;
+            break;
+
+        default:
+            __VTPRINT( DEBUG_GEN, "EngOp.ExecuteL not handled sync" )
+            break;
+        }
+    __VTPRINTEXITR( "EngOp.OfferExecuteSyncL %d", complete )
+    return complete;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Commands/TVtEngOperationUtils.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,236 @@
+/*
+* 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:  Handler utilities implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "TVtEngOperationUtils.h"
+#include    "VtEngPanic.h"
+#include    "CVtEngInitializer.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngOperation.h"
+#include    "CVtEngHandlerContainer.h"
+#include    "CVtEngMediaHandler.h"
+#include    "CVtEngAudioHandler.h"
+#include    "CVtEngSessionHandler.h"
+#include    "CVtEngStateManager.h"
+#include    "CVtEngSettings.h"
+#include    "cvtengmdtrcommandsender.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderUtil::HandleL
+// unpacks and handles a rendering command
+// 
+// -----------------------------------------------------------------------------
+//
+void TVtEngRenderUtil::HandleL( 
+    CVtEngOperation& aOperation,
+    CVtEngHandlerContainer& aHandlers )
+    {
+    CVtEngMediaHandler& media =
+        static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
+
+    media.HandleL( aOperation );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngRenderUtil::Cancel
+// cancel the specify pending command
+// 
+// -----------------------------------------------------------------------------
+//
+
+void TVtEngRenderUtil::Cancel(
+    CVtEngOperation& aOperation,
+    CVtEngHandlerContainer& aHandlers )
+    {    
+    const TVtEngCommandId id = aOperation.Command();
+    __VTPRINTENTER( "TVtEngRenderUtil.Cancel")
+    __VTPRINT2( DEBUG_GEN, "Command id = %d", id)
+    if ( id == KVtEngInitializeShareImage )        
+        {
+        CVtEngMediaHandler& media =
+            static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
+            
+        media.CancelInitializeShareImage();
+        }
+    __VTPRINTEXIT( "TVtEngRenderUtil.Cancel")
+    }
+// -----------------------------------------------------------------------------
+// TVtEngAudioRoutingUtil::HandleL
+// unpacks and handles audio routing command.
+// 
+// -----------------------------------------------------------------------------
+//
+
+void TVtEngAudioRoutingUtil::HandleL( 
+    CVtEngOperation& aOperation )
+    {
+    CVtEngUtility::StateManager()->HandleOperationL( aOperation );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngAudioPlaybackUtil::HandleL
+// unpacks and handles audio playback command.
+// 
+// -----------------------------------------------------------------------------
+//
+void TVtEngAudioPlaybackUtil::HandleL( 
+    CVtEngOperation& aOperation,
+    CVtEngHandlerContainer& aHandlers )
+    {
+    __VTPRINTENTER( "AudioPlaybackUtil.HandleL" )
+    if ( aOperation.Command() == KVtEngSetAudioVolume ) 
+        {
+        CVtEngSettings& settings = CVtEngUtility::Settings();
+        const TPckgC<MVtEngAudio::TVtEngOutputVolume>& pckg = 
+            static_cast<const TPckgC<MVtEngAudio::TVtEngOutputVolume>&>
+            ( *aOperation.Parameters() );
+
+        settings.SetVolume( pckg().iHandsetVolume, pckg().iHandsfreeVolume,
+            ETrue );
+        }
+
+    // All the commands are though passed to handler
+    CVtEngMediaHandler& media =
+        static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
+    __VTPRINT( DEBUG_DETAIL, "TVtEngAudioPlaybackUtil::HandleL:Handler fetched")
+
+    media.HandleL( aOperation );
+    __VTPRINTEXIT( "AudioPlaybackUtil.HandleL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngMediaTransportUtil::HandleL
+// unpacks and handles media transport command.
+// 
+// -----------------------------------------------------------------------------
+//
+void TVtEngMediaTransportUtil::HandleL( 
+    CVtEngOperation& aOperation,
+    CVtEngHandlerContainer& aHandlers )
+    {
+    __VTPRINTENTER( "MediaTransportUtil.HandleL" )
+    const TVtEngCommandId command( aOperation.Command() );
+    if ( command == KVtEngStopDtmfTone ||
+         command == KVtEngStartDtmfTone ||
+		 // DTMF commands
+		 command == KVtEngSetUIIDtmfSupport ||
+         command == KVtEngSetUIIBasicStringSupport ||
+         command == KVtEngSetUIIIA5StringSupport ||
+         command == KVtEngSetUIIGeneralStringSupport )
+        {
+        aHandlers.Dtmf().HandleL( aOperation );
+        }
+        
+    __VTPRINTEXIT( "MediaTransportUtil.HandleL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngViewFinderConfigureUtil::HandleL
+// unpacks and handles 
+// 
+// -----------------------------------------------------------------------------
+//
+void TVtEngViewFinderConfigureUtil::HandleL( 
+    CVtEngOperation& aOperation,
+    CVtEngHandlerContainer& aHandlers )
+    {
+    CVtEngMediaHandler& media =
+        static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
+
+    media.HandleL( aOperation );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngCameraConfigUtil::HandleL
+// unpacks and handles 
+// 
+// -----------------------------------------------------------------------------
+//
+void TVtEngCameraConfigUtil::HandleL( 
+    CVtEngOperation& /*aOperation*/,
+    CVtEngHandlerContainer& /*aHandlers*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngEngineInitUtil::HandleL
+// Handles engine initialization and uninitialization command.
+// 
+// -----------------------------------------------------------------------------
+//
+void TVtEngEngineInitUtil::HandleL( 
+    CVtEngOperation& aOperation,
+    CVtEngHandlerContainer& /* aHandlers */ )
+    {
+    __VTPRINTENTER( "EngineInitUtil.HandleL" )
+    const TVtEngCommandId id = aOperation.Command();
+
+    CVtEngInitializer& initializer = 
+        CVtEngUtility::EngineUtils()->Initializer();
+
+    switch ( id )
+        {
+        case KVtEngInitializeEngine:
+        case KVtEngInitializeEngineDiag:
+        case KVtEngInitializeEngineTest:
+            initializer.InitializeL( aOperation );
+            break;
+        case KVtEngResetEngine:
+            initializer.Uninitialize( aOperation );
+            break;
+        case KVtEngTerminateSession:
+            CVtEngUtility::StateManager()->HandleOperationL( aOperation );
+            break;
+        case KVtEngSwitchToVoice:
+            CVtEngUtility::MediatorCommands().SwitchToVoiceL( aOperation );
+            break;
+        default:
+            Panic( EVtEngPanicIncorrectUtility );
+            break;
+        }
+    __VTPRINTEXIT( "EngineInitUtil.HandleL" )
+    }
+
+void TVtEngEngineInitUtil::Cancel( CVtEngOperation& aOperation )
+    {
+    const TVtEngCommandId id = aOperation.Command();
+    if ( id == KVtEngInitializeEngine )
+        {
+        CVtEngInitializer& initializer = 
+            CVtEngUtility::EngineUtils()->Initializer();
+        initializer.CancelInit();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TVtEngExtensionUtil::HandleL
+// handles extension operations.
+//
+// -----------------------------------------------------------------------------
+//
+void TVtEngExtensionUtil::HandleL(
+    CVtEngOperation& aOperation )
+    {
+    CVtEngUtility::StateManager()->HandleOperationL( aOperation );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Commands/cvtenginternaloperation.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 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:  Internal operation class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cvtenginternaloperation.h"
+#include "mvtengoperationobserver.h"
+#include "CVtEngStateManager.h"
+#include "TVtEngOperationUtils.h"
+#include "VtEngUtils.h"
+#include "cvtlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngOperation::NewL
+// Symbian two-phase constructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngInternalOperation* CVtEngInternalOperation::NewL(
+    TVtEngCommandId aCommandId,
+    CVtEngHandlerContainer& aHandlers,
+    MVtEngOperationObserver& aObserver,
+    TBool aDelete )
+    {
+    __VTPRINTENTER( "CVtEngInternalOperation.NewL<" )
+    CVtEngInternalOperation* self = new ( ELeave )
+        CVtEngInternalOperation( aCommandId, aHandlers, aObserver, aDelete );
+    __VTPRINTEXIT( "CVtEngInternalOperation.NewL>" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInternalOperation::CVtEngInternalOperation
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngInternalOperation::CVtEngInternalOperation(
+    TVtEngCommandId aCommandId,
+    CVtEngHandlerContainer& aHandlers,
+    MVtEngOperationObserver& aObserver,
+    TBool aDelete ) : CVtEngOperation( aCommandId, aHandlers, aObserver,
+        aDelete )
+    {
+    __VTPRINTENTER( "CVtEngInternalOperation.CVtEngInternalOperation" )
+    __VTPRINTEXIT( "CVtEngInternalOperation.CVtEngInternalOperation" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInternalOperation::~CVtEngInternalOperation
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngInternalOperation::~CVtEngInternalOperation()
+    {
+    __VTPRINTENTER( "CVtEngInternalOperation.~" )
+    __VTPRINTEXIT( "CVtEngInternalOperation.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInternalOperation::HandleOpCompleteL
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngInternalOperation::HandleOpComplete( const TInt aResult )
+    {
+    __VTPRINTENTER( "CVtEngInternalOperation.HandleOpComplete" )
+    #ifdef VTDEBUG
+    TRAPD( err, iObserver.CommandCompleteL( iCommand, aResult ) );
+    __VTPRINT2( DEBUG_GEN, "EngOp.Complete err=", err )
+#else
+    TRAP_IGNORE( iObserver.CommandCompleteL( iCommand, aResult ) );
+#endif // VTDEBUG
+    if ( iDelete )
+        {
+        delete this;
+        }
+    __VTPRINTEXITR( "CVtEngInternalOperation.HandleOpComplete %d>", aResult )
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+// CVtEngInternalOperation::ExecuteL
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngInternalOperation::ExecuteL()
+    {
+    __VTPRINTENTER( "CVtEngInternalOperation.ExecuteL" )
+    const CVtEngStateManager* states = CVtEngUtility::StateManager();
+    TInt err( KErrNotReady );
+    if ( states->IsCommandPossible( iCommand ) )
+        {
+        err = KErrNone;
+        switch ( iCommand )
+            {
+            case KVtEngTerminateSession:
+                TVtEngEngineInitUtil::HandleL( *this, iHandlers );
+                break;
+            case KVtEngMuteOutgoingAudio:
+            case KVtEngUnmuteOutgoingAudio:
+                TVtEngAudioPlaybackUtil::HandleL( *this, iHandlers );
+                break;            
+            default:
+                __VTPRINT( DEBUG_GEN, "EngOp.ExecuteL not handled" )
+                err = KErrNotSupported;
+                break;
+            }        
+        }
+    User::LeaveIfError( err );
+    __VTPRINTEXIT( "CVtEngInternalOperation.ExecuteL" )
+    return EFalse;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/CVtEngCameraPreferences.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,437 @@
+/*
+* 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:  Videoteleng  Camera Preferences extension
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngCameraPreferences.h"
+#include    "VtEngPanic.h"
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+#include    "mvtengcamerapreferencesobserver.h"
+
+#include    <capivideosource.h>
+#include    <cvtlogger.h>
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::CVtEngCameraPreferences
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngCameraPreferences::CVtEngCameraPreferences():
+                        CVtEngExtensionBase(
+                        KVtEngExtensionCameraPreferences )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CVtEngCameraPreferences::ConstructL()
+    {
+    __VTPRINTENTER( "CVtEngCameraPreferences.ConstructL" )
+    __VTPRINTEXIT( "CVtEngCameraPreferences.ConstructL" )
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CVtEngCameraPreferences* CVtEngCameraPreferences::NewL()
+    {
+    CVtEngCameraPreferences* self = new( ELeave ) CVtEngCameraPreferences;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::~CVtEngCameraPreferences
+// Destructor. Cannot leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngCameraPreferences::~CVtEngCameraPreferences()
+    {
+    __VTPRINTENTER( "CameraPreferences.~" )
+    if ( iObserver )
+        {
+        iObserver->Detach( *this );
+        }
+    __VTPRINTEXIT( "CameraPreferences.~" )
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetInterface
+//
+// ----------------------------------------------------------------------------
+//
+TAny* CVtEngCameraPreferences::GetInterface()
+    {
+    __VTPRINTENTER( "CameraPreferences.GetInterface")
+    // Cast first as API MVtEngCameraPreferences* class
+    // and after that to TAny*
+    __VTPRINTEXIT( "CameraPreferences.GetInterface" )
+    return reinterpret_cast< TAny* >( ( MVtEngCameraPreferences* ) this );
+
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::HandleL
+//
+// ----------------------------------------------------------------------------
+//
+TBool CVtEngCameraPreferences::HandleL( CVtEngOperation* aOp )
+    {
+    __VTPRINTENTER( "CameraPreferences.HandleL" )
+    const TVtEngCommandId id( aOp->Command() );
+    __VTPRINT2( DEBUG_GEN, "CVtEngCameraPreferences.HandleL CMD ID[%d] ", id )
+
+    // Check provider
+    if ( iProvider == NULL )
+        {
+        __VTPRINTEXITR( "CVtEngCameraPreferences.HandleL iProvider [%d]",
+                	( TInt )iProvider )
+        User::Leave( KErrNotReady );
+        }
+    // Check which command and call
+    // active provider with operation params
+    switch ( id )
+        {
+        case KVtEngSetContrast:
+        	{
+        	TInt contrast = 0;
+        	TVtEngOpParamUtil< TInt >::Set( contrast, *aOp );
+            iProvider->SetContrastL( contrast );
+            if ( iObserver )
+                {
+                iObserver->ContrastUpdated( contrast );
+                }
+            break;
+        	}
+        case KVtEngSetBrightness:
+            {
+     		TInt brightness = 0;
+        	TVtEngOpParamUtil< TInt >::Set( brightness, *aOp );
+            iProvider->SetBrightnessL( brightness );
+            if ( iObserver )
+                {
+                iObserver->BrightnessUpdated( brightness );
+                }
+            break;
+            }
+        case KVtEngSetWhiteBalance:
+            {
+            CCamera::TWhiteBalance whitebalance = CCamera::EWBAuto;
+        	TVtEngOpParamUtil< CCamera::TWhiteBalance >::Set( whitebalance,
+        		*aOp );
+            iProvider->SetWhiteBalanceL( whitebalance );
+            if ( iObserver )
+                {
+                iObserver->WhiteBalanceUpdated( TWhiteBalance( whitebalance ) );
+                }
+            break;
+            }
+        case KVtEngSetColorTone:
+            {
+            CCamera::CCameraImageProcessing::TEffect colortone =
+            	CCamera::CCameraImageProcessing::EEffectNone;
+        	TVtEngOpParamUtil< CCamera::CCameraImageProcessing::TEffect >::Set(
+        		colortone, *aOp );
+            iProvider->SetColorToneL( colortone );
+            if ( iObserver )
+                {
+                iObserver->ColorToneUpdated( TColorTone( colortone ) );
+                }
+            break;
+            }
+        //Not supported command
+        default:
+            __VTPRINTEXITR(
+            "CVtEngCameraPreferences.HandleL NOT SUPPORTED CMD[%d]", id )
+            return EFalse;
+        }
+    __VTPRINTEXIT( "CameraPreferences.HandleL" )
+    return ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::ValidateCommand
+//
+// ----------------------------------------------------------------------------
+
+TBool CVtEngCameraPreferences::ValidateCommand(
+	const TVtEngCommandId aCommandId )
+    {
+    __VTPRINTENTER( "CameraPreferences.ValidateCommand" )
+    // Check provider
+    if ( iProvider == NULL )
+        {
+        __VTPRINTEXITR(
+        	"CVtEngCameraPreferences.ValidateCommand iProvider [%d]",
+        	( TInt ) iProvider)
+        return EFalse;
+        }
+    // Take provider info is needed down below
+    TVSDataProviderInfo info;
+    iProvider->ProviderInfo( info );
+
+    // local or hw support
+    // set as False
+    TBool hworlocalsupport = EFalse;
+
+    // Check which command and check if
+    // if provider and local variation supports
+     __VTPRINT2( DEBUG_GEN,
+     	"CVtEngCameraPreferences.ValidateCommand CMD ID[%d] ", aCommandId )
+    switch ( aCommandId )
+        {
+        case KVtEngSetContrast:
+	        {
+            if ( info.iOptionsSupported & TCameraInfo::EContrastSupported  )
+                {
+                hworlocalsupport = ETrue;
+                }
+            break;
+	        }
+        case KVtEngSetBrightness:
+            {
+            if ( info.iOptionsSupported & TCameraInfo::EBrightnessSupported )
+                {
+                hworlocalsupport = ETrue;
+                }
+            break;
+            }
+        case KVtEngSetWhiteBalance:
+            {
+            if ( info.iWhiteBalanceModesSupported != CCamera::EWBAuto )
+                {
+                hworlocalsupport = ETrue;
+                }
+            break;
+            }
+        case KVtEngSetColorTone:
+            {
+            if ( info.iSupportedColorTones !=
+            	CCamera::CCameraImageProcessing::EEffectNone )
+                {
+                hworlocalsupport = ETrue;
+                }
+            break;
+            }
+        // Not supported command
+        default:
+        	{
+            __VTPRINT2( DEBUG_GEN,
+            	"CVtEngCameraPreferences.ValidateCommand NOT SUPPORTED CMD[%d]",
+            	 aCommandId)
+            hworlocalsupport = EFalse;
+        	}
+        }
+    __VTPRINTEXITR( "CVtEngCameraPreferences.ValidateCommand return value[%d]",
+    	hworlocalsupport)
+    return hworlocalsupport;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetColorTone
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetColorTone(
+	MVtEngCameraPreferences::TColorTone& aColortone ) const
+    {
+    __VTPRINTENTER( "CameraPreferences.GetColorTone" )
+    if ( iProvider == NULL )
+        {
+        __VTPRINTEXITR( "CVtEngCameraPreferences.GetColorTone iProvider[%d]",
+        	 ( TInt )iProvider)
+        return KErrNotReady;
+        }
+    TInt error;
+    CCamera::CCameraImageProcessing::TEffect colortone;
+    error = iProvider->GetColorTone( colortone );
+    aColortone = ( MVtEngCameraPreferences::TColorTone ) colortone;
+    __VTPRINTEXITR( "CameraPreferences.GetColorTone error [%d]",error )
+    return error;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetSupportedColorTones
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetSupportedColorTones(
+	TUint32& aSupportedColorTones ) const
+    {
+    __VTPRINTENTER( "CameraPreferences.GetSupportedColorTones" )
+    if ( iProvider == NULL )
+        {
+        __VTPRINTEXITR(
+        	"CVtEngCameraPreferences.GetSupportedColorTones iProvider[%d]",
+        	( TInt )iProvider)
+        return KErrNotReady;
+        }
+
+    TVSDataProviderInfo info;
+    iProvider->ProviderInfo( info );
+    aSupportedColorTones = info.iSupportedColorTones;
+    __VTPRINTEXITR( "CameraPreferences.GetSupportedColorTones [%b]",
+    	info.iSupportedColorTones)
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetWhiteBalance
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetWhiteBalance(
+	MVtEngCameraPreferences::TWhiteBalance& aWhiteBalance ) const
+    {
+    __VTPRINTENTER( "CameraPreferences.GetWhiteBalance" )
+    if ( iProvider == NULL )
+        {
+        __VTPRINTEXITR(
+        	"CVtEngCameraPreferences.GetWhiteBalance iProvider [%d]",
+        	( TInt )iProvider )
+        return KErrNotReady;
+        }
+    TInt error;
+    CCamera::TWhiteBalance whitebalance;
+    error = iProvider->GetWhiteBalance( whitebalance );
+    aWhiteBalance = (MVtEngCameraPreferences::TWhiteBalance) whitebalance;
+	__VTPRINTEXITR( "CameraPreferences.GetWhiteBalance error [%d]",error )
+    return error;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetSupportedWhiteBalanceModes
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetSupportedWhiteBalanceModes(
+	TUint32& aWhiteBalance  ) const
+    {
+    __VTPRINTENTER( "CameraPreferences.GetSupportedWhiteBalanceModes" )
+    if ( iProvider == NULL )
+        {
+        __VTPRINTEXITR(
+        	"CVtEngCameraPreferences.GetSupportedWhiteBalanceModes iProvider [%d]",
+        	( TInt )iProvider)
+        return KErrNotReady;
+        }
+
+    TVSDataProviderInfo info;
+    iProvider->ProviderInfo( info );
+    aWhiteBalance = info.iWhiteBalanceModesSupported;
+    __VTPRINTEXITR( "CameraPreferences.GetSupportedWhiteBalanceModes [%b]",
+    	info.iWhiteBalanceModesSupported)
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetBrightness
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetBrightness( TInt& aBrightness  ) const
+    {
+    __VTPRINTENTER( "CameraPreferences.GetBrightness" )
+    if ( iProvider == NULL )
+        {
+        __VTPRINTEXITR( "CVtEngCameraPreferences.GetBrightness iProvider [%d]",
+        	( TInt )iProvider)
+
+        return KErrNotReady;
+        }
+    TInt error;
+    error = iProvider->GetBrightness( aBrightness );
+	__VTPRINTEXITR( "CameraPreferences.GetBrightness error [%d]",error )
+    return error;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::GetContrast
+//
+// ----------------------------------------------------------------------------
+//
+TInt CVtEngCameraPreferences::GetContrast( TInt& aContrast  ) const
+    {
+    __VTPRINTENTER( "CameraPreferences.GetContrast" )
+    if ( iProvider == NULL )
+        {
+        __VTPRINTEXITR( "CVtEngCameraPreferences.GetContrast iProvider [%d]",
+        	( TInt )iProvider)
+       	return KErrNotReady;
+        }
+    TInt error;
+    error = iProvider->GetContrast( aContrast );
+	__VTPRINTEXITR( "CameraPreferences.GetContrast error [%d]",error )
+
+    return error;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::SetProvider
+//
+// ----------------------------------------------------------------------------
+//
+void CVtEngCameraPreferences::SetProvider( CVSDataProvider* aProvider,
+    MVtEngCameraPreferencesObserver& aObserver )
+    {
+    __VTPRINTENTER( "CameraPreferences.SetProvider" )
+    if ( iObserver )
+        {
+        iObserver->Detach( *this );
+        iObserver = NULL;
+        }
+    iProvider = aProvider;
+    iObserver = &aObserver;
+    if ( iObserver )
+        {
+        iObserver->Attach( *this );
+        }
+    __VTPRINTEXIT( "CameraPreferences.SetProvider" )
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngCameraPreferences::Detach
+//
+// ----------------------------------------------------------------------------
+//
+void CVtEngCameraPreferences::Detach( MVtEngCameraPreferencesObserver&
+    aObserver )
+    {
+    __VTPRINTENTER( "CameraPreferences.Detach" )
+    if ( iObserver == &aObserver )
+        {
+        iObserver = NULL;
+        }
+    __VTPRINTEXITR( "CameraPreferences.Detach $%x", TInt( iObserver ) )
+    }
+
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/CVtEngExtensionBase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* 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:  Videoteleng extension base class 
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngExtensionBase.h"
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// CVtEngExtensionBase::CVtEngExtensionBase
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngExtensionBase::CVtEngExtensionBase( TUid aExtensionUid ): 
+										iExtensionUid( aExtensionUid )
+    {
+    }
+// ----------------------------------------------------------------------------
+// CVtEngExtensionBase::Uid
+// 
+// 
+// ----------------------------------------------------------------------------
+//
+const TUid& CVtEngExtensionBase::Uid() const
+    {
+    return iExtensionUid;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/CVtEngExtensions.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,267 @@
+/*
+* 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:  Videoteleng API extension configuration
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngExtensions.h"
+#include    "VtEngPanic.h"
+#include    "VtEngUtils.h"
+
+#include    "CVtEngOperation.h"
+#include 	"CVtEngMediaHandler.h"
+#include    "CVtEngCameraPreferences.h"
+#include 	"cvtengrecord2file.h"
+
+#include    <cvtlogger.h>
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::CVtEngExtensions
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensions::CVtEngExtensions(): 
+                  iExtensionArray( KExtensionGranularity )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngExtensions::ConstructL()
+    {
+    __VTPRINTENTER( "Extensions.ConstructL" )
+    __VTPRINTEXIT( "Extensions.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensions* CVtEngExtensions::NewL()
+    {
+    CVtEngExtensions* self = new( ELeave ) CVtEngExtensions;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::~CVtEngExtensions
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensions::~CVtEngExtensions()
+    {
+    __VTPRINTENTER( "Extensions.~" )
+    // Clean and destroy pointer array 
+    iExtensionArray.ResetAndDestroy();
+    __VTPRINTEXIT( "Extensions.~" )
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::CreateExtensions
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensionBase* CVtEngExtensions::CreateExtensionsL( const TUid& aUid,
+	CVtEngMediaHandler& aHandler)
+    {
+    __VTPRINTENTER( "Extensions.CreateExtensions" )
+    
+    // init local variables
+    TInt error = KErrNotSupported;
+    CVtEngExtensionBase* extension = NULL;
+    
+    // Check if supported UID
+    if ( aUid == KVtEngExtensionCameraPreferences  || 
+    	aUid == KVtEngExtensionRecord2File )
+   		{  		
+   		// Create extension	
+        extension = aHandler.CreateExtensionsL( aUid );        
+        
+        // Push it to clean up stack because 
+        // it needs to be append in to
+        // array and it can be failed
+        CleanupStack::PushL( extension );
+            
+        // append extension in to array             
+        error = iExtensionArray.Append(extension);
+        if ( error != KErrNone )
+            {
+            // if append fails
+            // clear clean up stack and leave 
+            __VTPRINTEXITR( 
+            	"Extensions.CreateExtensions iExtension.Append failed %d",
+            	 error )
+            CleanupStack::PopAndDestroy();
+            User::Leave( error );
+            }
+        // append succesful
+        // pop extension from clena up stack and return     
+        __VTPRINTEXITR( 
+        	"Extensions.CreateExtensions iExtension UID[%d] succesfully Appended",
+        	 aUid.iUid)     
+        CleanupStack::Pop();
+        return extension;    
+   		}
+   	// not supported UID	
+   	// leave with error
+   	else
+   		{
+   		__VTPRINTEXITR( 
+   			"Extensions.CreateExtensions Extension NOTSUPPORTED UID%d",
+   			 aUid.iUid )
+        User::Leave( error );
+        return extension;
+   		}
+   		
+    }
+       
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::GetClientInterface
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngExtensions::GetClientInterface( TAny** aInterfacePtr, 
+	const TUid& aUid , CVtEngMediaHandler& aHandler)
+    {
+    __VTPRINTENTER( "Extensions.GetClientInterface" )
+   	// if aInterfacePtr pointer is NULL -> panic
+   	__ASSERT_ALWAYS( aInterfacePtr,Panic( EVtEngPanicInvalidPointer ) );
+
+	// init local variables
+    CVtEngExtensionBase* extension = NULL;
+    TInt error = KErrGeneral;
+    
+    // initialize IF pointer to be NULL
+    // if correct extension API IF is found
+    // then changed to valid pointer
+    *aInterfacePtr = NULL;
+    
+    // Check if extension is allready in pointer array
+    TInt index = LookupExtensions( aUid );
+    if ( index != KErrNotFound )
+        {
+        *aInterfacePtr = iExtensionArray[index]->GetInterface();
+        __VTPRINTEXITR( "Extensions.GetClientInterface error [%d]", KErrNone ) 
+        return KErrNone;
+        }
+    // Create extension   
+    else
+        {
+        TRAP( error, extension = CreateExtensionsL( aUid, aHandler ) );
+        if ( extension && error == KErrNone )
+            {
+            *aInterfacePtr = extension->GetInterface();
+            error = KErrNone;   
+            }  
+        __VTPRINTEXITR( "Extensions.GetClientInterface error [%d]", error )
+        return error;       
+        }
+    }
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::LookupExtensions
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngExtensions::LookupExtensions( const TUid& aUid) const
+    {
+    __VTPRINTENTER( "Extensions.LookupExtensions" )
+    TInt index( iExtensionArray.Count() );
+    
+    // Loop whole extension array
+    while( index-- )
+        {
+        // If matches in one of arrays UIDs        
+        if( aUid == iExtensionArray[index]->Uid() )
+            {
+            __VTPRINTEXITR( "Extensions.LookupExtensions index [%d]", index) 
+            return index;
+            }
+        }   
+    __VTPRINTEXITR("Extensions.LookupExtensions Not Found index [%d]",
+    	KErrNotFound)   
+    return KErrNotFound; 
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::OfferOperationL
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngExtensions::OfferOperationL( CVtEngOperation* aOp )
+    {   
+    __VTPRINTENTER( "Extensions.OfferOperationL" )
+    
+    TInt index( iExtensionArray.Count() );
+    	
+    // Format cmdComleted as false
+    TBool cmdCompleted = EFalse;
+    // Offer operation to all extension in array
+    while( index-- )
+        {
+        // If valid extension found
+        if ( iExtensionArray[index]->HandleL( aOp ) )
+            {
+            cmdCompleted = ETrue;
+            break;
+            }
+        }
+    __VTPRINTEXITR( "Extensions.OfferOperationL cmdCompleted [%d]",
+    	cmdCompleted)  
+    return cmdCompleted;
+    }    
+
+// -----------------------------------------------------------------------------
+// CVtEngExtensions::ValidateCommand
+// 
+// -----------------------------------------------------------------------------
+//        
+TBool CVtEngExtensions::ValidateCommand( const TVtEngCommandId aCommandId )
+    {
+    __VTPRINTENTER( "Extensions.ValidateCommand" )
+     TInt index( iExtensionArray.Count() );
+
+    // Format oKToPerform as false
+    TBool oKToPerform = EFalse;
+    // Try validate command in all extensions in array
+    while( index-- )
+        {
+        // If valid extension found
+        if ( iExtensionArray[index]->ValidateCommand( aCommandId ) )
+            {
+            oKToPerform = ETrue;
+            break;
+            }
+        }
+    __VTPRINTEXITR( "Extensions.ValidateCommand oKToPerform [%d]",
+    	oKToPerform)
+    return oKToPerform;
+    }    
+    
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/cvtengr2ftoneplayer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2003, 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:  Plays snap, self-timer and video start/stop sounds.
+*
+*/
+
+
+// INCLUDES
+#include <videotelui.rsg>
+
+#include <avkon.rsg>
+
+#include <AudioPreference.h>
+#include <StringLoader.h>
+
+#include <CVtLogger.h>
+
+#include "cvtengr2ftoneplayer.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ----------------------------------------------------------
+// CVtEngR2FTonePlayer::CVtEngR2FTonePlayer
+// C++ constructor
+// ----------------------------------------------------------
+//
+CVtEngR2FTonePlayer::CVtEngR2FTonePlayer()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::NewL
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CVtEngR2FTonePlayer* CVtEngR2FTonePlayer::NewL()
+    {
+    CVtEngR2FTonePlayer* self = new ( ELeave ) CVtEngR2FTonePlayer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// ----------------------------------------------------------
+// CVtEngR2FTonePlayer::ConstructL
+// Symbian OS 2nd phase constructor
+// ----------------------------------------------------------
+//
+void CVtEngR2FTonePlayer::ConstructL()
+    {
+    __VTPRINTENTER( "CVtEngR2FTonePlayer.ConstructL" )
+    iAudioPlayer = CMdaAudioPlayerUtility::NewL( *this,
+        KAudioPriorityVideoRecording, 
+        TMdaPriorityPreference( KAudioPrefCamera ) );
+	
+    iVideoStartSound = StringLoader::LoadL( R_VIDEOTELUI_VIDEO_RECORD_START_SOUND_PATH );
+    iVideoStopSound = StringLoader::LoadL( R_VIDEOTELUI_VIDEO_RECORD_STOP_SOUND_PATH );
+    iSoundInProgress = EFalse;
+    iOpenFileInProgress = EFalse;
+    __VTPRINTEXIT( "CVtEngR2FTonePlayer.ConstructL" )
+    }
+
+
+// Destructor.
+CVtEngR2FTonePlayer::~CVtEngR2FTonePlayer()
+    {
+    if ( iAudioPlayer )
+        {
+        iAudioPlayer->Close();
+        delete iAudioPlayer;
+        }
+
+    delete iVideoStartSound;
+    delete iVideoStopSound;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::PlaySound
+// Play a sound with given id.
+// ---------------------------------------------------------------------------
+//
+TInt CVtEngR2FTonePlayer::PlaySound( TInt aSound )
+    {
+    __VTPRINTENTER( "CVtEngR2FTonePlayer.PlaySound" )
+	TInt err = KErrNone;
+    iAudioPlayer->Stop();
+    iAudioPlayer->Close();
+   
+    switch ( aSound )
+        {
+        case EVtR2FVideoStartSoundId:
+        case EVtR2FVideoStopSoundId:
+            {
+            __VTPRINT( DEBUG_GEN,"CVtEngR2FTonePlayer.PlaySound() user sound" )
+            
+            // Set correct sound file
+            TPtrC soundFile = *iVideoStartSound;
+            if ( aSound == EVtR2FVideoStopSoundId )
+                {
+                soundFile.Set( *iVideoStopSound );
+                }
+                
+            // Video recording start sound using MMF
+            if ( !iOpenFileInProgress && !iSoundInProgress )
+                {
+                TRAP( err, iAudioPlayer->OpenFileL( soundFile ) );
+                if ( !err )
+                    {
+                    __VTPRINT( DEBUG_GEN,"CVtEngR2FTonePlayer.PlaySound() open now in progress" )
+                    iOpenFileInProgress = ETrue;
+                    }
+                }
+            else
+                {
+                __VTPRINT( DEBUG_GEN, "CVtEngR2FTonePlayer.PlaySound() err, in use" )
+                // The last OpenFileL call still hasnt completed.
+                // Cannot start playing a new file.
+                err = KErrInUse;
+                }
+            break;
+            }
+
+        default:
+            {
+            // Other sounds are not supported
+			err = KErrArgument;
+            break;
+            }
+        }
+	__VTPRINTEXIT( "CVtEngR2FTonePlayer.PlaySound" )
+	return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::Stop
+// Stop any ongoing sound.
+// ---------------------------------------------------------------------------
+//
+void CVtEngR2FTonePlayer::StopSound()
+    {
+    __VTPRINTENTER( "CVtEngR2FTonePlayer.StopSound" )
+    
+    iAudioPlayer->Stop();
+    iAudioPlayer->Close();
+    
+    __VTPRINTEXIT( "CVtEngR2FTonePlayer.StopSound" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::MapcInitComplete
+// CMdaAudioPlayerUtility initialization complete
+// ---------------------------------------------------------------------------
+//
+void CVtEngR2FTonePlayer::MapcInitComplete(
+    TInt aError, const TTimeIntervalMicroSeconds& aDuration )
+    {
+    __VTPRINTENTER( "CVtEngR2FTonePlayer.MapcInitComplete" )
+    __VTPRINT3( DEBUG_GEN, "CVtEngR2FTonePlayer.MapcInitComplete(%d, %d) ", 
+    	aError, I64INT( aDuration.Int64()) )
+    
+    (void) aDuration; 
+
+    iOpenFileInProgress = EFalse;
+	
+	// If tone can be played
+    if ( !aError )
+        {
+        __VTPRINT( DEBUG_GEN, "CVtEngR2FTonePlayer.MapcInitComplete() play" )
+        iSoundInProgress = ETrue;
+        iAudioPlayer->Play();
+        }
+    // error occured during tone player init    
+    else
+        {
+        __VTPRINT( DEBUG_GEN,"CVtEngR2FTonePlayer.MapcInitComplete() error" )
+        }
+    __VTPRINTEXIT( "CVtEngR2FTonePlayer.MapcInitComplete" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVtEngR2FTonePlayer::MapcPlayComplete
+// Playback complete, notify observer
+// ---------------------------------------------------------------------------
+//
+void CVtEngR2FTonePlayer::MapcPlayComplete( TInt aError )
+    {
+    __VTPRINTENTER( "CVtEngR2FTonePlayer.MapcPlayComplete" )
+    __VTPRINT2( DEBUG_GEN, "CVtEngR2FTonePlayer.MapcPlayComplete(%d)", aError)
+    
+    (void) aError;
+
+    iSoundInProgress = EFalse;
+    __VTPRINTEXIT( "CVtEngR2FTonePlayer.MapcPlayComplete" )    
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Extensions/cvtengrecord2file.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,203 @@
+/*
+* 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:  Videoteleng  Record to file extension 
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cvtengrecord2file.h"
+#include    "VtEngPanic.h"
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+#include 	"cvtengr2ftoneplayer.h"
+
+#include    <CVtLogger.h>
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::CVtEngRecord2File
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngRecord2File::CVtEngRecord2File():
+                        CVtEngExtensionBase( 
+                        KVtEngExtensionRecord2File )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CVtEngRecord2File::ConstructL()
+    {
+    __VTPRINTENTER( "CVtEngRecord2File.ConstructL" )
+	
+	iTonePlayer = CVtEngR2FTonePlayer::NewL();
+    __VTPRINTEXIT( "CVtEngRecord2File.ConstructL" )
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CVtEngRecord2File* CVtEngRecord2File::NewL()
+    {
+    CVtEngRecord2File* self = new( ELeave ) CVtEngRecord2File;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::~CVtEngRecord2File
+// Destructor. Cannot leave.
+// ----------------------------------------------------------------------------
+//
+CVtEngRecord2File::~CVtEngRecord2File()
+    {
+    
+    __VTPRINTENTER( "CVtEngRecord2File.~" )
+    if ( iTonePlayer )
+        {
+        iTonePlayer->StopSound();
+        delete iTonePlayer;
+        }
+    __VTPRINTEXIT( "CVtEngRecord2File.~" )
+    }
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::GetInterface
+// 
+// ----------------------------------------------------------------------------
+//    
+TAny* CVtEngRecord2File::GetInterface() 
+    {
+    __VTPRINTENTER( "CVtEngRecord2File.GetInterface")
+    // Cast first as API MVtEngRecord2File* class
+    // and after that to TAny*
+    __VTPRINTEXIT( "CVtEngRecord2File.GetInterface" )  
+    return reinterpret_cast< TAny* >( ( MVtEngRecord2File* ) this );
+
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::HandleL
+// 
+// ----------------------------------------------------------------------------
+//    
+TBool CVtEngRecord2File::HandleL( CVtEngOperation* aOp )
+    {
+    __VTPRINTENTER( "CVtEngRecord2File.HandleL" )
+    const TVtEngCommandId id( aOp->Command() );
+    __VTPRINT2( DEBUG_GEN, "CVtEngRecord2File.HandleL CMD ID[%d] ", id )
+    
+    // Check which command and call
+    // active provider with operation params    
+    switch ( id )
+        {
+        case KVtEngStartRecord:    
+            {          
+            
+            iTonePlayer->PlaySound( CVtEngR2FTonePlayer::EVtR2FVideoStartSoundId ); 
+            break;
+            }
+        case KVtEngStopRecord:    
+            {          
+            
+            iTonePlayer->PlaySound( CVtEngR2FTonePlayer::EVtR2FVideoStopSoundId ); 
+            break;
+            }
+        //Not supported command    
+        default:
+            __VTPRINTEXITR( 
+            "CVtEngRecord2File.HandleL NOT SUPPORTED CMD[%d]", id )
+            return EFalse;
+        }
+    __VTPRINTEXIT( "CVtEngRecord2File.HandleL" )  
+    return ETrue;
+    }        
+
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::ValidateCommand
+// 
+// ----------------------------------------------------------------------------
+
+TBool CVtEngRecord2File::ValidateCommand( 
+	const TVtEngCommandId aCommandId )
+    {
+    __VTPRINTENTER( "CVtEngRecord2File.ValidateCommand" )
+    
+    // local or hw support 
+    // set as False
+    TBool support = EFalse;
+    
+    // Check which command and check if
+    // if provider and local variation supports
+     __VTPRINT2( DEBUG_GEN, 
+     	"CVtEngRecord2File.ValidateCommand CMD ID[%d] ", aCommandId ) 	
+    switch ( aCommandId )
+        {
+        case KVtEngStartRecord:
+	        {
+	        support = ETrue;
+            break;
+	        }
+        
+        case KVtEngStopRecord:
+	        {
+	        support = ETrue;
+            break;
+	        }
+        // Not supported command    
+        default:
+        	{
+            __VTPRINT2( DEBUG_GEN, 
+            	"CVtEngRecord2File.ValidateCommand NOT SUPPORTED CMD[%d]",
+            	 aCommandId)
+            support = EFalse;	 
+        	}
+        }
+    __VTPRINTEXITR( "CVtEngRecord2File.ValidateCommand return value[%d]",
+    	support)                   
+    return support; 
+    }          
+    
+// ----------------------------------------------------------------------------
+// CVtEngRecord2File::IsTonePlaySupported
+// FOR TESTING PURPOSES REMOVE!
+// ----------------------------------------------------------------------------            
+
+TInt CVtEngRecord2File::IsTonePlaySupported( TBool& aSupported) const
+	{
+	if (iTonePlayer)
+		{
+		aSupported = ETrue;
+		}
+	else
+		{
+		aSupported = EFalse;
+		}
+	__VTPRINT2( DEBUG_GEN, "CVtEngRecord2File.IsTonePlaySupported bool[%d] ", (TInt)aSupported ) 		
+	return KErrNone;	
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngDrawDP.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,2026 @@
+/*
+* 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:  Remote video handler.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include    "CVtEngDrawDP.h"
+#include    "CVtEngEventManager.h"
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+#include    "MVtEngFrameObserver.h"
+#include    <videotelephonyvariant.hrh>
+#include    <tdisplaysinkparamsdp.h>
+#include    <cvtlogger.h>
+#include    <posting_surface_factory.h>
+
+#include <cvtimagebitmap.h>
+
+// LOCAL CONSTANTS AND MACROS
+
+// YCbCr conversion constants
+
+// Luma
+static const TUint32 KYLut[ 256 ] =
+    {
+    0x00000000, 0x00400801, 0x00801002, 0x00C01803,
+    0x01002004, 0x01402805, 0x01803006, 0x01C03807,
+    0x02004008, 0x02404809, 0x0280500A, 0x02C0580B,
+    0x0300600C, 0x0340680D, 0x0380700E, 0x03C0780F,
+    0x04008010, 0x04408811, 0x04809012, 0x04C09813,
+    0x0500A014, 0x0540A815, 0x0580B016, 0x05C0B817,
+    0x0600C018, 0x0640C819, 0x0680D01A, 0x06C0D81B,
+    0x0700E01C, 0x0740E81D, 0x0780F01E, 0x07C0F81F,
+    0x08010020, 0x08410821, 0x08811022, 0x08C11823,
+    0x09012024, 0x09412825, 0x09813026, 0x09C13827,
+    0x0A014028, 0x0A414829, 0x0A81502A, 0x0AC1582B,
+    0x0B01602C, 0x0B41682D, 0x0B81702E, 0x0BC1782F,
+    0x0C018030, 0x0C418831, 0x0C819032, 0x0CC19833,
+    0x0D01A034, 0x0D41A835, 0x0D81B036, 0x0DC1B837,
+    0x0E01C038, 0x0E41C839, 0x0E81D03A, 0x0EC1D83B,
+    0x0F01E03C, 0x0F41E83D, 0x0F81F03E, 0x0FC1F83F,
+    0x10020040, 0x10420841, 0x10821042, 0x10C21843,
+    0x11022044, 0x11422845, 0x11823046, 0x11C23847,
+    0x12024048, 0x12424849, 0x1282504A, 0x12C2584B,
+    0x1302604C, 0x1342684D, 0x1382704E, 0x13C2784F,
+    0x14028050, 0x14428851, 0x14829052, 0x14C29853,
+    0x1502A054, 0x1542A855, 0x1582B056, 0x15C2B857,
+    0x1602C058, 0x1642C859, 0x1682D05A, 0x16C2D85B,
+    0x1702E05C, 0x1742E85D, 0x1782F05E, 0x17C2F85F,
+    0x18030060, 0x18430861, 0x18831062, 0x18C31863,
+    0x19032064, 0x19432865, 0x19833066, 0x19C33867,
+    0x1A034068, 0x1A434869, 0x1A83506A, 0x1AC3586B,
+    0x1B03606C, 0x1B43686D, 0x1B83706E, 0x1BC3786F,
+    0x1C038070, 0x1C438871, 0x1C839072, 0x1CC39873,
+    0x1D03A074, 0x1D43A875, 0x1D83B076, 0x1DC3B877,
+    0x1E03C078, 0x1E43C879, 0x1E83D07A, 0x1EC3D87B,
+    0x1F03E07C, 0x1F43E87D, 0x1F83F07E, 0x1FC3F87F,
+    0x20040080, 0x20440881, 0x20841082, 0x20C41883,
+    0x21042084, 0x21442885, 0x21843086, 0x21C43887,
+    0x22044088, 0x22444889, 0x2284508A, 0x22C4588B,
+    0x2304608C, 0x2344688D, 0x2384708E, 0x23C4788F,
+    0x24048090, 0x24448891, 0x24849092, 0x24C49893,
+    0x2504A094, 0x2544A895, 0x2584B096, 0x25C4B897,
+    0x2604C098, 0x2644C899, 0x2684D09A, 0x26C4D89B,
+    0x2704E09C, 0x2744E89D, 0x2784F09E, 0x27C4F89F,
+    0x280500A0, 0x284508A1, 0x288510A2, 0x28C518A3,
+    0x290520A4, 0x294528A5, 0x298530A6, 0x29C538A7,
+    0x2A0540A8, 0x2A4548A9, 0x2A8550AA, 0x2AC558AB,
+    0x2B0560AC, 0x2B4568AD, 0x2B8570AE, 0x2BC578AF,
+    0x2C0580B0, 0x2C4588B1, 0x2C8590B2, 0x2CC598B3,
+    0x2D05A0B4, 0x2D45A8B5, 0x2D85B0B6, 0x2DC5B8B7,
+    0x2E05C0B8, 0x2E45C8B9, 0x2E85D0BA, 0x2EC5D8BB,
+    0x2F05E0BC, 0x2F45E8BD, 0x2F85F0BE, 0x2FC5F8BF,
+    0x300600C0, 0x304608C1, 0x308610C2, 0x30C618C3,
+    0x310620C4, 0x314628C5, 0x318630C6, 0x31C638C7,
+    0x320640C8, 0x324648C9, 0x328650CA, 0x32C658CB,
+    0x330660CC, 0x334668CD, 0x338670CE, 0x33C678CF,
+    0x340680D0, 0x344688D1, 0x348690D2, 0x34C698D3,
+    0x3506A0D4, 0x3546A8D5, 0x3586B0D6, 0x35C6B8D7,
+    0x3606C0D8, 0x3646C8D9, 0x3686D0DA, 0x36C6D8DB,
+    0x3706E0DC, 0x3746E8DD, 0x3786F0DE, 0x37C6F8DF,
+    0x380700E0, 0x384708E1, 0x388710E2, 0x38C718E3,
+    0x390720E4, 0x394728E5, 0x398730E6, 0x39C738E7,
+    0x3A0740E8, 0x3A4748E9, 0x3A8750EA, 0x3AC758EB,
+    0x3B0760EC, 0x3B4768ED, 0x3B8770EE, 0x3BC778EF,
+    0x3C0780F0, 0x3C4788F1, 0x3C8790F2, 0x3CC798F3,
+    0x3D07A0F4, 0x3D47A8F5, 0x3D87B0F6, 0x3DC7B8F7,
+    0x3E07C0F8, 0x3E47C8F9, 0x3E87D0FA, 0x3EC7D8FB,
+    0x3F07E0FC, 0x3F47E8FD, 0x3F87F0FE, 0x3FC7F8FF
+    };
+
+// Chroma1 (Cb)
+static const TUint32 KCbLut[ 256 ] =
+    {
+    0x0001531C, 0x00014B1E, 0x00014B20, 0x00014B22,
+    0x00014324, 0x00014325, 0x00014327, 0x00013B29,
+    0x00013B2B, 0x00013B2D, 0x0001332E, 0x00013330,
+    0x00013332, 0x00012B34, 0x00012B35, 0x00012B37,
+    0x00012339, 0x0001233B, 0x0001233D, 0x00011B3E,
+    0x00011B40, 0x00011B42, 0x00011344, 0x00011345,
+    0x00011347, 0x00010B49, 0x00010B4B, 0x00010B4D,
+    0x0001034E, 0x00010350, 0x00010352, 0x0000FB54,
+    0x0000FB55, 0x0000FB57, 0x0000F359, 0x0000F35B,
+    0x0000F35D, 0x0000EB5E, 0x0000EB60, 0x0000EB62,
+    0x0000E364, 0x0000E366, 0x0000E367, 0x0000DB69,
+    0x0000DB6B, 0x0000DB6D, 0x0000D36E, 0x0000D370,
+    0x0000D372, 0x0000CB74, 0x0000CB76, 0x0000CB77,
+    0x0000C379, 0x0000C37B, 0x0000C37D, 0x0000BB7E,
+    0x0000BB80, 0x0000BB82, 0x0000B384, 0x0000B386,
+    0x0000B387, 0x0000AB89, 0x0000AB8B, 0x0000AB8D,
+    0x0000AB8E, 0x0000A390, 0x0000A392, 0x0000A394,
+    0x00009B96, 0x00009B97, 0x00009B99, 0x0000939B,
+    0x0000939D, 0x0000939F, 0x00008BA0, 0x00008BA2,
+    0x00008BA4, 0x000083A6, 0x000083A7, 0x000083A9,
+    0x00007BAB, 0x00007BAD, 0x00007BAF, 0x000073B0,
+    0x000073B2, 0x000073B4, 0x00006BB6, 0x00006BB7,
+    0x00006BB9, 0x000063BB, 0x000063BD, 0x000063BF,
+    0x00005BC0, 0x00005BC2, 0x00005BC4, 0x000053C6,
+    0x000053C7, 0x000053C9, 0x00004BCB, 0x00004BCD,
+    0x00004BCF, 0x000043D0, 0x000043D2, 0x000043D4,
+    0x00003BD6, 0x00003BD8, 0x00003BD9, 0x000033DB,
+    0x000033DD, 0x000033DF, 0x00002BE0, 0x00002BE2,
+    0x00002BE4, 0x000023E6, 0x000023E8, 0x000023E9,
+    0x00001BEB, 0x00001BED, 0x00001BEF, 0x000013F0,
+    0x000013F2, 0x000013F4, 0x00000BF6, 0x00000BF8,
+    0x00000BF9, 0x000003FB, 0x000003FD, 0x000003FF,
+    0x00000000, 0x00000001, 0x00000003, 0x00000005,
+    0x001FF807, 0x001FF808, 0x001FF80A, 0x001FF00C,
+    0x001FF00E, 0x001FF010, 0x001FE811, 0x001FE813,
+    0x001FE815, 0x001FE017, 0x001FE018, 0x001FE01A,
+    0x001FD81C, 0x001FD81E, 0x001FD820, 0x001FD021,
+    0x001FD023, 0x001FD025, 0x001FC827, 0x001FC828,
+    0x001FC82A, 0x001FC02C, 0x001FC02E, 0x001FC030,
+    0x001FB831, 0x001FB833, 0x001FB835, 0x001FB037,
+    0x001FB039, 0x001FB03A, 0x001FA83C, 0x001FA83E,
+    0x001FA840, 0x001FA041, 0x001FA043, 0x001FA045,
+    0x001F9847, 0x001F9849, 0x001F984A, 0x001F904C,
+    0x001F904E, 0x001F9050, 0x001F8851, 0x001F8853,
+    0x001F8855, 0x001F8057, 0x001F8059, 0x001F805A,
+    0x001F785C, 0x001F785E, 0x001F7860, 0x001F7061,
+    0x001F7063, 0x001F7065, 0x001F6867, 0x001F6869,
+    0x001F686A, 0x001F606C, 0x001F606E, 0x001F6070,
+    0x001F5872, 0x001F5873, 0x001F5875, 0x001F5877,
+    0x001F5079, 0x001F507A, 0x001F507C, 0x001F487E,
+    0x001F4880, 0x001F4882, 0x001F4083, 0x001F4085,
+    0x001F4087, 0x001F3889, 0x001F388A, 0x001F388C,
+    0x001F308E, 0x001F3090, 0x001F3092, 0x001F2893,
+    0x001F2895, 0x001F2897, 0x001F2099, 0x001F209A,
+    0x001F209C, 0x001F189E, 0x001F18A0, 0x001F18A2,
+    0x001F10A3, 0x001F10A5, 0x001F10A7, 0x001F08A9,
+    0x001F08AB, 0x001F08AC, 0x001F00AE, 0x001F00B0,
+    0x001F00B2, 0x001EF8B3, 0x001EF8B5, 0x001EF8B7,
+    0x001EF0B9, 0x001EF0BB, 0x001EF0BC, 0x001EE8BE,
+    0x001EE8C0, 0x001EE8C2, 0x001EE0C3, 0x001EE0C5,
+    0x001EE0C7, 0x001ED8C9, 0x001ED8CB, 0x001ED8CC,
+    0x001ED0CE, 0x001ED0D0, 0x001ED0D2, 0x001EC8D3,
+    0x001EC8D5, 0x001EC8D7, 0x001EC0D9, 0x001EC0DB,
+    0x001EC0DC, 0x001EB8DE, 0x001EB8E0, 0x001EB8E2
+    };
+
+// Chroma1 (Cr)
+static const TUint32 KCrLut[ 256 ] =
+    {
+    0xD302D000, 0xD382C800, 0xD3C2C000, 0xD442B800,
+    0xD482B800, 0xD502B000, 0xD542A800, 0xD582A800,
+    0xD602A000, 0xD6429800, 0xD6C29000, 0xD7029000,
+    0xD7428800, 0xD7C28000, 0xD8028000, 0xD8827800,
+    0xD8C27000, 0xD9027000, 0xD9826800, 0xD9C26000,
+    0xDA425800, 0xDA825800, 0xDAC25000, 0xDB424800,
+    0xDB824800, 0xDC024000, 0xDC423800, 0xDC823800,
+    0xDD023000, 0xDD422800, 0xDDC22000, 0xDE022000,
+    0xDE421800, 0xDEC21000, 0xDF021000, 0xDF820800,
+    0xDFC20000, 0xE041F800, 0xE081F800, 0xE0C1F000,
+    0xE141E800, 0xE181E800, 0xE201E000, 0xE241D800,
+    0xE281D800, 0xE301D000, 0xE341C800, 0xE3C1C000,
+    0xE401C000, 0xE441B800, 0xE4C1B000, 0xE501B000,
+    0xE581A800, 0xE5C1A000, 0xE601A000, 0xE6819800,
+    0xE6C19000, 0xE7418800, 0xE7818800, 0xE7C18000,
+    0xE8417800, 0xE8817800, 0xE9017000, 0xE9416800,
+    0xE9816800, 0xEA016000, 0xEA415800, 0xEAC15000,
+    0xEB015000, 0xEB814800, 0xEBC14000, 0xEC014000,
+    0xEC813800, 0xECC13000, 0xED412800, 0xED812800,
+    0xEDC12000, 0xEE411800, 0xEE811800, 0xEF011000,
+    0xEF410800, 0xEF810800, 0xF0010000, 0xF040F800,
+    0xF0C0F000, 0xF100F000, 0xF140E800, 0xF1C0E000,
+    0xF200E000, 0xF280D800, 0xF2C0D000, 0xF300D000,
+    0xF380C800, 0xF3C0C000, 0xF440B800, 0xF480B800,
+    0xF4C0B000, 0xF540A800, 0xF580A800, 0xF600A000,
+    0xF6409800, 0xF6C09000, 0xF7009000, 0xF7408800,
+    0xF7C08000, 0xF8008000, 0xF8807800, 0xF8C07000,
+    0xF9007000, 0xF9806800, 0xF9C06000, 0xFA405800,
+    0xFA805800, 0xFAC05000, 0xFB404800, 0xFB804800,
+    0xFC004000, 0xFC403800, 0xFC803800, 0xFD003000,
+    0xFD402800, 0xFDC02000, 0xFE002000, 0xFE401800,
+    0xFEC01000, 0xFF001000, 0xFF800800, 0xFFC00000,
+    0x00000000, 0x00400000, 0x009FF800, 0x011FF000,
+    0x015FF000, 0x01DFE800, 0x021FE000, 0x025FE000,
+    0x02DFD800, 0x031FD000, 0x039FC800, 0x03DFC800,
+    0x041FC000, 0x049FB800, 0x04DFB800, 0x055FB000,
+    0x059FA800, 0x05DFA800, 0x065FA000, 0x069F9800,
+    0x071F9000, 0x075F9000, 0x079F8800, 0x081F8000,
+    0x085F8000, 0x08DF7800, 0x091F7000, 0x095F7000,
+    0x09DF6800, 0x0A1F6000, 0x0A9F5800, 0x0ADF5800,
+    0x0B5F5000, 0x0B9F4800, 0x0BDF4800, 0x0C5F4000,
+    0x0C9F3800, 0x0D1F3000, 0x0D5F3000, 0x0D9F2800,
+    0x0E1F2000, 0x0E5F2000, 0x0EDF1800, 0x0F1F1000,
+    0x0F5F1000, 0x0FDF0800, 0x101F0000, 0x109EF800,
+    0x10DEF800, 0x111EF000, 0x119EE800, 0x11DEE800,
+    0x125EE000, 0x129ED800, 0x12DED800, 0x135ED000,
+    0x139EC800, 0x141EC000, 0x145EC000, 0x149EB800,
+    0x151EB000, 0x155EB000, 0x15DEA800, 0x161EA000,
+    0x169E9800, 0x16DE9800, 0x171E9000, 0x179E8800,
+    0x17DE8800, 0x185E8000, 0x189E7800, 0x18DE7800,
+    0x195E7000, 0x199E6800, 0x1A1E6000, 0x1A5E6000,
+    0x1A9E5800, 0x1B1E5000, 0x1B5E5000, 0x1BDE4800,
+    0x1C1E4000, 0x1C5E4000, 0x1CDE3800, 0x1D1E3000,
+    0x1D9E2800, 0x1DDE2800, 0x1E1E2000, 0x1E9E1800,
+    0x1EDE1800, 0x1F5E1000, 0x1F9E0800, 0x1FDE0800,
+    0x205E0000, 0x209DF800, 0x211DF000, 0x215DF000,
+    0x21DDE800, 0x221DE000, 0x225DE000, 0x22DDD800,
+    0x231DD000, 0x239DC800, 0x23DDC800, 0x241DC000,
+    0x249DB800, 0x24DDB800, 0x255DB000, 0x259DA800,
+    0x25DDA800, 0x265DA000, 0x269D9800, 0x271D9000,
+    0x275D9000, 0x279D8800, 0x281D8000, 0x285D8000,
+    0x28DD7800, 0x291D7000, 0x295D7000, 0x29DD6800,
+    0x2A1D6000, 0x2A9D5800, 0x2ADD5800, 0x2B1D5000,
+    0x2B9D4800, 0x2BDD4800, 0x2C5D4000, 0x2C9D3800
+    };
+
+
+// Posting surface factory DLL's name
+_LIT( KDPAPIDLLName, "PostingSurfaceFactory.dll" );
+
+// Reversed enumeration for the bitmaps.
+static const MDisplaySink::TBitmapNo KVtEngBitmapNoReversed[] =
+        {
+        MDisplaySink::ESecondBitmap,
+        MDisplaySink::EFirstBitmap
+        };
+
+// Default posting format (if this or KDefaultPostingFormat420 is not
+// supported, BaseConstructL() will leave with KErrNotSupported)
+const CPostingSurface::TPostingFormat KDefaultPostingFormat422 =
+    CPostingSurface::EYuv422LeBt601Range0;
+
+// Default posting format (if this or KDefaultPostingFormat422 is not
+// supported, BaseConstructL() will leave with KErrNotSupported)
+const CPostingSurface::TPostingFormat KDefaultPostingFormat420 =
+    CPostingSurface::EYuv420PlanarBt601Range0;
+
+// Default posting buffering flags.
+const TUint KDefaultPostingBufferingFlags =
+        // Double buffering
+        CPostingSurface::EDoubleBuffering |
+        // Progressive frames (no interlacing)
+        CPostingSurface::EProgressiveFrames |
+        // Do not allow frameskip
+        CPostingSurface::EDisAllowFrameSkip |
+        // Use internal buffers (allocated by DP)
+        CPostingSurface::EInternalBuffers;
+
+// Default pixel aspect ratio num. Aspect ratio = Num/Denom.
+const TUint16 KDefaultPixelAspectRatioNum = 1;
+
+// Default pixel aspect ratio denom. Aspect ratio = Num/Denom.
+const TUint16 KDefaultPixelAspectRatioDenom = 1;
+
+// LOCAL METHODS
+
+// -----------------------------------------------------------------------------
+// DoConvertYuv420toXRGB0888
+// -----------------------------------------------------------------------------
+//
+inline void DoConvertYuv420toXRGB0888(
+    TInt aWidth,                    // width in pixels
+    const TUint8*& aSourceDataPtrY1, // pointer to Y data row 1
+    const TUint8*& aSourceDataPtrY2, // pointer to Y data row 2
+    const TUint8*& aSourceDataPtrU,  // pointer to U data row
+    const TUint8*& aSourceDataPtrV,  // pointer to V data row
+    TUint8* aDestDataPtr1,          // pointer to destination row 1
+    TUint8* aDestDataPtr2           // pointer to destination row 2
+    )
+    {
+    TUint32* destDataPtr1 = reinterpret_cast< TUint32* >( aDestDataPtr1 );
+    TUint32* destDataPtr2 = reinterpret_cast< TUint32* >( aDestDataPtr2 );
+    // width assumed to be even
+    TInt pixelsLeft = aWidth / 2;
+
+    TUint32 r, g, b;
+    TUint32 LutY0, LutY1, LutC;
+    TUint32 pixel;
+    TUint32 OverflowMask = 0xC0180300U;
+
+    // One scanline at the time
+    while ( pixelsLeft-- )
+        {
+
+        // row 1, 2 pixels
+
+        LutY0 = KYLut[*aSourceDataPtrY1++];
+        LutY1 = KYLut[*aSourceDataPtrY1++];
+        LutC  = KCbLut[*aSourceDataPtrU++];
+        LutC += KCrLut[*aSourceDataPtrV++];
+
+        pixel = LutY0 + LutC;
+
+        if (pixel & OverflowMask)
+            {
+            if (pixel & 0xC0000000U)
+                {
+                if (pixel & 0x80000000U)
+                    {
+                    pixel &= ~0x3FC00000U;
+                    }
+                else
+                    {
+                    pixel |=  0x3FC00000U;
+                    }
+                }
+            if (pixel & 0x00180000U)
+                {
+                if (pixel & 0x00100000U)
+                    {
+                    pixel &= ~0x0007F800U;
+                    }
+                else
+                    {
+                    pixel |=  0x0007F800U;
+                    }
+                }
+            if (pixel & 0x00000300U)
+                {
+                if (pixel & 0x00000200U)
+                    {
+                    pixel &= ~0x000000FFU;
+                    }
+                else
+                    {
+                    pixel |=  0x000000FFU;
+                    }
+                }
+            }
+
+        r = (pixel >> 6) & 0xFF0000;
+        g = (pixel >> 3) & 0x00FF00;
+        b =  pixel       & 0x0000FF;
+
+        *destDataPtr1++ = 0xFF000000 | r | g | b;
+
+        pixel = LutY1 + LutC;
+
+        if (pixel & OverflowMask)
+            {
+            if (pixel & 0xC0000000U)
+                {
+                if (pixel & 0x80000000U)
+                    {
+                    pixel &= ~0x3FC00000U;
+                    }
+                else
+                    {
+                    pixel |=  0x3FC00000U;
+                    }
+                }
+            if (pixel & 0x00180000U)
+                {
+                if (pixel & 0x00100000U)
+                    {
+                    pixel &= ~0x0007F800U;
+                    }
+                else
+                    {
+                    pixel |=  0x0007F800U;
+                    }
+                }
+            if (pixel & 0x00000300U)
+                {
+                if (pixel & 0x00000200U)
+                    {
+                    pixel &= ~0x000000FFU;
+                    }
+                else
+                    {
+                    pixel |=  0x000000FFU;
+                    }
+                }
+            }
+
+        r = (pixel >> 6) & 0xFF0000;
+        g = (pixel >> 3) & 0x00FF00;
+        b =  pixel       & 0x0000FF;
+
+        *destDataPtr1++ = 0xFF000000 | r | g | b;
+
+        // row, 2 pixels
+
+        LutY0 = KYLut[*aSourceDataPtrY2++];
+        LutY1 = KYLut[*aSourceDataPtrY2++];
+
+        pixel = LutY0 + LutC;
+
+        if (pixel & OverflowMask)
+            {
+            if (pixel & 0xC0000000U)
+                {
+                if (pixel & 0x80000000U)
+                    {
+                    pixel &= ~0x3FC00000U;
+                    }
+                else
+                    {
+                    pixel |=  0x3FC00000U;
+                    }
+                }
+            if (pixel & 0x00180000U)
+                {
+                if (pixel & 0x00100000U)
+                    {
+                    pixel &= ~0x0007F800U;
+                    }
+                else
+                    {
+                    pixel |=  0x0007F800U;
+                    }
+                }
+            if (pixel & 0x00000300U)
+                {
+                if (pixel & 0x00000200U)
+                    {
+                    pixel &= ~0x000000FFU;
+                    }
+                else
+                    {
+                    pixel |=  0x000000FFU;
+                    }
+                }
+            }
+
+        r = (pixel >> 6) & 0xFF0000;
+        g = (pixel >> 3) & 0x00FF00;
+        b =  pixel       & 0x0000FF;
+
+        *destDataPtr2++ = 0xFF000000 | r | g | b;
+
+        pixel = LutY1 + LutC;
+
+        if (pixel & OverflowMask)
+            {
+            if (pixel & 0xC0000000U)
+                {
+                if (pixel & 0x80000000U)
+                    {
+                    pixel &= ~0x3FC00000U;
+                    }
+                else
+                    {
+                    pixel |=  0x3FC00000U;
+                    }
+                }
+            if (pixel & 0x00180000U)
+                {
+                if (pixel & 0x00100000U)
+                    {
+                    pixel &= ~0x0007F800U;
+                    }
+                else
+                    {
+                    pixel |=  0x0007F800U;
+                    }
+                }
+            if (pixel & 0x00000300U)
+                {
+                if (pixel & 0x00000200U)
+                    {
+                    pixel &= ~0x000000FFU;
+                    }
+                else
+                    {
+                    pixel |=  0x000000FFU;
+                    }
+                }
+            }
+
+        r = (pixel >> 6) & 0xFF0000;
+        g = (pixel >> 3) & 0x00FF00;
+        b =  pixel       & 0x0000FF;
+
+        *destDataPtr2++ = 0xFF000000 | r | g | b;
+
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// DoConvertYuv422toXRGB0888
+// -----------------------------------------------------------------------------
+//
+inline void DoConvertYuv422toXRGB0888(
+    TInt aWidth,                    // width in pixels
+    const TUint8*& aSourceDataPtr,   // pointer to source row
+    TUint8* aDestDataPtr            // pointer to destination row
+    )
+    {
+    TUint32* destDataPtr = reinterpret_cast< TUint32* >( aDestDataPtr );
+    // width assumed to be even
+    TInt pixelsLeft = aWidth / 2;
+
+    TUint32 r, g, b;
+    TUint32 LutY0, LutY1, LutC;
+    TUint32 pixel;
+    TUint32 OverflowMask = 0xC0180300U;
+
+    // One scanline at the time
+    while ( pixelsLeft-- )
+        {
+
+        LutC  = KCbLut[*aSourceDataPtr++];
+        LutY0 = KYLut[*aSourceDataPtr++];
+        LutC += KCrLut[*aSourceDataPtr++];
+        LutY1 = KYLut[*aSourceDataPtr++];
+
+        pixel = LutY0 + LutC;
+
+        if (pixel & OverflowMask)
+            {
+            if (pixel & 0xC0000000U)
+                {
+                if (pixel & 0x80000000U)
+                    {
+                    pixel &= ~0x3FC00000U;
+                    }
+                else
+                    {
+                    pixel |=  0x3FC00000U;
+                    }
+                }
+            if (pixel & 0x00180000U)
+                {
+                if (pixel & 0x00100000U)
+                    {
+                    pixel &= ~0x0007F800U;
+                    }
+                else
+                    {
+                    pixel |=  0x0007F800U;
+                    }
+                }
+            if (pixel & 0x00000300U)
+                {
+                if (pixel & 0x00000200U)
+                    {
+                    pixel &= ~0x000000FFU;
+                    }
+                else
+                    {
+                    pixel |=  0x000000FFU;
+                    }
+                }
+            }
+
+        r = (pixel >> 6) & 0xFF0000;
+        g = (pixel >> 3) & 0x00FF00;
+        b =  pixel       & 0x0000FF;
+
+        *destDataPtr++ = 0xFF000000 | r | g | b;
+
+        pixel = LutY1 + LutC;
+
+        if (pixel & OverflowMask)
+            {
+            if (pixel & 0xC0000000U)
+                {
+                if (pixel & 0x80000000U)
+                    {
+                    pixel &= ~0x3FC00000U;
+                    }
+                else
+                    {
+                    pixel |=  0x3FC00000U;
+                    }
+                }
+            if (pixel & 0x00180000U)
+                {
+                if (pixel & 0x00100000U)
+                    {
+                    pixel &= ~0x0007F800U;
+                    }
+                else
+                    {
+                    pixel |=  0x0007F800U;
+                    }
+                }
+            if (pixel & 0x00000300U)
+                {
+                if (pixel & 0x00000200U)
+                    {
+                    pixel &= ~0x000000FFU;
+                    }
+                else
+                    {
+                    pixel |=  0x000000FFU;
+                    }
+                }
+            }
+
+        r = (pixel >> 6) & 0xFF0000;
+        g = (pixel >> 3) & 0x00FF00;
+        b =  pixel       & 0x0000FF;
+
+        *destDataPtr++ = 0xFF000000 | r | g | b;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::NewL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP* CVtEngDrawDP::NewL(
+    MDisplaySinkObserver* aObserver )
+    {
+    __VTPRINTENTER( "RVD(DP).NewL" )
+    CVtEngDrawDP* self = new ( ELeave ) CVtEngDrawDP( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "RVD(DP).NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::~CVtEngDrawDP
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::~CVtEngDrawDP()
+    {
+    __VTPRINTENTER( "RVD(DP).~" )
+    Cancel();
+    delete iFrameBuffer;
+    delete iBufferWaiter;
+    delete iPostingSurface;
+    __VTPRINT( DEBUG_MEDIA , "RVD(DP).~ RRegion::Close()" )
+    iClipRegion.Close();
+    CloseDPLibrary();
+
+    delete iTarget;
+    delete iSource;
+    delete iImageScaler;
+    __VTPRINTEXIT( "RVD(DP).~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngDraw
+// C++ constructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::CVtEngDrawDP( MDisplaySinkObserver* aObserver ) :
+    CVtEngDraw( aObserver ), iClipRegion( 1 ),
+    iPostingFormat( KDefaultPostingFormat422 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseConstructL
+// Base construction.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseConstructL()
+    {
+    __VTPRINTENTER( "RVD(DP).BaseConstructL" )
+    if ( IsFlag( EFlagUIForeground ) )
+        {
+        DoBaseConstructL();
+        }
+    else
+        {
+        SetFlag( EBaseConstructCalled );
+        }
+    __VTPRINTEXIT( "RVD(DP).BaseConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CreateSinkL
+// Instantiates display sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink* CVtEngDrawDP::CreateSinkL()
+    {
+    __VTPRINTENTER( "RVD(DP).CreateSinkL" )
+    TDisplaySinkParamsDP params;
+    GetSinkParams( params );
+    MDisplaySink* sink = ::CreateSinkL( params, KNullDesC8 );
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        sink->Pause();
+        SetFlag( ESinkParamUpdateRequired | ESinkResumeRequired );
+        }
+    __VTPRINTEXIT( "RVD(DP).CreateSinkL" )
+    return sink;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::BaseRefreshL
+// Draw a frame.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseRefreshL()
+    {
+    __VTPRINTENTER( "RVD(DP).BaseRefreshL" )
+    __VTPRINTEXIT( "RVD(DP).BaseRefreshL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseRefreshBitmapsL
+// Refreshes bitmaps sizes and display mode if needed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseRefreshBitmapsL()
+    {
+    __VTPRINTENTER( "RVD(DP).BaseRefreshBitmapsL" )
+    BaseConstructL();
+    InitializePostingSurfaceL();
+    // set the params for DS
+    UpdateSinkParamsL();
+    ClearFlag( EFirstFrameReceived );
+    __VTPRINTEXIT( "RVD(DP).BaseRefreshBitmapsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseDoCancel
+// DoCancel for derived class.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseDoCancel()
+    {
+    __VTPRINTENTER( "RVD(DP).BaseDoCancel" )
+    __VTPRINTEXIT( "RVD(DP).BaseDoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseVerifyConfigL
+// Checks current configuration against DP implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseVerifyConfigL()
+    {
+    __VTPRINTENTER( "RVD(DP).BaseVerifyConfigL" )
+    // Check support for requested size
+    if ( !SupportsSize( iSourceSize ) )
+        {
+        __VTPRINT( DEBUG_MEDIA ,
+            "RVD(DP).BaseVerifyConfigL Size NOT supported" )
+        User::Leave( KErrNotSupported );
+        }
+    RecalculateClipRegionL();
+    __VTPRINTEXIT( "RVD(DP).BaseVerifyConfigL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseRestartL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseRestartL()
+    {
+    __VTPRINTENTER( "RVD(DP).BaseRestartL" )
+    if ( IsFlag( EFlagUIForeground ) )
+        {
+        RecalculateClipRegionL();
+        iBufferWaiter->FetchBuffer();
+        }
+    __VTPRINTEXIT( "RVD(DP).BaseRestartL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseAbortNow
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseAbortNow()
+    {
+    __VTPRINTENTER( "RVD(DP).BaseAbortNow" )
+    UpdateVtFrame();
+    __VTPRINTEXIT( "RVD(DP).BaseAbortNow" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::StartDrawL
+// Starts the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseStartDrawL()
+    {
+    __VTPRINTENTER( "RVD(DP).BaseStartDrawL" )
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        SetFlag( EBaseBaseStartDrawCalled );
+        }
+    else
+        {
+        DoBaseStartDrawL();
+        }
+    __VTPRINTEXIT( "RVD(DP).BaseStartDrawL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseStopDraw
+// Stop the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseStopDraw()
+    {
+    // Cancel the timer in any case.
+    __VTPRINTENTER( "RVD(DP).BaseStopDraw" )
+    ClearFlag( EBaseBaseStartDrawCalled );
+    iWatcher->Cancel();
+    if ( iDSA )
+        {
+        ClearFlag( ERemoteVideoDrawing | EStarted );
+        iDSA->Cancel();
+        }
+    iBufferWaiter->Cancel();
+    Cancel();
+    __VTPRINTEXIT( "RVD(DP).BaseStopDraw" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseSetConfigL
+// Sets new configuration.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseSetConfigL( const TVtEngRenderConfig& aConfig )
+    {
+    __VTPRINTENTER( "RVD(DP).BaseSetConfigL" )
+    Mem::FillZ( &iConfig, sizeof( TVtEngRenderConfigDP ) );
+    iConfig = aConfig;
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        SetFlag( EBaseSetConfigCalled );
+        }
+    else
+        {
+        ConfigUpdatedL();
+        }
+    __VTPRINTEXIT( "RVD(DP).BaseSetConfigL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseSetUIForegroundL
+// Sets UI foreground status.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseSetUIForegroundL( TBool aForeground )
+    {
+    __VTPRINTENTER( "RVD(DP).BaseSetUIForegroundL" )
+    if( aForeground )
+        {
+        TBool wasSentToBackground( IsFlag( ESentToBackground ) );
+        SetFlag( EFlagUIForeground );
+        ClearFlag( ESentToBackground );
+        if( IsFlag( EDelayedCallsMask ) )
+            {
+            HandleDelayedCallsL();
+            }      
+        if ( wasSentToBackground )
+            {
+            BaseRefreshBitmapsL();
+            Restart( RDirectScreenAccess::ETerminateCancel );
+            BaseStartDrawL();
+            }       
+        }
+    else
+        {
+        if ( !IsFlag( EBaseConstructCalled ) )
+            {
+            BaseStopDraw();
+            delete iPostingSurface;
+            iPostingSurface = 0;
+            for ( TInt i = MDisplaySink::EFirstBitmap;
+                  i < MDisplaySink::EFirstBitmap + KVtEngMaxBuffers; i++ )
+                {
+                iBuffers[ i ].UnSet();
+                }
+            SetFlag( ESentToBackground );
+            }
+        ClearFlag( EFlagUIForeground );
+        }
+    __VTPRINTEXIT( "RVD(DP).BaseSetUIForegroundL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseRequestLastFrame
+//  Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseRequestLastFrame()
+    {
+    __VTPRINTENTER( "RVD(DP).BaseRequestLastFrame" )
+    UpdateVtFrame();
+    __VTPRINTEXIT( "RVD(DP).BaseRequestLastFrame" )    
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BaseVideoFrameSizeChangedL
+// Called when incoming frame buffer size changes.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BaseVideoFrameSizeChangedL( const TSize& aTo )
+    {
+    __VTPRINTENTER( "RVD(DP).BaseVideoFrameSizeChangedL" )
+    CreateFrameBufferL( aTo );
+    __VTPRINTEXIT( "RVD(DP).BaseVideoFrameSizeChangedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::Config
+// Returns current configuration.
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderConfig& CVtEngDrawDP::Config()
+    {
+    return iConfig;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::RunL
+// CActive heir execution method.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::RunL()
+    {
+    __VTPRINTENTER( "RVD(DP).RunL" )
+
+    TInt bitmapNo( iStatus.Int() );
+
+    if ( bitmapNo < KErrNone )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL notify rvd problem" )
+        CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+        return;
+        }
+
+    TVtEngBuffer& buffer = iBuffers[ bitmapNo ];
+
+    if ( !iDSUpdated )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL !Updated" )
+        __VTPRINTEXIT( "RVD(DP).RunL" )
+        return;
+        }
+    else if ( !IsFlag( EFlagUIForeground ) )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL !Flag( EFlagUIForeground )" )
+        __VTPRINTEXIT( "RVD(DP).RunL" )
+        if ( iPostingSurface )
+            {
+            iPostingSurface->PostBuffer( buffer.Buffer() );
+            buffer.UnSet();
+            iBufferWaiter->FetchBuffer();
+            }
+        return;
+        }
+    else if ( buffer.Buffer() == NULL )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL signalled with NULL buffer" )
+        TInt result( iBufferWaiter->FetchBuffer() );
+        __VTPRINT2( DEBUG_MEDIA,
+            "RVD(DP).RunL FetchBuffer %d", result )
+        User::LeaveIfError( result );
+        __VTPRINTEXIT( "RVD(DP).RunL" )
+        return;
+        }
+
+    // Image received, reset counter.
+    iCheckpoint = KVtEngWatcherThreshold;
+
+    StoreFrameBuffer( buffer.Buffer() );
+    __VTPRINT2( DEBUG_MEDIA, "RVD(DP).RunL flags=%d", iFlags )
+    TBool firstFrame( !IsFlag ( EFirstFrameReceived ) );
+    SetFlag( EFirstFrameReceived );
+    // Remote video is about to start?
+    if ( !IsFlag( EStarted ) && IsFlag( EReadyInternal ) )
+        {
+        if ( !iDSA->IsActive() )
+            {
+            iDSA->StartL();
+            }
+        SetFlag( EStarted );
+        if ( !iConfig.iClipRect.IsEmpty() )
+            {
+            SetFlag( EReadyForeground );
+            iDSA->Gc()->SetClippingRect( iConfig.iClipRect );
+            RecalculateClipRegionL();
+            }
+        __VTPRINT( DEBUG_MEDIA, "RVD(DP).RunL notify rvd start" )
+        //CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+        }
+    if ( firstFrame )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+        }
+    TRAPD( setClipRegResult, SetClipRegionL() );
+    if ( setClipRegResult )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "RVD(DP).RunL SetClipRegionL failed %d",
+            setClipRegResult );
+        }
+    __VTPRINT3( DEBUG_MEDIA, "RVD(DP).RunL received buffer %d $%x",
+        bitmapNo,
+        reinterpret_cast< TUint >( buffer.Buffer() ) )
+    TInt result
+        ( iPostingSurface->PostBuffer( buffer.Buffer() ) );
+    __VTPRINT2( DEBUG_MEDIA, "RVD(DP).RunL PostBuffer %d", result )
+    buffer.UnSet();
+    if ( iBuffers[ KVtEngBitmapNoReversed[ bitmapNo ] ].IsSet() )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "RVD(DP).RunL reactivating for buffer %d",
+            KVtEngBitmapNoReversed[ bitmapNo ] )
+        Activate();
+        DisplaySink().NextFrame();
+        }
+        
+    if ( result == KErrNotReady )
+        {
+        BaseRefreshBitmapsL();
+        result = KErrNone;
+        }
+        
+    User::LeaveIfError( result );
+    result = iBufferWaiter->FetchBuffer();
+    __VTPRINT2( DEBUG_MEDIA,
+        "RVD(DP).RunL FetchBuffer %d", result )
+    User::LeaveIfError( result );
+
+    __VTPRINTEXIT( "RVD(DP).RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::BufferReady
+// BufferReady
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::BufferReady( CPostingSurface::TPostingBuff* aBuffer )
+    {
+    __VTPRINTENTER( "RVD(DP).BufferReady" )
+    SetAvailableToSink( aBuffer );
+    __VTPRINTEXIT( "RVD(DP).BufferReady" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::FetchError
+// Buffer fetching error
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::FetchError( TInt )
+    {
+    __VTPRINTENTER( "RVD(DP).FetchError" )
+    CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+    __VTPRINTEXIT( "RVD(DP).FetchError" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::HandleDelayedCallsL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::HandleDelayedCallsL()
+    {
+    __VTPRINTENTER( "RVD(DP).HandleDelayedCallsL" )
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        DoBaseConstructL();
+        }
+    if ( IsFlag( EBaseSetConfigCalled ) )
+        {
+        ConfigUpdatedL();
+        ClearFlag( EBaseSetConfigCalled );
+        }
+    if ( IsFlag( EInitializePostingSurfaceCalled ) )
+        {
+        DoInitializePostingSurfaceL();
+        }
+    if ( IsFlag( ESinkParamUpdateRequired ) )
+        {
+        DoUpdateSinkParamsL();
+        }
+    if ( IsFlag( EBaseBaseStartDrawCalled ) )
+        {
+        DoBaseStartDrawL();
+        }
+    __VTPRINTEXIT( "RVD(DP).HandleDelayedCallsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DoBaseConstructL
+// Base construction implementation
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::DoBaseConstructL()
+    {
+    __VTPRINTENTER( "RVD(DP).DoBaseConstructL" )
+
+    if ( !iImageScaler )
+        {
+        iImageScaler =
+            CVtImageScaler::NewL( *this, CVtImageScaler::EBilinear );
+        }
+    delete iBufferWaiter;
+    iBufferWaiter = NULL;
+    delete iPostingSurface;
+    iPostingSurface = NULL;
+
+    // Load DP API library
+    LoadDPLibraryL();
+
+    // Create posting surface instance
+    iPostingSurface = CreatePostingSurfaceL();
+
+    CPostingSurface::TPostingFormat previousPostingFormat( iPostingFormat );
+
+    // Check support for format
+    if ( !SupportsFormat( KDefaultPostingFormat420 ) )
+        {
+        if ( !SupportsFormat( KDefaultPostingFormat422 ) )
+            {
+            __VTPRINT( DEBUG_MEDIA ,
+                "RVD(DP).BaseConstructL Format NOT supported" )
+            User::Leave( KErrNotSupported );
+            }
+        else
+            {
+            __VTPRINT( DEBUG_MEDIA , "RVD(DP).BaseConstructL using 422" )
+            iPostingFormat = KDefaultPostingFormat422;
+            }
+        }
+    else
+        {
+        __VTPRINT( DEBUG_MEDIA , "RVD(DP).BaseConstructL using 420" )
+        iPostingFormat = KDefaultPostingFormat420;
+        }
+    iPostingSurface->GetCapabilities( iPostingCaps );
+    iBufferWaiter =
+        new ( ELeave ) CVtEngBufferWaiter( *iPostingSurface, *this );
+    for ( TInt i = MDisplaySink::EFirstBitmap;
+          i < MDisplaySink::EFirstBitmap + KVtEngMaxBuffers; i++ )
+        {
+        iBuffers[ i ].UnSet();
+        }
+
+    // If posting for is different from previous, then free frame buffer
+    if ( ( previousPostingFormat != iPostingFormat ) || !iFrameBuffer )
+        {
+        CreateFrameBufferL( iSourceSize );
+        }
+    ClearFlag( EBaseConstructCalled );
+    __VTPRINTEXIT( "RVD(DP).DoBaseConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::UpdateSinkParamsL
+// Updates sink params
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::UpdateSinkParamsL()
+    {
+    __VTPRINTENTER( "RVD(DP).UpdateSinkParamsL" )
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        SetFlag( ESinkParamUpdateRequired );
+        }
+    else
+        {
+        DoUpdateSinkParamsL();
+        }
+    __VTPRINTEXIT( "RVD(DP).UpdateSinkParamsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DoBaseStartDrawL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::DoBaseStartDrawL()
+    {
+    __VTPRINTENTER( "RVD(DP).DoBaseStartDrawL" )
+    UpdateVtFrame();
+    if ( iDSA )
+        {
+        SetFlag( EReadyInternal );
+        if ( !iWatcher->IsActive() )
+            {
+            iWatcher->Start( KVtEngWatcherTimeout, KVtEngWatcherTimeout,
+                iCallback );
+            }
+        User::LeaveIfError( iBufferWaiter->FetchBuffer() );
+        SetFlag( ERemoteVideoDrawing );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    ClearFlag( EBaseBaseStartDrawCalled );
+    __VTPRINTEXIT( "RVD(DP).DoBaseStartDrawL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DoInitializePostingSurfaceL
+// Initializes posting surface.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::DoInitializePostingSurfaceL()
+    {
+    __VTPRINTENTER( "RVD(DP).DoInitializePostingSurfaceL" )
+    CPostingSurface::TPostingSourceParams postingSourceParams;
+    GetPostingSourceParams( postingSourceParams );
+    CPostingSurface::TPostingParams postingParams;
+    GetPostingParams( postingParams );
+    // Create and start DSA for getting access to DP
+    CreateAndStartDSAL();
+    
+    /*S60 Display Posting API has a limitation that only one surface instance can be 
+    created at a time. Unfortunately there's no way to check when posting is really 
+    free. PostingSurface initialization maybe returns KErrInUse.
+    Please refer to TSW error EAKC-7R3TME.
+	The transition effect between landscape and portrait uses ATID to achieve smooth 
+	transition. ATID and PostingSurface share the same buffers and cannot be used 
+	simultaneously. PostingSurface initialization maybe returns KErrNotReady. 
+	Please refer to TSW error EWXO-7P4DV3.
+	So it probably requires some kind of timer based retry to bypass these cases.*/
+    TInt err;
+    while (1)
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(DP).DoInitializePostingSurfaceL Initialize PostingSurface" );
+        TRAP( err, iPostingSurface->InitializeL(postingSourceParams, postingParams) );
+        if ( err == KErrNone)
+            {
+            break;
+            }
+        else
+            {
+            //time interval for each PostingSurface initialization  is 0.2 second.
+            __VTPRINT2( DEBUG_MEDIA, "RVD(DP).DoInitializePostingSurfaceL InitPS error = %d", err )
+            User::After(200000);
+            }
+        }
+        
+    delete iTarget; iTarget = NULL;
+    iTarget = CVtImageBitmap::NewL(
+        postingParams.iDisplayedRect.Size(), EColor16MU );
+    if ( iSource )
+        {
+        if ( IsFlag( EFrameBufferFilled ) &&
+             !IsFlag( EFrameBufferNeedsConvertAndScale ) )
+            {
+            iImageScaler->ScaleNowL( *iSource, *iTarget );
+            Config().iObserver->vtSetFrame(
+                MVtEngFrameObserver::ERemoteVideoFrame,
+                &iTarget->Bitmap() );
+            }
+        else
+            {
+            Config().iObserver->vtSetFrame(
+                MVtEngFrameObserver::ERemoteVideoFrame, NULL );
+            }
+        }
+    else
+        {
+        //delete iSource; iSource = NULL;
+        iSource = CVtImageBitmap::NewL( iSourceSize, EColor16MU );
+        Config().iObserver->vtSetFrame( MVtEngFrameObserver::ERemoteVideoFrame,
+            NULL );
+        }
+    RecalculateClipRegionL();
+    ClearFlag( EInitializePostingSurfaceCalled );
+    __VTPRINTEXIT( "RVD(DP).DoInitializePostingSurfaceL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DoUpdateSinkParamsL
+// Updates sink params
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::DoUpdateSinkParamsL()
+    {
+    __VTPRINTENTER( "RVD(DP).DoUpdateSinkParamsL" )
+    TDisplaySinkParamsDP params;
+    GetSinkParams( params );
+    DisplaySink().UpdateSinkParamsL( params, iDSUpdated );
+    ClearFlag( ESinkParamUpdateRequired );
+    if ( IsFlag( ESinkResumeRequired ) )
+        {
+        DisplaySink().Resume();
+        ClearFlag( ESinkResumeRequired );
+        }
+    __VTPRINTEXIT( "RVD(DP).DoUpdateSinkParamsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::IsAlphaTrashed
+// Checks if the alpha has been trashed on screen buffer.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::IsAlphaTrashed() const
+    {
+    __VTPRINTENTER( "RVD(DP).IsAlphaTrashed" )
+    TBool isTrashed( EFalse );
+    const CFbsScreenDevice& sdev( *iDSA->ScreenDevice() );
+    if ( sdev.DisplayMode() == EColor16MA )
+        {
+        TRgb color;
+        TPoint point( iClipRegion.BoundingRect().Center() );
+        sdev.GetPixel( color, point );
+        isTrashed = ( color.Alpha() != 0 );
+        }
+    __VTPRINTEXITR( "RVD(DP).IsAlphaTrashed %d", isTrashed )
+    return isTrashed;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SetClipRegionL
+// Sets clipping region for DP.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::SetClipRegionL()
+    {
+    __VTPRINTENTER( "RVD(DP).SetClipRegionL" )
+    if ( iClipRegionUpdated || IsAlphaTrashed() )
+        {
+        iClipRegionUpdated = EFalse;
+        CFbsBitGc* gc = iDSA->Gc();
+        gc->SetClippingRegion( iDSA->DrawingRegion() );
+        gc->SetDrawMode( CGraphicsContext::EDrawModeAND );
+        gc->SetBrushColor( TRgb( 255, 255, 255, 0 ) );
+        gc->Clear();
+        iDSA->ScreenDevice()->Update();
+        User::LeaveIfError(
+            iPostingSurface->SetClipRegion( iClipRegion ) );
+        }
+    __VTPRINTEXIT( "RVD(DP).SetClipRegionL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::InitializePostingSurfaceL
+// Initializes posting surface.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::InitializePostingSurfaceL()
+    {
+    __VTPRINTENTER( "RVD(DP).InitializePostingSurfaceL" )
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        SetFlag( EInitializePostingSurfaceCalled );
+        }
+    else
+        {
+        DoInitializePostingSurfaceL();
+        }
+    __VTPRINTEXIT( "RVD(DP).InitializePostingSurfaceL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::GetPostingSourceParams
+// Fills posting source params structure.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::GetPostingSourceParams(
+    CPostingSurface::TPostingSourceParams& aParams ) const
+    {
+    __VTPRINTENTER( "RVD(DP).GetPostingSourceParams" )
+    Mem::FillZ( &aParams, sizeof( CPostingSurface::TPostingSourceParams ) );
+    aParams.iPostingBuffering = KDefaultPostingBufferingFlags;
+    aParams.iBufferType = CPostingSurface::EStandardBuffer;
+    aParams.iPostingUsage = CPostingSurface::EVideoCapture;
+    aParams.iSourceImageSize = iSourceSize;
+    aParams.iPostingFormat = iPostingFormat;
+    aParams.iPixelAspectRatioNum = KDefaultPixelAspectRatioNum;
+    aParams.iPixelAspectRatioDenom = KDefaultPixelAspectRatioDenom;
+    aParams.iContentCopyRestricted = EFalse;
+    __VTPRINTEXIT( "RVD(DP).GetPostingSourceParams" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::GetPostingParams
+// Fills posting params structure.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::GetPostingParams(
+    CPostingSurface::TPostingParams& aParams ) const
+    {
+    __VTPRINTENTER( "RVD(DP).GetPostingParams" )
+    Mem::FillZ( &aParams, sizeof( CPostingSurface::TPostingParams ) );
+
+    aParams.iDisplayedRect = iConfig.iClipRect;
+
+    __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams DRect.iTl (%d, %d)",
+        aParams.iDisplayedRect.iTl.iX, aParams.iDisplayedRect.iTl.iY );
+    __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams DRect.iBr (%d, %d)",
+        aParams.iDisplayedRect.iBr.iX, aParams.iDisplayedRect.iBr.iY );
+
+    TRect& dispRect( aParams.iDisplayedRect );
+    dispRect.Move( iConfig.iOffset );
+    FixRectForDP( dispRect );
+    __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams OffsDRect.iTl (%d, %d)",
+        dispRect.iTl.iX, dispRect.iTl.iY );
+    __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams OffsDRect.iBr (%d, %d)",
+        dispRect.iBr.iX, dispRect.iBr.iY );
+
+    aParams.iScaleToRect = TRect( aParams.iDisplayedRect.Size() );
+
+    aParams.iInputCrop = iSourceSize;
+
+    __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams InputCrop.iTl (%d, %d)",
+        aParams.iInputCrop.iTl.iX, aParams.iInputCrop.iTl.iY );
+    __VTPRINT3( DEBUG_MEDIA, "RVD(DP).GetPostingParams InputCrop.iBr (%d, %d)",
+        aParams.iInputCrop.iBr.iX, aParams.iInputCrop.iBr.iY );
+
+    aParams.iBackGround = iConfig.iBackGround;
+    __VTPRINTEXIT( "RVD(DP).GetPostingParams" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsFormat
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsFormat(
+    const CPostingSurface::TPostingFormat& aFormat ) const
+    {
+    return iPostingSurface->FormatSupported( aFormat );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsSize
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsSize( const TSize& aSize ) const
+    {
+    return ( iPostingCaps.iMaxPixelSize.iWidth >= aSize.iWidth ) &&
+        ( iPostingCaps.iMaxPixelSize.iHeight >= aSize.iHeight );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsRotation
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsRotation(
+    CPostingSurface::TRotationType aRotation ) const
+    {
+    return ( ( aRotation & iPostingCaps.iSupportedRotations ) == aRotation );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsMirroring
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsMirroring() const
+    {
+    return iPostingCaps.iSupportsMirroring;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsScaling
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsScaling() const
+    {
+    return iPostingCaps.iSupportsScaling;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsBrightness
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsBrightness() const
+    {
+    return iPostingCaps.iSupportsBrightnessControl;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SupportsContrast
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::SupportsContrast() const
+    {
+    return iPostingCaps.iSupportsContrastControl;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::GetFrameBufferSize
+// Returns size of frame buffer in bytes for given pixel size and current
+// posting format.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngDrawDP::GetFrameBufferSize( const TSize& aSize ) const
+    {
+    TInt size( -1 );
+    __VTPRINTENTER( "RVD(DP).GetFrameBufferSize" )
+    switch( iPostingFormat )
+        {
+    case KDefaultPostingFormat420:
+        size = ( aSize.iWidth * aSize.iHeight * 3 ) >> 1;
+        break;
+
+    case KDefaultPostingFormat422:
+        size = ( aSize.iWidth * aSize.iHeight ) * 2;
+        break;
+
+    default:
+        break;
+        }
+    __VTPRINTEXITR( "RVD(DP).GetFrameBufferSize %d", size )
+    return size;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::RecalculateClipRegionL
+// Updates clipregion.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::RecalculateClipRegionL()
+    {
+    __VTPRINTENTER( "RVD(DP).RecalculateClipRegionL" )
+    // Clip region needs to be updated
+    iClipRegionUpdated = ETrue;
+    iClipRegion.Clear();
+    TRect clippingRect( iConfig.iClipRect );
+    clippingRect.Move( iConfig.iOffset );
+    FixRectForDP( clippingRect );
+    iClipRegion.AddRect( clippingRect );
+    if ( iClipRegion.CheckError() )
+        {
+        __VTPRINT( DEBUG_MEDIA ,
+            "RVD(DP).RecalculateClipRegionL failed to add cliprect" )
+        User::Leave( KErrNoMemory );
+        }
+
+    if ( IsFlag( EStarted ) && iDSA && iDSA->DrawingRegion() )
+        {
+        iClipRegion.Intersect( *iDSA->DrawingRegion() );
+        if ( iClipRegion.CheckError() )
+            {
+            __VTPRINT( DEBUG_MEDIA ,
+                "RVD(DP).RecalculateClipRegionL failed to intersect" )
+            User::Leave( KErrNoMemory );
+            }
+
+#ifdef VTDEBUG
+
+    TRect bRect( iClipRegion.BoundingRect() );
+    __VTPRINT3( DEBUG_MEDIA, "RVD(DP).RecalculateClipRegionL BRect.iTl (%d, %d)",
+        bRect.iTl.iX, bRect.iTl.iY );
+    __VTPRINT3( DEBUG_MEDIA, "RVD(DP).RecalculateClipRegionL BRect.iBr (%d, %d)",
+        bRect.iBr.iX, bRect.iBr.iY );
+#endif // VTDEBUG
+        }
+    __VTPRINTEXIT( "RVD(DP).RecalculateClipRegionL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::FixRectForDP
+// Fixes rect for DP (i.e. width is made even and starting X coordinate is made
+// even as well)
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::FixRectForDP( TRect& aRect ) const
+    {
+    __VTPRINTENTER( "RVD(DP).FixRectForDP" )
+    if ( aRect.iTl.iX & 1 )
+        {
+        aRect.Move( 1, 0 );
+        aRect.SetWidth( Max( 0, aRect.Width() - 1 ) );
+        }
+    if ( aRect.Width() & 1 )
+        {
+        aRect.SetWidth( aRect.Width() - 1 );
+        }
+    __VTPRINTEXIT( "RVD(DP).FixRectForDP" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::RecalculateClipRegionL
+// Fills sink params.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::GetSinkParams( TDisplaySinkParamsDP& aSinkParams )
+    {
+    __VTPRINTENTER( "RVD(DP).GetSinkParams" )
+    Mem::FillZ( &aSinkParams, sizeof( TDisplaySinkParamsDP ) );
+    aSinkParams.iThreadId = RThread().Id();
+    aSinkParams.iRequestStatusPtr = &iStatus;
+    aSinkParams.iObserver = iObserver;
+    aSinkParams.iPostingBuffer1 = &iBuffers[ 0 ].Buffer();
+    aSinkParams.iPostingBuffer2 = &iBuffers[ 1 ].Buffer();
+    aSinkParams.iFrameSize = iSourceSize;
+    aSinkParams.iPostingFormat = iPostingFormat;
+    aSinkParams.iFlags = TDisplaySinkParams::EDisplaySinkDP;
+    __VTPRINTEXITR( "RVD(DP).GetSinkParams flags=%d",
+        (TInt) aSinkParams.iFlags )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::DisplaySink
+// Returns reference to sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink& CVtEngDrawDP::DisplaySink()
+    {
+    return *iDisplaySink;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::StoreFrameBuffer
+// Stores given frame buffer.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::StoreFrameBuffer(
+    CPostingSurface::TPostingBuff* aPostingBuffer )
+    {
+    __VTPRINTENTER( "RVD(DP).StoreFrameBuffer" )
+    if ( iPostingFormat == KDefaultPostingFormat422 )
+        {
+        const TInt height( iSourceSize.iHeight );
+        const TInt srcStride( aPostingBuffer->GetStride() );
+        const TInt dstStride( iSourceSize.iWidth * 2 );
+        TUint8* dst =
+            const_cast< TUint8* >( iFrameBuffer->Des().Ptr() );
+        const TUint8* src =
+            reinterpret_cast< const TUint8* >( aPostingBuffer->GetBuffer() );
+        for ( TInt y = height - 1; y >= 0; y-- )
+            {
+            dst = Mem::Copy( dst, src, dstStride );
+            src += srcStride;
+            }
+        }
+    else
+        {
+        TInt frameBufferSizeInBytes( GetFrameBufferSize( iSourceSize ) );
+        TPtrC8 postingBufferDesC(
+            reinterpret_cast< const TUint8* >( aPostingBuffer->GetBuffer() ),
+            frameBufferSizeInBytes );
+        *iFrameBuffer = postingBufferDesC;
+        }
+    SetFlag( EFrameBufferFilled | EFrameBufferNeedsConvertAndScale );
+    __VTPRINTEXIT( "RVD(DP).StoreFrameBuffer" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CreateFrameBufferL
+// Creates frame buffer.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CreateFrameBufferL( const TSize& aSize )
+    {
+    __VTPRINTENTER( "RVD(DP).CreateFrameBufferL" )
+    delete iFrameBuffer; iFrameBuffer = NULL;
+    iFrameBuffer = HBufC8::NewL( GetFrameBufferSize( aSize ) );
+    ClearFlag( EFrameBufferFilled | EFrameBufferNeedsConvertAndScale );
+    __VTPRINTEXIT( "RVD(DP).CreateFrameBufferL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SetAvailableToSink
+// Sets posting buffer available to sink.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::SetAvailableToSink( CPostingSurface::TPostingBuff* aBuffer )
+    {
+    __VTPRINTENTER( "RVD(DP).SetAvailableToSink" )
+    for ( TInt i = MDisplaySink::EFirstBitmap;
+          i < MDisplaySink::EFirstBitmap + KVtEngMaxBuffers; i++ )
+        {
+        if ( !iBuffers[ i ].IsSet() )
+            {
+            __VTPRINT3( DEBUG_MEDIA,
+                "RVD(DP).SetAvailableToSink buffer %d: $%x",
+                i, reinterpret_cast< TUint >( aBuffer->GetBuffer() ) );
+            iBuffers[ i ].Set( aBuffer );
+            Activate();
+            DisplaySink().SetBitmapAvailable(
+                static_cast< MDisplaySink::TBitmapNo >( i ) );
+            break;
+            }
+        }
+    __VTPRINTEXIT( "RVD(DP).SetAvailableToSink" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::SetAvailableToSink
+// Sets posting buffer available to sink.
+// -----------------------------------------------------------------------------
+//
+CPostingSurface* CVtEngDrawDP::CreatePostingSurfaceL()
+    {
+    __VTPRINTENTER( "RVD(DP).CreatePostingSurfaceL" )
+    CPostingSurface* postingSurface = NULL;
+    CPostingSurfaceFactory* ( *createFactoryL )()  =
+        reinterpret_cast< CPostingSurfaceFactory*(*)() >( iDPLib->Lookup( 1 ) );
+    if ( createFactoryL )
+        {
+        CPostingSurfaceFactory* factory = createFactoryL();
+        CleanupStack::PushL( factory );
+        postingSurface = factory->NewPostingSurfaceL( EMainDisplay );
+        CleanupStack::PopAndDestroy(); // factory
+        }
+    __VTPRINTEXIT( "RVD(DP).CreatePostingSurfaceL" )
+    return postingSurface;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CloseDPLibrary
+// Close the DP API library and free the allocated instance.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CloseDPLibrary()
+    {
+    if ( iDPLib )
+        {
+        iDPLib->Close();
+        delete iDPLib;
+        iDPLib = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::LoadDPLibraryL
+// Loads DP API library.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::LoadDPLibraryL()
+    {
+    CloseDPLibrary();
+    iDPLib = new ( ELeave ) RLibrary();
+    TInt error( iDPLib->Load( KDPAPIDLLName() ) );
+    if ( error )
+        {
+        delete iDPLib;
+        iDPLib = NULL;
+        User::Leave( error );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::Convert420ToVtImg
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::Convert420ToVtImg( HBufC8* aSource,
+    CVtImageBitmap& aTarget )
+    {
+    __VTPRINTENTER( "RVD(DP).Convert420ToVtImg" )
+
+    CFbsBitmap& bitmap( aTarget.Bitmap() );
+    TSize size( bitmap.SizeInPixels() );
+    TInt height( size.iHeight );
+    TInt width( size.iWidth );
+    TInt bytes( bitmap.ScanLineLength( width, bitmap.DisplayMode() ) );
+
+    const TUint8* y1ptr = aSource->Ptr();
+    const TUint8* y2ptr = y1ptr + width;
+    const TUint8* uptr = y1ptr + ( width * height );
+    const TUint8* vptr = uptr + ( width * height ) / 4;
+
+    bitmap.LockHeap();
+
+    TUint8* d1ptr = reinterpret_cast< TUint8* >( bitmap.DataAddress() );
+    TUint8* d2ptr = d1ptr + bytes;
+
+    height /= 2;    // divide by 2 because we process to rows at time
+    bytes *= 2;     // multiply by 2 so we don't need to do it in loop
+
+    while ( height-- )
+        {
+        DoConvertYuv420toXRGB0888( width, y1ptr, y2ptr, uptr, vptr, d1ptr,
+            d2ptr );
+        y1ptr = y2ptr;
+        y2ptr += width;
+        d1ptr += bytes;
+        d2ptr += bytes;
+        }
+
+    bitmap.UnlockHeap();
+
+    __VTPRINTEXIT( "RVD(DP).Convert420ToVtImg" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::Convert422ToVtImg
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::Convert422ToVtImg( HBufC8* aSource, CVtImageBitmap& aTarget )
+    {
+    __VTPRINTENTER( "RVD(DP).Convert422ToVtImg" )
+    CFbsBitmap& bitmap( aTarget.Bitmap() );
+    TSize size( bitmap.SizeInPixels() );
+    TInt height( size.iHeight );
+    TInt width( size.iWidth );
+    TInt bytes( bitmap.ScanLineLength( width, bitmap.DisplayMode() ) );
+
+    const TUint8* sptr = aSource->Ptr();
+
+    bitmap.LockHeap();
+
+    TUint8* dptr = reinterpret_cast< TUint8* >( bitmap.DataAddress() );
+    while ( height-- )
+        {
+        DoConvertYuv422toXRGB0888( width, sptr, dptr );
+        dptr += bytes;
+        }
+
+    bitmap.UnlockHeap();
+
+    __VTPRINTEXIT( "RVD(DP).Convert422ToVtImg" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::UpdateVtFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::UpdateVtFrame()
+    {
+    __VTPRINTENTER( "RVD(DP).UpdateVtFrame" )
+    if ( IsFlag( EFrameBufferFilled ) )
+        {
+        CFbsBitmap* bitmap = NULL;
+        if ( IsFlag( EFrameBufferNeedsConvertAndScale ) )
+            {
+            if ( iPostingFormat == KDefaultPostingFormat422 )
+                {
+                Convert422ToVtImg( iFrameBuffer, *iSource );
+                }
+            else
+                {
+                Convert420ToVtImg( iFrameBuffer, *iSource );
+                }
+            TRAPD( error, iImageScaler->ScaleNowL( *iSource, *iTarget ) );
+            if ( !error )
+                {
+                bitmap = &iTarget->Bitmap();
+                }
+            ClearFlag( EFrameBufferNeedsConvertAndScale );
+            }
+        else
+            {
+            bitmap = &iTarget->Bitmap();
+            }
+        Config().iObserver->vtSetFrame( MVtEngFrameObserver::ERemoteVideoFrame,
+            bitmap );
+        }
+    __VTPRINTEXIT( "RVD(DP).UpdateVtFrame" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::ScalingFinished
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::ScalingFinished( TInt )
+    {
+    }
+
+// Implementation for CVtEngDrawDP::TVtEngBuffer
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::TVtEngBuffer
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::TVtEngBuffer::TVtEngBuffer()
+    : iBuffer( 0 )
+    {
+    __VTPRINTENTER( "RVD(DP).Buffer.Ctor" )
+    __VTPRINTEXIT( "RVD(DP).Buffer.Ctor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::Set
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::TVtEngBuffer::Set( CPostingSurface::TPostingBuff* aBuffer )
+    {
+    __VTPRINTENTER( "RVD(DP).Buffer.Set" )
+    __VTPRINT2( DEBUG_MEDIA, "RVD(DP).Buffer.Set $%x",
+        reinterpret_cast< TUint >( aBuffer->GetBuffer() ) )
+    iBuffer = aBuffer;
+    __VTPRINTEXIT( "RVD(DP).Buffer.Set" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::UnSet
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::TVtEngBuffer::UnSet()
+    {
+    __VTPRINTENTER( "RVD(DP).Buffer.UnSet" )
+    iBuffer = 0;
+    __VTPRINTEXIT( "RVD(DP).Buffer.UnSet" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::IsSet
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawDP::TVtEngBuffer::IsSet() const
+    {
+    return ( iBuffer != 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::TVtEngBuffer::Buffer
+//
+// -----------------------------------------------------------------------------
+//
+CPostingSurface::TPostingBuff*& CVtEngDrawDP::TVtEngBuffer::Buffer()
+    {
+    return iBuffer;
+    }
+
+// Implementation for CVtEngDrawDP::CVtEngBufferWaiter
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::CVtEngBufferWaiter
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::CVtEngBufferWaiter::CVtEngBufferWaiter
+    ( CPostingSurface& aPostingSurface, MVtEngBufferWaiterObserver& aObserver )
+    : CActive( CActive::EPriorityStandard ),
+      iPostingSurface( &aPostingSurface ), iObserver( &aObserver )
+    {
+    __VTPRINTENTER( "RVD(DP).BufferWaiter.Ctor" )
+    CActiveScheduler::Add( this );
+    __VTPRINTEXIT( "RVD(DP).BufferWaiter.Ctor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::~CVtEngBufferWaiter
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDP::CVtEngBufferWaiter::~CVtEngBufferWaiter()
+    {
+    __VTPRINTENTER( "RVD(DP).BufferWaiter.~" )
+    Cancel();
+    __VTPRINTEXIT( "RVD(DP).BufferWaiter.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::Activate
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CVtEngBufferWaiter::Activate()
+    {
+    __VTPRINTENTER( "RVD(DP).BufferWaiter.Activate" )
+    iStatus = KRequestPending;
+    SetActive();
+    __VTPRINTEXIT( "RVD(DP).BufferWaiter.Activate" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::FetchBuffer
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngDrawDP::CVtEngBufferWaiter::FetchBuffer()
+    {
+    __VTPRINTENTER( "RVD(DP).BufferWaiter.FetchBuffer" )
+    // do nothing if we're already active
+    if ( IsActive() )
+        {
+        __VTPRINTEXIT( "RVD(DP).BufferWaiter.FetchBuffer" )
+        return KErrNone;
+        }
+    // else start fetching
+    Activate();
+    __VTPRINTEXIT( "RVD(DP).BufferWaiter.FetchBuffer" )
+    return iPostingSurface->WaitForNextBuffer( iStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CVtEngBufferWaiter::RunL()
+    {
+    __VTPRINTENTER( "RVD(DP).BufferWaiter.RunL" )
+    __VTPRINT2( DEBUG_MEDIA, "RVD(DP).BufferWaiter.RunL %d", iStatus.Int() );
+    TInt result( iStatus.Int() );
+    if (  result == KErrNone )
+        {
+        iObserver->BufferReady( iPostingSurface->NextBuffer() );
+        }
+    else
+        {
+        iObserver->FetchError( result );
+        }
+    __VTPRINTEXIT( "RVD(DP).BufferWaiter.RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDP::CVtEngBufferWaiter::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDP::CVtEngBufferWaiter::DoCancel()
+    {
+    __VTPRINTENTER( "RVD(DP).BufferWaiter.DoCancel" )
+    iPostingSurface->CancelBuffer();
+    __VTPRINTEXIT( "RVD(DP).BufferWaiter.DoCancel" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngDrawDSA.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,586 @@
+/*
+* 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:  Remote video handler.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CVtEngDrawDSA.h"
+#include "CVtEngEventManager.h"
+#include "VtEngPanic.h"
+#include "MVtEngFrameObserver.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include <videotelephonyvariant.hrh>
+#include <tdisplaysinkparamsdsa.h>
+#include <cvtlogger.h>
+
+// LOCAL CONSTANTS
+
+// Default display mode.
+const TDisplayMode KVtEngDefaultDisplayMode( EColor64K );
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::NewL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDSA* CVtEngDrawDSA::NewL(
+    MDisplaySinkObserver* aObserver )
+    {
+    CVtEngDrawDSA* self = new ( ELeave ) CVtEngDrawDSA( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::~CVtEngDrawDSA
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDSA::~CVtEngDrawDSA()
+    {
+    __VTPRINTENTER( "RVD(DSA).~" )
+    Cancel();
+    delete iBitmap1;
+    delete iBitmap2;
+    if ( iImageScaler )
+        {
+        iImageScaler->Release();
+        }
+    __VTPRINTEXIT( "RVD(DSA).~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::CVtEngDrawDSA
+// C++ constructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawDSA::CVtEngDrawDSA( MDisplaySinkObserver* aObserver ) :
+    CVtEngDraw( aObserver ), iBitmapSetAvail( ETrue )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseConstructL
+// Base construction.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseConstructL( )
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseConstructL" )
+    TSize vtEngRemoteVideoDefaultSize( KVtEngRemoteVideoDefaultWidth,
+        KVtEngRemoteVideoDefaultHeight );
+
+    iBitmap1 = new ( ELeave ) CFbsBitmap();
+    User::LeaveIfError( iBitmap1->Create(
+        vtEngRemoteVideoDefaultSize, KVtEngDefaultDisplayMode ) );
+    iBitmap2 = new ( ELeave ) CFbsBitmap();
+    User::LeaveIfError( iBitmap2->Create(
+        vtEngRemoteVideoDefaultSize, KVtEngDefaultDisplayMode ) );
+    iImageScaler = VtEngScalerFactory::CreateScalerL( *this );
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT,
+        "RVD.ConL scaler ok %d", iImageScaler != NULL )
+    __VTPRINTEXIT( "RVD(DSA).BaseConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::CreateSinkL
+// Instantiates display sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink* CVtEngDrawDSA::CreateSinkL()
+    {
+    __VTPRINTENTER( "RVD(DSA).CreateSinkL" )
+    TDisplaySinkParamsDSA params;
+    GetSinkParams( params );
+    MDisplaySink* sink = ::CreateSinkL( params, KNullDesC8 );
+    __VTPRINTEXITR( "RVD(DSA).CreateSinkL flags=%d", params.iFlags )
+    return sink;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseDoCancel
+// DoCancel for derived class.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseDoCancel()
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseDoCancel" )
+    __VTPRINTEXIT( "RVD(DSA).BaseDoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseVerifyConfigL
+// Checks current configuration against DSA implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseVerifyConfigL()
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseVerifyConfigL" )
+    __VTPRINTEXIT( "RVD(DSA).BaseVerifyConfigL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseRestartL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseRestartL()
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseRestartL" )
+    __VTPRINTEXIT( "RVD(DSA).BaseRestartL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseAbortNow
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseAbortNow()
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseAbortNow" )
+    __VTPRINTEXIT( "RVD(DSA).BaseAbortNow" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseStartDrawL
+// Starts the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseStartDrawL()
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseStartDrawL" )
+    if ( iDSA )
+        {
+        SetFlag( EReadyInternal );
+        if ( !IsActive() )
+            {
+            Activate();
+            iDisplaySink->SetBitmapAvailable( MDisplaySink::EFirstBitmap );
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                "RVD(DSA).BaseStartDrawL bmp avail done" )
+            iWatcher->Start( KVtEngWatcherTimeout, KVtEngWatcherTimeout,
+                iCallback );
+            }
+        SetFlag( ERemoteVideoDrawing );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    __VTPRINTEXIT( "RVD(DSA).BaseStartDrawL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseStopDraw
+// Stop the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseStopDraw()
+    {
+    // Cancel the timer in any case.
+    __VTPRINTENTER( "RVD(DSA).BaseStopDraw" )
+    iWatcher->Cancel();
+    if ( iDSA )
+        {
+        ClearFlag( ERemoteVideoDrawing | EStarted );
+        iDSA->Cancel();
+        }
+
+    // Stop also scaling
+    if ( iImageScaler )
+        {
+        iImageScaler->Cancel();
+        }
+
+    Cancel();
+    __VTPRINTEXIT( "RVD(DSA).BaseStopDraw" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseSetConfigL
+// Sets new configuration.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseSetConfigL( const TVtEngRenderConfig& aConfig )
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseSetConfigL" )
+    Mem::FillZ( &iConfig, sizeof( TVtEngRenderConfigDSA ) );
+    iConfig = aConfig;
+    ConfigUpdatedL();
+    __VTPRINTEXIT( "RVD(DSA).BaseSetConfigL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseSetUIForegroundL
+// Sets UI foreground status.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseSetUIForegroundL( TBool aForeground )
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseSetUIForegroundL" )
+    if ( aForeground )
+        {
+        TBool wasSentToBackground( IsFlag( ESentToBackground ) );
+        SetFlag( EFlagUIForeground );
+        ClearFlag( ESentToBackground );
+        if ( wasSentToBackground )
+            {
+            BaseRefreshBitmapsL();
+            Restart( RDirectScreenAccess::ETerminateCancel );
+            BaseStartDrawL();
+            }
+        }
+    else
+        {
+        BaseStopDraw();
+        ClearFlag( EFlagUIForeground );
+        SetFlag( ESentToBackground );
+        }
+    __VTPRINTEXIT( "RVD(DSA).BaseSetUIForegroundL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseVideoFrameSizeChangedL
+// Called when incoming frame buffer size changes.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseVideoFrameSizeChangedL( const TSize& /*aTo*/ )
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseVideoFrameSizeChangedL" )
+    __VTPRINTEXIT( "RVD(DSA).BaseVideoFrameSizeChangedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseRequestLastFrame
+// Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseRequestLastFrame()
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseRequestLastFrame" )
+    __VTPRINTEXIT( "RVD(DSA).BaseRequestLastFrame" )    
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::Config
+// Returns current configuration.
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderConfig& CVtEngDrawDSA::Config()
+    {
+    return iConfig;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::RunL
+// CActive heir execution method.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::RunL()
+    {
+    __VTPRINTENTER( "RVD(DSA).RunL" )
+    __VTPRINT2( DEBUG_MEDIA, "  bmpNo=%d", iBitmapNo )
+    iBitmapNo = iStatus.Int() == 0 ?
+        MDisplaySink::ESecondBitmap :
+        MDisplaySink::EFirstBitmap ;
+
+    iBitmapSetAvail = EFalse;
+
+    TBool dropFrame( EFalse );
+
+    if ( !iDSUpdated )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(DSA).RunL !Updated" )
+        dropFrame = ETrue;
+        }
+    else if ( !IsFlag( EFlagUIForeground ) )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(DSA).RunL !Flag( EFlagUIForeground )" )
+        dropFrame = ETrue;
+        }
+
+    if ( dropFrame )
+        {
+        iBitmapSetAvail = ETrue;
+        Activate();
+        iDisplaySink->SetBitmapAvailable( iBitmapNo );
+        __VTPRINTEXIT( "RVD(DSA).RunL" )
+        return;
+        }
+
+    // Image received, reset counter.
+    iCheckpoint = KVtEngWatcherThreshold;
+
+    __VTPRINT2( DEBUG_MEDIA, "RVD(DSA).RunL iStatus=%d", iStatus.Int() )
+    if ( iStatus >= KErrNone )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "RVD(DSA).RunL flags=%d", iFlags )
+        TBool firstFrame( !IsFlag ( EFirstFrameReceived ) );
+        SetFlag( EFirstFrameReceived );
+
+        // Remote video is about to start?
+        if ( !IsFlag( EStarted ) && IsFlag( EReadyInternal ) )
+            {
+            SetFlag( EStarted );
+            iDSA->StartL();
+            if ( !iConfig.iClipRect.IsEmpty() )
+                {
+                SetFlag( EReadyForeground );
+                iDSA->Gc()->SetClippingRect( iConfig.iClipRect );
+                }
+            __VTPRINT( DEBUG_MEDIA, "RVD(DSA).RunL notify rvd start" )
+            //CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+            }
+        if ( firstFrame )
+            {
+            CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+            }
+        if ( IsFlag( EStarted ) )
+            {
+            __VTPRINT( DEBUG_MEDIA, "RVD(DSA).RunL refresh" )
+            BaseRefreshL();
+            }
+        }
+    else
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD.RunL notify rvd problem" )
+        CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+        __VTPRINTEXIT( "RVD(DSA).RunL" )
+        return;
+        }
+
+    __VTPRINT( DEBUG_MEDIA, "RVD.RunL setting active" )
+    Activate();
+
+    // Set bitmap only if not to be scaled
+    if( !iImageScaler )
+        {
+        if ( !iBitmapSetAvail )
+            {
+            iDisplaySink->SetBitmapAvailable( iBitmapNo );
+            iBitmapSetAvail = ETrue;
+            }
+        __VTPRINT( DEBUG_MEDIA, "RVD(DSA).ScalingCompleted set bmp available" )
+        }
+
+    __VTPRINTEXIT( "RVD(DSA).RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::ScalingCompleted
+// Callback to receive scaled images.
+// Draws received image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::ScalingCompleted(
+    CFbsBitmap* aBitmap,
+    TInt aError )
+    {
+    __VTPRINTENTER( "RVD(DSA).ScalingCompleted" )
+    __VTPRINT2( DEBUG_MEDIA, "RVD(DSA).ScalingReady %d", aError )
+    __VTPRINT2( DEBUG_MEDIA, "RVD(DSA).ScalingReady image %d", aBitmap ? 1 : 0 )
+    if ( aError == KErrNone &&
+         aBitmap != NULL )
+        {
+        DrawBitmap( *aBitmap );
+        if ( !iBitmapSetAvail )
+            {
+            // Set bitmap available if not already set
+            __VTPRINT( DEBUG_MEDIA, "RVD(DSA).ScalingCompleted set bmp available" )
+            Activate();
+            iDisplaySink->SetBitmapAvailable( iBitmapNo );
+            iBitmapSetAvail = ETrue;
+            }
+        __VTPRINT( DEBUG_MEDIA, "RVD(DSA).ScalingCompleted available?" )
+        }
+    else if ( aError != KErrCancel )
+        {
+        // Notification of failed scaling.
+        CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+        __VTPRINT( DEBUG_MEDIA, "RVD(DSA).ScalingReady problems" )
+        }
+    __VTPRINTEXITR( "RVD(DSA).ScalingCompleted err=%d", aError )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseRefreshL
+// If using scaler, start the scaling otherwise draw a bitmap.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseRefreshL()
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseRefreshL" )
+    if ( iConfig.iWindow )
+        {
+        if ( IsFlag( EReady ) && IsFlag( EFirstFrameReceived ) &&
+                IsFlag( EFlagUIForeground ) )
+            {
+            CFbsBitmap* current = iBitmapNo != 0 ? iBitmap1 : iBitmap2;
+            if ( current )
+                {
+                if ( iImageScaler )
+                    {
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                        "RVD(DSA).BaseRefreshL scaling" )
+                    TInt index = 0;
+                    if ( current == iBitmap2 )
+                        {
+                        index = 1;
+                        }
+                    iImageScaler->Cancel();
+                    iImageScaler->ScaleL( index );
+                    }
+                else
+                    {
+                    DrawBitmap( *current );
+                    }
+                }
+            }
+        }
+    __VTPRINTEXIT( "RVD(DSA).BaseRefreshL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::BaseRefreshBitmapsL
+// Refreshes bitmaps sizes and display mode if needed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::BaseRefreshBitmapsL()
+    {
+    __VTPRINTENTER( "RVD(DSA).BaseRefreshBitmapsL" )
+    const TDisplayMode currentMode( iConfig.iWsSreenDevice->DisplayMode() );
+    TBool refreshDisplayMode = EFalse;
+    TSize newSize( KVtEngRemoteVideoDefaultWidth,
+        KVtEngRemoteVideoDefaultHeight );
+
+    // Use new size if supplied
+    if ( iSourceSize.iHeight > 0 && iSourceSize.iWidth > 0 )
+        {
+        newSize = iSourceSize;
+        iSourceSize.iHeight = 0;
+        iSourceSize.iWidth = 0;
+        }
+
+    __VTPRINT( DEBUG_MEDIA , "================== RVD.RFBM ==================" )
+    __VTPRINT2( DEBUG_MEDIA , "    newSize.iWidth: %d", newSize.iWidth)
+    __VTPRINT2( DEBUG_MEDIA , "    newSize.iHeight: %d ", newSize.iHeight )
+    __VTPRINT( DEBUG_MEDIA , "================== RVD.RFBM ==================" )
+
+    TBool refreshSize = EFalse;
+    if ( iBitmap1 )
+        {
+        refreshDisplayMode = ( iBitmap1->DisplayMode() != currentMode );
+        refreshSize = ( newSize != iBitmap1->SizeInPixels() );
+        }
+
+    // Delete and create the bitmaps
+    if ( refreshDisplayMode || refreshSize || !iBitmap1 || !iBitmap2 )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+            "RVD(DSA).BaseRefreshBitmapsL bmp create" )
+        if ( iImageScaler )
+            {
+            iImageScaler->Cancel();
+            }
+
+        iConfig.iObserver->vtSetFrame(
+            MVtEngFrameObserver::ERemoteVideoFrame, 0 );
+        delete iBitmap1;
+        iBitmap1 = NULL;
+        delete iBitmap2;
+        iBitmap2 = NULL;
+
+        iBitmap1 = new ( ELeave ) CFbsBitmap();
+        User::LeaveIfError( iBitmap1->Create(
+            newSize, currentMode ) );
+        iBitmap2 = new ( ELeave ) CFbsBitmap();
+        User::LeaveIfError( iBitmap2->Create(
+            newSize, currentMode ) );
+        ClearFlag( EFirstFrameReceived );
+        }
+
+    // set the params for DS
+    TDisplaySinkParamsDSA params;
+    GetSinkParams( params );
+
+     // Update the scaler
+    if ( iImageScaler )
+        {
+        // Try to configure first, if returns true
+        // configure again
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+            "RVD(DSA).BaseRefreshBitmapsL cnfg" )
+
+        iImageScaler->ConfigureL( currentMode,
+        	iConfig.iRect.Size(), params.iBitmap1Handle,
+        	params.iBitmap2Handle );
+
+        if ( IsFlag( EFirstFrameReceived ) )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                "CVtEngDrawDSA::RefreshBitmapsL RFR" )
+            BaseRefreshL();
+            }
+
+        }
+	__VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+	"RVD(DSA).BaseRefreshBitmapsL USP" )
+	__VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+	"RVD(DSA).BaseRefreshBitmapsL USP flag" )
+    iDisplaySink->UpdateSinkParamsL( params, iDSUpdated );
+    Activate();
+    iDisplaySink->SetBitmapAvailable( MDisplaySink::EFirstBitmap );
+    __VTPRINTEXIT( "RVD(DSA).BaseRefreshBitmapsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::DrawBitmap
+// Draws bitmap
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::DrawBitmap( CFbsBitmap& aBitmap )
+    {
+    __VTPRINTENTER( "RVD(DSA).DrawBitmap" )
+    __ASSERT_ALWAYS( aBitmap.Handle(),
+        Panic( EVtEngPanicInvalidBitmapHandle ) );
+    __ASSERT_ALWAYS( iDSA, Panic( EVtEngPanicInvalidPointer ) );
+    iDSA->Gc()->SetFaded( iConfig.iWindow->IsFaded() );
+    iDSA->Gc()->BitBlt( iConfig.iRect.iTl, &aBitmap );
+    iDSA->ScreenDevice()->Update();
+    iConfig.iObserver->vtSetFrame( MVtEngFrameObserver::ERemoteVideoFrame,
+        &aBitmap );
+	__VTPRINTEXITR( "RVD(DSA).DrawBitmap h=%d", aBitmap.Handle() )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::GetSinkParams
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawDSA::GetSinkParams( TDisplaySinkParamsDSA& aSinkParams )
+    {
+    __VTPRINTENTER( "RVD(DSA).GetSinkParams" )
+    aSinkParams.iThreadId = RThread().Id();
+    aSinkParams.iRequestStatusPtr = &iStatus;
+    aSinkParams.iObserver = iObserver;
+    aSinkParams.iBitmap1Handle = iBitmap1->Handle();
+    aSinkParams.iBitmap2Handle = iBitmap2->Handle();
+    aSinkParams.iFlags = TDisplaySinkParams::EDisplaySinkDSA;
+	__VTPRINTEXIT( "RVD(DSA).GetSinkParams" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngDrawNGA.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1025 @@
+/*
+* 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:  Class for NGA Drawer.
+*
+*/
+
+// INCLUDE FILES
+
+#include "CVtEngDrawNGA.h"
+#include "CVtEngEventManager.h"
+#include "VtEngPanic.h"
+#include "MVtEngFrameObserver.h"
+#include "CVtEngSettings.h"
+#include "VtEngUtils.h"
+#include <videotelephonyvariant.hrh>
+#include <tdisplaysinkparamsnga.h>
+#include <cvtlogger.h>
+#include <graphics/surfaceconfiguration.h>
+
+// Reversed enumeration for the bitmaps.
+static const MDisplaySink::TBitmapNo KVtEngBitmapNoReversed[] =
+        {
+        MDisplaySink::ESecondBitmap,
+        MDisplaySink::EFirstBitmap
+        };
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVTSurfaceBuffer::TVTSurfaceBuffer
+//
+// -----------------------------------------------------------------------------
+//
+TVTSurfaceBuffer::TVTSurfaceBuffer( TUint8* aBuffer, TInt aSurfaceNo )
+    : iBuffer( aBuffer ), iSurfaceBufferNo(aSurfaceNo)
+    {
+    __VTPRINTENTER( "RVD(NGA).TVTSurfaceBuffer.Ctor" )
+    __VTPRINTEXIT( "RVD(NGA).TVTSurfaceBuffer.Ctor" )
+    }
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVTSurfaceBuffer::Buffer
+//
+// -----------------------------------------------------------------------------
+//
+TUint8*& TVTSurfaceBuffer::Buffer()
+    {
+    return iBuffer;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVTSurfaceBuffer::SurfaceNo
+//
+// -----------------------------------------------------------------------------
+//
+TInt TVTSurfaceBuffer::SurfaceNo()
+    {
+    return iSurfaceBufferNo;
+    }
+        
+void TVTSurfaceBuffer::Set( TUint8* aBuffer, TInt aSurfaceNo )
+    {
+    iBuffer = aBuffer;
+    iSurfaceBufferNo = aSurfaceNo;
+    }
+    
+void TVTSurfaceBuffer::UnSet()
+    {
+    iBuffer = NULL;
+    iSurfaceBufferNo = KErrNotFound;
+    }
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::NewL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA* CVtEngDrawNGA::NewL(
+    MDisplaySinkObserver* aObserver )
+    {
+    CVtEngDrawNGA* self = new ( ELeave ) CVtEngDrawNGA( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::~CVtEngDrawNGA
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::~CVtEngDrawNGA()
+    {
+    __VTPRINTENTER( "RVD(NGA).~" )
+    Cancel();   
+    
+    if(iSurfaceCreated)
+        {
+        
+        if (iSurfaceManager)
+            {
+            iConfig.iRemoteWindow->RemoveBackgroundSurface(ETrue);
+            iConfig.iWsSession->UnregisterSurface(0, iSurfaceId);
+            iSurfaceChunk->Close();
+            delete iSurfaceChunk;
+            iSurfaceChunk = NULL;
+            iSurfaceManager->CloseSurface(iSurfaceId);
+            iSurfaceUpdateSession.CancelAllUpdateNotifications();
+            iSurfaceUpdateSession.Close();
+                       
+             /* Close the surface manager handle */
+            iSurfaceManager->Close();
+           
+            delete iSurfaceManager;
+            iSurfaceManager = 0;
+            }
+           
+        for ( TInt i = KVtEngMaxSurfaceBuffers-1; i >= 0 ; i-- )
+            {
+            if (iCallBackTable[i])
+                {
+                iCallBackTable[i]->Cancel();
+                delete iCallBackTable[i];
+                iCallBackTable[i] = NULL;
+                }
+            }
+    
+        iSurfaceBuffers[ 0 ].UnSet();
+        iSurfaceBuffers[ 1 ].UnSet();
+        iSurfaceBuffer0.UnSet();
+        iSurfaceBuffer1.UnSet();
+        }
+    delete iBufferWaiter;   
+    iWaitingBuffers.Reset();
+    
+    __VTPRINTEXIT( "RVD(NGA).~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngDrawNGA
+// C++ constructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::CVtEngDrawNGA( MDisplaySinkObserver* aObserver ) :
+    CVtEngDraw( aObserver ),
+    iSurfaceFormat( EUidPixelFormatYUV_420Planar )
+    
+    {
+    iConfig.iRemoteWindow = NULL;
+    iConfig.iWsSession = NULL;
+    iSurfaceCreated = EFalse;
+    iWaitingBuffers.Reset();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseConstructL
+// Base construction.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseConstructL( )
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseConstructL" )
+    DoBaseConstructL();
+    __VTPRINTEXIT( "RVD(NGA).BaseConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CreateSinkL
+// Instantiates display sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink* CVtEngDrawNGA::CreateSinkL()
+    {
+    __VTPRINTENTER( "RVD(NGA).CreateSinkL" )
+    TDisplaySinkParamsNGA params;
+    GetSinkParams( params );
+    MDisplaySink* sink = ::CreateSinkL( params, KNullDesC8 );
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        sink->Pause();
+        SetFlag( ESinkParamUpdateRequired | ESinkResumeRequired );
+        }    
+    __VTPRINTEXITR( "RVD(NGA).CreateSinkL flags=%d", params.iFlags )
+    return sink;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseRefreshL
+// If using scaler, start the scaling otherwise draw a bitmap.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseRefreshL()
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseRefreshL" )
+    __VTPRINTEXIT( "RVD(NGA).BaseRefreshL" )
+    }
+   
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseRefreshBitmapsL
+// Refreshes bitmaps sizes and display mode if needed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseRefreshBitmapsL()
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseRefreshBitmapsL" )
+    BaseConstructL();
+    CreateSurfaceL();
+    // set the params for DS
+    UpdateSinkParamsL();
+    ClearFlag( EFirstFrameReceived );    
+    __VTPRINTEXIT( "RVD(NGA).BaseRefreshBitmapsL" )
+    }   
+    
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseDoCancel
+// DoCancel for derived class.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseDoCancel()
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseDoCancel" )
+    __VTPRINTEXIT( "RVD(NGA).BaseDoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseVerifyConfigL
+// Checks current configuration against DSA implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseVerifyConfigL()
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseVerifyConfigL" )
+    __VTPRINTEXIT( "RVD(NGA).BaseVerifyConfigL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseRestartL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseRestartL()
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseRestartL" )
+    __VTPRINTEXIT( "RVD(NGA).BaseRestartL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseAbortNow
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseAbortNow()
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseAbortNow" )
+    __VTPRINTEXIT( "RVD(NGA).BaseAbortNow" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseStartDrawL
+// Starts the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseStartDrawL()
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseStartDrawL" )  
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        SetFlag( EBaseBaseStartDrawCalled );
+        }
+    else
+        {
+        DoBaseStartDrawL();
+        }
+    __VTPRINTEXIT( "RVD(NGA).BaseStartDrawL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseStopDraw
+// Stop the drawing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseStopDraw()
+    {
+    // Cancel the timer in any case.
+    __VTPRINTENTER( "RVD(NGA).BaseStopDraw" )
+    ClearFlag( EBaseBaseStartDrawCalled );
+    iWatcher->Cancel();
+    iBufferWaiter->Cancel();
+    ClearFlag( ERemoteVideoDrawing | EStarted );
+    for ( TInt i = KVtEngMaxSurfaceBuffers-1; i >= 0 ; i-- )
+        {
+        if (iCallBackTable[i])
+            {
+            iCallBackTable[i]->Cancel();
+            }
+        }
+    Cancel();
+    
+    __VTPRINTEXIT( "RVD(NGA).BaseStopDraw" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseSetConfigL
+// Sets new configuration.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseSetConfigL( const TVtEngRenderConfig& aConfig )
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseSetConfigL" )
+    Mem::FillZ( &iConfig, sizeof( TVtEngRenderConfigNGA ) );
+    iConfig = aConfig;
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        SetFlag( EBaseSetConfigCalled );
+        }
+    else
+        {
+        ConfigUpdatedL();
+        }
+    __VTPRINTEXIT( "RVD(NGA).BaseSetConfigL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseSetUIForegroundL
+// Sets UI foreground status.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseSetUIForegroundL( TBool aForeground )
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseSetUIForegroundL" )
+    __VTPRINTEXIT( "RVD(NGA).BaseSetUIForegroundL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseRequestLastFrame
+// Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseRequestLastFrame()
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseRequestLastFrame" )
+    __VTPRINTEXIT( "RVD(NGA).BaseRequestLastFrame" )    
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BaseVideoFrameSizeChangedL
+// Called when incoming frame buffer size changes.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BaseVideoFrameSizeChangedL( const TSize& /*aTo*/ )
+    {
+    __VTPRINTENTER( "RVD(NGA).BaseVideoFrameSizeChangedL" )
+    __VTPRINTEXIT( "RVD(NGA).BaseVideoFrameSizeChangedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawDSA::Config
+// Returns current configuration.
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderConfig& CVtEngDrawNGA::Config()
+    {
+    return iConfig;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::RunL
+// CActive heir execution method.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::RunL()
+    {
+    __VTPRINTENTER( "RVD(NGA).RunL" )
+    
+    TInt bitmapNo( iStatus.Int() );
+
+    if ( bitmapNo < KErrNone )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(NGA).RunL notify rvd problem" )
+        CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+        return;
+        }
+
+    TVtEngBuffer& buffer = iSurfaceBuffers[ bitmapNo ];
+    
+    if ( !iDSUpdated )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(NGA).RunL !Updated" )
+        __VTPRINTEXIT( "RVD(NGA).RunL" )
+        return;
+        }
+    else if ( buffer.SurfaceBuffer() == NULL )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(NGA).RunL signalled with NULL buffer" )
+        TInt result( iBufferWaiter->FetchBuffer() );
+        User::LeaveIfError( result );
+        __VTPRINTEXIT( "RVD(NGA).RunL" )
+        return;
+        }
+    
+    // Image received, reset counter.
+    iCheckpoint = KVtEngWatcherThreshold;
+
+    __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).RunL flags=%d", iFlags )
+    TBool firstFrame( !IsFlag ( EFirstFrameReceived ) );
+    SetFlag( EFirstFrameReceived );
+    if ( firstFrame )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStarted );
+        }
+
+    TInt surfaceno = buffer.SurfaceBuffer()->SurfaceNo();
+    __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).RunL received buffer surface id %d", surfaceno )
+    if ( iSubmitPending )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD(NGA).RunL submit pending")
+        iWaitingBuffers.AddLast(buffer);
+        }
+    else
+        {
+        iCallBackTable[surfaceno]->iStatus = KRequestPending;
+        iCallBackTable[surfaceno]->SetActive();
+        TTimeStamp timeStamp;
+        iSurfaceUpdateSession.NotifyWhenDisplayed(iCallBackTable[surfaceno]->iStatus, timeStamp);
+        iSubmitPending = ETrue;
+        iSurfaceUpdateSession.SubmitUpdate(0, iSurfaceId, surfaceno, NULL); 
+        buffer.UnSet();
+        }
+    if ( iSurfaceBuffers[ KVtEngBitmapNoReversed[ bitmapNo ] ].IsSet() )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).RunL reactivating for buffer %d",
+            KVtEngBitmapNoReversed[ bitmapNo ] )
+        Activate();
+        DisplaySink().NextFrame();
+        }    
+    TInt result = iBufferWaiter->FetchBuffer();
+    User::LeaveIfError( result );    
+    
+    __VTPRINTEXIT( "RVD(NGA).RunL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::BufferReadyL
+// BufferReadyL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::BufferReadyL( TVTSurfaceBuffer* aBuffer )
+    {
+    __VTPRINTENTER( "RVD(NGA).BufferReadyL" )
+    SetAvailableToSink( aBuffer );
+    __VTPRINTEXIT( "RVD(NGA).BufferReadyL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::FetchError
+// Buffer fetching error
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::FetchError( TInt )
+    {
+    __VTPRINTENTER( "RVD(NGA).FetchError" )
+    CVtEngEventManager::NotifyEvent( KVtEngRemoteRenderingProblem );
+    __VTPRINTEXIT( "RVD(NGA).FetchError" )
+    }    
+   
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DoBaseConstructL
+// Base construction implementation
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::DoBaseConstructL()
+    {
+    __VTPRINTENTER( "RVD(NGA).DoBaseConstructL" )
+    delete iBufferWaiter;
+    iBufferWaiter = NULL;
+
+    iBufferWaiter =
+        new ( ELeave ) CVtEngBufferWaiter( *this );
+        
+    for ( TInt i = MDisplaySink::EFirstBitmap;
+          i < MDisplaySink::EFirstBitmap + KVtEngMaxSurfaceBuffers; i++ )
+        {
+        iSurfaceBuffers[ i ].UnSet();
+        }     
+    ClearFlag( EBaseConstructCalled );          
+    __VTPRINTEXIT( "RVD(NGA).DoBaseConstructL" )
+    }
+          
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::UpdateSinkParamsL
+// Updates sink params
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::UpdateSinkParamsL()
+    {
+    __VTPRINTENTER( "RVD(NGA).UpdateSinkParamsL" )
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        SetFlag( ESinkParamUpdateRequired );
+        }
+    else
+        {
+        DoUpdateSinkParamsL();
+        }
+    __VTPRINTEXIT( "RVD(NGA).UpdateSinkParamsL" )
+    }
+
+    
+ // -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DoBaseStartDrawL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::DoBaseStartDrawL()
+    {
+    __VTPRINTENTER( "RVD(NGA).DoBaseStartDrawL" )
+    SetFlag( EReadyInternal );
+    if ( !iWatcher->IsActive() )
+       {
+       iWatcher->Start( KVtEngWatcherTimeout, KVtEngWatcherTimeout,
+             iCallback );
+       }
+    
+    DoSurfaceBuffer0Ready();
+    DoSurfaceBuffer1Ready();
+    
+    User::LeaveIfError( iBufferWaiter->FetchBuffer() );
+    
+        
+    SetFlag( ERemoteVideoDrawing );             
+    ClearFlag( EBaseBaseStartDrawCalled );
+    __VTPRINTEXIT( "RVD(NGA).DoBaseStartDrawL" )
+    }
+                   
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DoCreateSurfaceL
+// Create surface implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::DoCreateSurfaceL()
+    {
+    __VTPRINTENTER( "RVD(NGA).DoCreateSurfaceL" )  
+    TInt err;
+    
+    if(iSurfaceCreated)
+        {
+                
+        if (iSurfaceManager)
+            {
+            return;
+            
+            // Last return statement is for fixing an error causes
+            // green screen of remote video when swapping image after
+            // remote peer disabled video.
+            // So we return here to prevent recreate the surface object
+            // at this moment, codes below should NOT be removed due to
+            // potential future uses.
+            iConfig.iRemoteWindow->RemoveBackgroundSurface(ETrue);
+            iConfig.iWsSession->UnregisterSurface(0, iSurfaceId);
+            iSurfaceChunk->Close();
+            delete iSurfaceChunk;
+            iSurfaceChunk = NULL;
+            iSurfaceManager->CloseSurface(iSurfaceId);
+            iSurfaceUpdateSession.CancelAllUpdateNotifications();
+            iSurfaceUpdateSession.Close();
+                              
+            /* Close the surface manager handle */
+            iSurfaceManager->Close();
+            delete iSurfaceManager;
+            iSurfaceManager = 0;
+            }
+        for ( TInt i = KVtEngMaxSurfaceBuffers-1; i >= 0 ; i-- )
+            {
+                if (iCallBackTable[i])
+                    {
+                    iCallBackTable[i]->Cancel();
+                    delete iCallBackTable[i];
+                    iCallBackTable[i] = NULL;
+                    }
+            }
+        iSurfaceBuffers[ 0 ].UnSet();
+        iSurfaceBuffers[ 1 ].UnSet();
+        iSurfaceBuffer0.UnSet();
+        iSurfaceBuffer1.UnSet();
+        iWaitingBuffers.Reset();
+        }
+    
+    err = iSurfaceUpdateSession.Connect();    
+    User::LeaveIfError(err);
+    
+    iSurfaceManager = new RSurfaceManager();
+    
+    User::LeaveIfNull(iSurfaceManager); 
+    err = iSurfaceManager->Open();
+    User::LeaveIfError(err);
+    
+    RSurfaceManager::TSurfaceCreationAttributesBuf attributes;
+    attributes().iPixelFormat           = iSurfaceFormat; 
+    attributes().iSize                  = iSourceSize;
+    attributes().iBuffers               = KVtEngMaxSurfaceBuffers;
+
+    //attributes().iStride                = iSourceSize.iWidth*2;
+    attributes().iStride                = iSourceSize.iWidth*3/2;
+
+    attributes().iOffsetToFirstBuffer   = 0;
+    attributes().iAlignment             = 4;
+    attributes().iContiguous            = EFalse;
+    attributes().iMappable              = ETrue;
+        
+    err = iSurfaceManager->CreateSurface(attributes, iSurfaceId);
+    User::LeaveIfError(err);  
+    
+    // Map to chunk
+    iSurfaceChunk = new RChunk();
+    User::LeaveIfNull(iSurfaceChunk);    
+    err = iSurfaceManager->MapSurface(iSurfaceId, *iSurfaceChunk);
+    User::LeaveIfError(err);    
+
+    // Get the info from the surfaceManager
+    RSurfaceManager::TInfoBuf info;
+    err = iSurfaceManager->SurfaceInfo(iSurfaceId, info);
+    User::LeaveIfError(err);    
+
+    TInt offset;
+    iSurfaceManager->GetBufferOffset(iSurfaceId, 0, offset);
+    iSurfaceBuffer0.Set(iSurfaceChunk->Base() + offset, 0 );
+    iSurfaceManager->GetBufferOffset(iSurfaceId, 1, offset);
+    iSurfaceBuffer1.Set(iSurfaceChunk->Base() + offset, 1 );
+        
+    iConfig.iWsSession->RegisterSurface(0, iSurfaceId);   
+    iConfig.iRemoteWindow->SetBackgroundSurface(iSurfaceId);
+    
+    iCallBackTable[0] = new(ELeave) CActiveCallBack(TCallBack(SurfaceBuffer0Ready, this), CActive::EPriorityStandard-1);
+    CActiveScheduler::Add(iCallBackTable[0]);
+    iCallBackTable[1] = new(ELeave) CActiveCallBack(TCallBack(SurfaceBuffer1Ready, this), CActive::EPriorityStandard-1);
+    CActiveScheduler::Add(iCallBackTable[1]);
+    
+    iSurfaceCreated = ETrue;    
+    
+    ClearFlag( EInitializePostingSurfaceCalled );
+    __VTPRINTEXIT( "RVD(NGA).DoCreateSurfaceL" )
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DoUpdateSinkParamsL
+// Updates sink params
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::DoUpdateSinkParamsL()
+    {
+    __VTPRINTENTER( "RVD(NGA).DoUpdateSinkParamsL" )
+    TDisplaySinkParamsNGA params;
+    GetSinkParams( params );
+    DisplaySink().UpdateSinkParamsL( params, iDSUpdated );
+    ClearFlag( ESinkParamUpdateRequired );
+    if ( IsFlag( ESinkResumeRequired ) )
+        {
+        DisplaySink().Resume();
+        ClearFlag( ESinkResumeRequired );
+        }
+    __VTPRINTEXIT( "RVD(DP).DoUpdateSinkParamsL" )
+    }
+      
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CreateSurfaceL
+// Create surface.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CreateSurfaceL()
+    {
+    __VTPRINTENTER( "RVD(NGA).CreateSurfaceL" )
+    if ( IsFlag( EBaseConstructCalled ) )
+        {
+        SetFlag( EInitializePostingSurfaceCalled );
+        }
+    else
+        {
+        DoCreateSurfaceL();
+        }
+    __VTPRINTEXIT( "RVD(NGA).CreateSurfaceL" )
+    }
+           
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::GetSinkParams
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::GetSinkParams( TDisplaySinkParamsNGA& aSinkParams )
+    { 
+    __VTPRINTENTER( "RVD(NGA).GetSinkParams" )
+    Mem::FillZ( &aSinkParams, sizeof( TDisplaySinkParamsNGA ) );
+    aSinkParams.iThreadId = RThread().Id();
+    aSinkParams.iRequestStatusPtr = &iStatus;
+    aSinkParams.iObserver = iObserver;
+    aSinkParams.iSurfaceBuffer1 = &iSurfaceBuffers[ 0 ].Buffer();
+    aSinkParams.iSurfaceBuffer2 = &iSurfaceBuffers[ 1 ].Buffer();
+    aSinkParams.iFrameSize = iSourceSize;
+    aSinkParams.iSurfaceFormat = iSurfaceFormat;
+    aSinkParams.iFlags = TDisplaySinkParams::EDisplaySinkNGA;
+    __VTPRINTEXITR( "RVD(NGA).GetSinkParams flags=%d",
+        (TInt) aSinkParams.iFlags )	  
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::DisplaySink
+// Returns reference to sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink& CVtEngDrawNGA::DisplaySink()
+    {
+    return *iDisplaySink;
+    }
+     
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::SetToSink
+// Sets posting buffer  to sink.
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::SetAvailableToSink( TVTSurfaceBuffer* aBuffer )
+    {
+    __VTPRINTENTER( "RVD(NGA).SetAvailableToSink" )
+    for ( TInt i = MDisplaySink::EFirstBitmap;
+          i < MDisplaySink::EFirstBitmap + KVtEngMaxSurfaceBuffers; i++ )
+        {
+        if ( !iSurfaceBuffers[ i ].IsSet() )
+            {
+            iSurfaceBuffers[ i ].Set( aBuffer );
+            Activate();
+            DisplaySink().SetBitmapAvailable(
+                static_cast< MDisplaySink::TBitmapNo >( i ) );
+            break;
+            }
+        }
+    __VTPRINTEXIT( "RVD(NGA).SetAvailableToSink" )
+    }  
+
+TInt CVtEngDrawNGA::SurfaceBuffer0Ready( TAny* aAny )
+    {
+    __VTPRINTENTER( "RVD(NGA).SurfaceBuffer0Ready" )
+    __VTPRINTEXIT( "RVD(NGA).SurfaceBuffer0Ready" )
+    return ((CVtEngDrawNGA*)aAny)->DoSurfaceBuffer0Ready();
+    }
+
+TBool CVtEngDrawNGA::DoSurfaceBuffer0Ready()
+    {
+    __VTPRINTENTER( "RVD(NGA).DoSurfaceBuffer0Ready" )
+    if ( iSubmitPending )
+        {
+        iSubmitPending = EFalse;
+        }
+    if (!iWaitingBuffers.IsEmpty())
+        {
+        TVtEngBuffer* buffer = iWaitingBuffers.First();
+        TInt surfaceno = buffer->SurfaceBuffer()->SurfaceNo();
+        __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).DoSurfaceBuffer0Ready, surface buffer %d is in waitingqueue", surfaceno )
+        iCallBackTable[surfaceno]->iStatus = KRequestPending;
+        iCallBackTable[surfaceno]->SetActive();
+        TTimeStamp  timeStamp;
+        iSurfaceUpdateSession.NotifyWhenDisplayed(iCallBackTable[surfaceno]->iStatus, timeStamp);
+        iSubmitPending = ETrue;
+        iSurfaceUpdateSession.SubmitUpdate(0, iSurfaceId, surfaceno, NULL); 
+        iWaitingBuffers.Remove(*buffer);
+        buffer->UnSet();
+        }
+    iBufferWaiter->BufferAvailable(iSurfaceBuffer0);
+    __VTPRINTEXIT( "RVD(NGA).DoSurfaceBuffer0Ready" )
+    return ETrue;
+    }
+        
+TInt CVtEngDrawNGA::SurfaceBuffer1Ready( TAny* aAny )
+    {
+    __VTPRINTENTER( "RVD(NGA).SurfaceBuffer1Ready" )
+    __VTPRINTEXIT( "RVD(NGA).SurfaceBuffer1Ready" )
+    return ((CVtEngDrawNGA*)aAny)->DoSurfaceBuffer1Ready();
+    }
+
+TBool CVtEngDrawNGA::DoSurfaceBuffer1Ready()
+    {
+    __VTPRINTENTER( "RVD(NGA).DoSurfaceBuffer1Ready" )
+    if ( iSubmitPending )
+        {
+        iSubmitPending = EFalse;
+        }
+    
+    if (!iWaitingBuffers.IsEmpty())
+        {
+        TVtEngBuffer* buffer = iWaitingBuffers.First();
+        TInt surfaceno = buffer->SurfaceBuffer()->SurfaceNo();
+        __VTPRINT2( DEBUG_MEDIA, "RVD(NGA).DoSurfaceBuffer0Ready, surface buffer %d is in waitingqueue", surfaceno )
+        iCallBackTable[surfaceno]->iStatus = KRequestPending;
+        iCallBackTable[surfaceno]->SetActive();
+        TTimeStamp  timeStamp;
+        iSurfaceUpdateSession.NotifyWhenDisplayed(iCallBackTable[surfaceno]->iStatus, timeStamp);
+        iSubmitPending = ETrue;
+        iSurfaceUpdateSession.SubmitUpdate(0, iSurfaceId, surfaceno, NULL); 
+        iWaitingBuffers.Remove(*buffer);
+        buffer->UnSet();
+        }
+    iBufferWaiter->BufferAvailable(iSurfaceBuffer1);
+    __VTPRINTEXIT( "RVD(NGA).DoSurfaceBuffer1Ready" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::TVtEngBuffer
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::TVtEngBuffer::TVtEngBuffer()
+    : iBuffer( 0 ), iSurfaceBuffer(0)
+    {
+    __VTPRINTENTER( "RVD(NGA).Buffer.Ctor" )
+    __VTPRINTEXIT( "RVD(NGA).Buffer.Ctor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::Set
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::TVtEngBuffer::Set( TVTSurfaceBuffer* aBuffer )
+    {
+    __VTPRINTENTER( "RVD(NGA).Buffer.Set" )
+    iSurfaceBuffer = aBuffer;
+    iBuffer = aBuffer->Buffer();
+    __VTPRINTEXIT( "RVD(NGA).Buffer.Set" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::UnSet
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::TVtEngBuffer::UnSet()
+    {
+    __VTPRINTENTER( "RVD(NGA).Buffer.UnSet" )
+    iSurfaceBuffer = 0;
+    iBuffer = 0;
+    __VTPRINTEXIT( "RVD(NGA).Buffer.UnSet" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::IsSet
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDrawNGA::TVtEngBuffer::IsSet() const
+    {
+    return ( iSurfaceBuffer != NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::Buffer
+//
+// -----------------------------------------------------------------------------
+//
+TVTSurfaceBuffer* &CVtEngDrawNGA::TVtEngBuffer::SurfaceBuffer()
+    {
+    return iSurfaceBuffer;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::TVtEngBuffer::Buffer
+//
+// -----------------------------------------------------------------------------
+//
+TUint8* &CVtEngDrawNGA::TVtEngBuffer::Buffer()
+    {
+    return iBuffer;
+    }
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::CVtEngBufferWaiter
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::CVtEngBufferWaiter::CVtEngBufferWaiter
+    //( CVideoRenderer& aVideoRenderer, MVtEngNGABufferWaiterObserver& aObserver )
+    ( MVtEngNGABufferWaiterObserver& aObserver )
+    : CActive( CActive::EPriorityStandard ),
+      iObserver( &aObserver )
+    {
+    __VTPRINTENTER( "RVD(NGA).BufferWaiter.Ctor" )
+    for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+        {
+        this->iBuffers[ i ] = NULL;
+        }         
+    CActiveScheduler::Add( this );
+    __VTPRINTEXIT( "RVD(NGA).BufferWaiter.Ctor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::~CVtEngBufferWaiter
+// -----------------------------------------------------------------------------
+//
+CVtEngDrawNGA::CVtEngBufferWaiter::~CVtEngBufferWaiter()
+    {
+    __VTPRINTENTER( "RVD(NGA).BufferWaiter.~" )
+    Cancel();
+    __VTPRINTEXIT( "RVD(NGA).BufferWaiter.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::Activate
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CVtEngBufferWaiter::Activate()
+    {
+    __VTPRINTENTER( "RVD(NGA).BufferWaiter.Activate" )
+    iStatus = KRequestPending;
+    SetActive();
+    __VTPRINTEXIT( "RVD(NGA).BufferWaiter.Activate" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::FetchBuffer
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngDrawNGA::CVtEngBufferWaiter::FetchBuffer()
+    {
+    __VTPRINTENTER( "RVD(NGA).BufferWaiter.FetchBuffer" )
+    if ( IsActive() )
+    {
+    	__VTPRINTEXIT( "RVD(NGA).BufferWaiter.FetchBuffer 1" )
+      return KErrNone;
+    }
+    
+    Activate();
+    if (iStatus == KRequestPending)
+        {
+        for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+            {
+            if(this->iBuffers[ i ] != NULL)
+                {
+                TRequestStatus* status = &iStatus;
+                User::RequestComplete( status, KErrNone );   
+                break;  	
+                }
+            }
+        }            
+    __VTPRINTEXIT( "RVD(NGA).BufferWaiter.FetchBuffer 2" )    
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::BufferAvailable
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CVtEngBufferWaiter::BufferAvailable(TVTSurfaceBuffer& aBuffer)
+{
+	__VTPRINTENTER( "RVD(NGA).BufferWaiter.BufferAvailable" )
+    for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+    {
+      if(this->iBuffers[ i ] == NULL  )
+      {
+      this->iBuffers[ i ]= &aBuffer;
+      break;  	
+      }
+    } 
+    
+    if(iStatus == KRequestPending )
+    {
+      for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+      {
+        if(this->iBuffers[ i ] != NULL)
+        {
+          TRequestStatus* status = &iStatus;
+          User::RequestComplete( status, KErrNone );   
+          break;  	
+        }
+      }
+    }    
+     	
+	__VTPRINTEXIT( "RVD(NGA).BufferWaiter.BufferAvailable" )    
+}
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CVtEngBufferWaiter::RunL()
+    {
+    __VTPRINTENTER( "RVD(NGA).BufferWaiter.RunL" )
+    TInt result( iStatus.Int() );
+    if (  result == KErrNone )
+    {
+      for ( TInt i = 0; i < KVtEngMaxSurfaceBuffers; i++ )
+      {
+        if(this->iBuffers[ i ] != NULL)
+        {   	
+          TRAP_IGNORE( iObserver->BufferReadyL( this->iBuffers[ i ] ) );
+          this->iBuffers[ i ] = NULL;
+          break;
+        }
+      }
+    }
+    else
+        {
+        iObserver->FetchError( result );
+        }
+    __VTPRINTEXIT( "RVD(NGA).BufferWaiter.RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDrawNGA::CVtEngBufferWaiter::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtEngDrawNGA::CVtEngBufferWaiter::DoCancel()
+    {
+    __VTPRINTENTER( "RVD(NGA).BufferWaiter.DoCancel" )    
+    
+   if ( iStatus == KRequestPending )
+       {
+       TRequestStatus* status = &iStatus;
+       User::RequestComplete(status, KErrCancel);
+       }
+    
+    __VTPRINTEXIT( "RVD(NGA).BufferWaiter.DoCancel" )
+    }            
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngDtmfHandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,363 @@
+/*
+* 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:  Handler for DTMF sending.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngDtmfHandler.h"
+#include    "CVtEngMediaHandler.h"
+#include    "VtEngPanic.h"
+#include    "cvtlogger.h"
+
+// LOCAL MACROS
+#define DTMF_STATES_COUNT 3
+const TInt KProtoDtmfCommandId = -1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::NewL
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfHandler* CVtEngDtmfHandler::NewL( MVtH324ConfigCommand& aH324Config )
+    {
+    __VTPRINTENTER( "DTMF.New" )
+    CVtEngDtmfHandler* self = new ( ELeave ) CVtEngDtmfHandler( aH324Config );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "DTMF.New" )
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::~CVtEngDtmfHandler
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfHandler::~CVtEngDtmfHandler()
+    {
+    __VTPRINTENTER( "DTMF.~" )
+    if ( iDtmfStates )
+    	{
+        iDtmfStates->ResetAndDestroy();
+    	}
+    delete iDtmfStates;
+    if( iProtoDtmf )
+        {
+        VTProtocolFactory::DeleteUserInputIndication(iProtoDtmf);
+        }
+    iProtoDtmf = NULL;
+    __VTPRINTEXIT( "DTMF.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::HandleL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::HandleL( CVtEngOperation& aOp )
+    {
+    __VTPRINTENTER( "DTMF.HandleL" )
+
+    const TVtEngCommandId cmdId( aOp.Command() );
+    switch ( cmdId )
+        {
+        case KVtEngStartDtmfTone:
+            {
+            __VTPRINT( DEBUG_MEDIA , "DTMF. start tone" )
+            TChar tone;
+            TVtEngOpParamUtil<TChar>::Set( tone, aOp );
+            CVtEngDtmfState* state = (*iDtmfStates)[iCurrentState];
+            if ( state )
+                {
+                TVtEngDtmfTone dtmfTone( tone );
+                state->SendDtmfL( dtmfTone );
+                }
+            }
+            break;
+        case KVtEngStopDtmfTone:
+            __VTPRINT( DEBUG_MEDIA , "DTMF. stop tone (no op)" )
+            break;
+        // Handling of different UIIs
+        case KVtEngSetUIIDtmfSupport:
+            SetUIISupport( EDTMFString );
+            __VTPRINT( DEBUG_MEDIA , "DTMF Support enabled" )
+            break;
+        case KVtEngSetUIIBasicStringSupport:
+            SetUIISupport( EBasicString );
+            __VTPRINT( DEBUG_MEDIA , "Basic string Support enabled" )
+            break;
+        case KVtEngSetUIIIA5StringSupport:
+            SetUIISupport( EIA5String );
+            __VTPRINT( DEBUG_MEDIA , "IA5 String Support enabled" )
+            break;
+        case KVtEngSetUIIGeneralStringSupport:
+            SetUIISupport( EGeneralString );
+            __VTPRINT( DEBUG_MEDIA , "General String Support enabled" )
+            break;
+        default:
+            __VTPRINT( DEBUG_MEDIA , "DTMF.Handle cmd not supported" )
+            User::Leave( KErrNotSupported );
+        }
+    __VTPRINTEXIT( "DTMF.HandleL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::ActivateState
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState& CVtEngDtmfHandler::ActivateState( TVtEngDtmfState aNewState )
+    {
+    __VTPRINTENTER( "DTMF.ActivateState" )
+    __VTPRINT2( DEBUG_MEDIA , " new state=%d", aNewState )
+    __ASSERT_ALWAYS( aNewState >= EVtDtmfStateIdle &&
+        aNewState <= EVtDtmfStateBuffered,
+        Panic( EVtEngPanicInvalidDtmfState) );
+    iCurrentState = aNewState;
+    __VTPRINTEXIT( "DTMF.ActivateState" )
+    return *(*iDtmfStates)[iCurrentState];
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::SendComplete
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::SendComplete( TInt aError )
+    {
+    __VTPRINTENTER( "DTMF.SendComplete" )
+#ifdef VTDEBUG
+    TRAPD( ignore, HandleSendCompleteL( aError ) );
+    __VTPRINT2( DEBUG_MEDIA , "DTMF.SendComplete err=%d", ignore )
+#else
+    TRAP_IGNORE( HandleSendCompleteL( aError ) );
+#endif // VTDEBUG
+    __VTPRINTEXIT( "DTMF.SendComplete" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::ProtoDtmf
+//
+// -----------------------------------------------------------------------------
+//
+MVTUserInput& CVtEngDtmfHandler::ReserveProtoDtmfL(
+    const TVtEngDtmfTone& aTone )
+    {
+    __VTPRINTENTER( "DTMF.ReserveProtoDtmfL" )
+    if ( iProtoDtmf != NULL )
+        {
+        __VTPRINT( DEBUG_MEDIA , "DTMF.ReserveProtoDtmfL IN USE" )
+        User::Leave( KErrInUse );
+        }
+    TUint8 val = (TUint8) aTone.iTone;
+
+#ifdef VTDEBUG
+    if ( CVtLogger::Flags() & CVtLogger::ELogMedia )
+        {
+        const TChar ch( val );
+        _LIT( KVtDtmfBufferTrace, "VT: DTMF. tone value=" );
+        TBuf<25> buffer( KVtDtmfBufferTrace() );
+        buffer.Append( ch );
+        RDebug::Print( buffer );
+        }
+#endif
+
+    
+
+    // NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    // IT MUST BE CHECKED IS GIVEN LETTER SUPPORTED BY
+    // USED ENCODING SCHEME. NOW WE PASS ONLY NUMBERS AND * AND #
+    // AND THEY ARE SAFE TO USE BUT USING POWERFULL UIIs GIVE POSSIBILITY
+    // TO SEND ALL DIGITS AND NUMBERS. IN THAT CASE SET OF CHARS MUST BE CHECKED
+    // IN VTENGINE. (THAT IS THE REASON WHY THERE IS SEPARATE IF ELSEs)
+    // NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+    __VTPRINT2( DEBUG_MEDIA , "DTMF. Proto USERINPUT %d", iUIISupport )
+    switch ( iUIISupport )
+        {
+        case EBasicString:
+        case EIA5String:
+        case EGeneralString:
+            __VTPRINT( DEBUG_MEDIA , "DTMF. Proto USERINPUT alphanumeric" )
+				iProtoDtmf = VTProtocolFactory::CreateUserInputIndication( EVtUiiDTFM, val );
+            break;
+        case EDTMFString:
+            __VTPRINT( DEBUG_MEDIA , "DTMF. Proto USERINPUT iDTMFString" )
+				iProtoDtmf = VTProtocolFactory::CreateUserInputIndication( EVtUiiAlphaNumeric, val);
+            break;
+        default:
+            __VTPRINT( DEBUG_MEDIA , "DTMF. Proto USERINPUT unsupported" )
+            break;
+        }
+    __VTPRINTEXIT( "DTMF.ReserveProtoDtmfL" )
+    return *iProtoDtmf;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::ReleaseProtoDtmf
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::ReleaseProtoDtmf()
+    {
+    __VTPRINTENTER( "DTMF.ReleaseProtoDtmf" )
+    if( iProtoDtmf )
+        {
+        VTProtocolFactory::DeleteUserInputIndication(iProtoDtmf);
+        }
+    iProtoDtmf = NULL;
+    __VTPRINTEXIT( "DTMF.ReleaseProtoDtmf" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::CVtEngDtmfHandler
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfHandler::CVtEngDtmfHandler( MVtH324ConfigCommand& aH324Config ) :
+    iCurrentState( EVtDtmfStateIdle ), iH324Config( aH324Config ),
+    iUIISupport( EIA5String ), iIssuedDtmfCommandId(KProtoDtmfCommandId)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::ConstructL()
+    {
+    __VTPRINTENTER( "DTMF.ConstructL" )
+    iDtmfStates = new ( ELeave )
+        CArrayPtrFlat<CVtEngDtmfState>( DTMF_STATES_COUNT );
+
+    for ( TInt state = EVtDtmfStateIdle;
+          state <= EVtDtmfStateBuffered;
+          state++ )
+        {
+        CreateStateL( state );
+        }
+    __VTPRINTEXIT( "DTMF.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::HandleSendCompleteL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::HandleSendCompleteL( TInt aError )
+    {
+    __VTPRINTENTER( "DTMF.HandleSendCompleteL" )
+
+    __VTPRINT2( DEBUG_MEDIA , " HandleSendCompleteL err=%d", aError )
+    if ( iDtmfStates )
+        {
+        CVtEngDtmfState* state = (*iDtmfStates)[iCurrentState];
+        if ( state )
+            {
+            __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+                "DTMF. complete on state %d", iCurrentState )
+            state->DtmfSendCompleteL( aError );
+            }
+        }
+    __VTPRINTEXIT( "DTMF.HandleSendCompleteL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::CreateState
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::CreateStateL( TInt aState )
+    {
+    __VTPRINTENTER( "DTMF.CreateStateL" )
+    CVtEngDtmfState* dtmfState = NULL;
+    switch ( aState )
+        {
+        case EVtDtmfStateIdle:
+            dtmfState = CVtEngDtmfIdle::NewL( *this, iH324Config );
+            break;
+        case EVtDtmfStateSending:
+            dtmfState = CVtEngDtmfSending::NewL( *this, iH324Config );
+            break;
+        case EVtDtmfStateBuffered:
+            dtmfState = CVtEngDtmfBuffered::NewL( *this, iH324Config );
+            break;
+        default:
+            Panic( EVtEngPanicInvalidDtmfState );
+            break;
+        }
+    CleanupStack::PushL( dtmfState );
+    iDtmfStates->AppendL( dtmfState );
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "DTMF.CreateStateL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::GetUIISupport
+// returns the current UII support
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfHandler::TUIISupport CVtEngDtmfHandler::GetUIISupport() const
+    {
+    __VTPRINT2( DEBUG_MEDIA , "DTMF. GETUSERINPUT support=%d", iUIISupport )
+    return iUIISupport;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::SetUIISupport
+// Sets the UII support mode
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::SetUIISupport( CVtEngDtmfHandler::TUIISupport aValue )
+    {
+    __VTPRINT2( DEBUG_MEDIA , "DTMF. SETUSERINPUT support=%d", aValue )
+    iUIISupport = aValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::CheckCommandId
+// Compares last issued DTMF command ID to parameter given command ID
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngDtmfHandler::CheckCommandId( TInt aCheckCommandId ) const
+	{
+	__VTPRINT3( DEBUG_MEDIA , "DTMF. CHKCMID aCheckCommandId=%d iIssuedDtmfCommandId=%d",\
+		aCheckCommandId, iIssuedDtmfCommandId )
+	
+	if( iIssuedDtmfCommandId == aCheckCommandId )
+		{
+		return ETrue;
+		}
+	
+	return EFalse;
+	}
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfHandler::StoreCommandId
+// Stores given command ID
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfHandler::StoreCommandId( TInt aStoreCommandId )
+	{
+	__VTPRINT2( DEBUG_MEDIA , "DTMF. STORECOMMANDID aStoreCommandId=%d", aStoreCommandId )
+	
+	iIssuedDtmfCommandId = aStoreCommandId;			
+	}
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngImageScaler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,314 @@
+/*
+* 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:  Image scaler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngImageScaler.h"
+#include    <cvtimagebitmap.h>
+#include    <fbs.h>
+#include    <videotelephonyvariant.hrh>
+#include    <cvtlogger.h>
+
+// CONSTANTS
+// The number of used bitmaps as scaling targets.
+const TInt KVtEngTargetBitmapCount = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+MVtEngImageScaler* CVtEngImageScaler::NewL(
+    MVtEngScalerObserver& aObserver )
+    {
+    __VTPRINTENTER( "Scaler.NewL" )
+    CVtEngImageScaler* scaler = new ( ELeave ) CVtEngImageScaler( aObserver );
+    CleanupStack::PushL( scaler );
+    scaler->ConstructL();
+    CleanupStack::Pop( scaler );
+    __VTPRINTEXIT( "Scaler.NewL" )
+    return scaler;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::ConstructL()
+    {
+    iVtScaler = CVtImageScaler::NewL( *this );
+    GetScalingMethodL();
+    iVtScaler->SetQualityL( iScalingMethod );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::ScaleL
+// Scaling method.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::ScaleL(
+            TInt aSourceIndex )
+    {
+    __VTPRINTENTER( "Scaler.ScaleL" )
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleL index=%d",
+        aSourceIndex )
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleL target index=%d",
+    iTargetBitmapInUse )
+    if ( iVtScaler->IsActive() )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleL NActive" )
+        User::Leave( KErrInUse );
+        }
+
+    // If there is no bitmaps done, do leave.
+    // The caller should call ConfigureL.
+    if ( iSources.Count() <= 0  || iTargets.Count() <= 0 )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleL: not conf" )
+        User::Leave( KErrNotReady );
+        }
+    iVtScaler->ScaleL( *iSources[ aSourceIndex ] ,
+         *iTargets[iTargetBitmapInUse] );
+    __VTPRINTEXIT( "Scaler.ScaleL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::Configure
+// Configure scaling.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngImageScaler::ConfigureL(
+    TDisplayMode aDisplayMode,
+    TSize aSize,
+    TInt aSourceHandle1,
+    TInt aSourceHandle2 )
+    {
+    __VTPRINTENTER( "Scaler.ConfigureL" )
+    __VTPRINT( DEBUG_MEDIA , "================== Scaler.Config ==================" )
+    __VTPRINT2( DEBUG_MEDIA, "    aSize.iWidth:%d ", aSize.iWidth)
+    __VTPRINT2( DEBUG_MEDIA, "    aSize.iHeight:%d ", aSize.iHeight )
+    __VTPRINT2( DEBUG_MEDIA, "    aDisplayMode:%d", aDisplayMode )
+    __VTPRINT( DEBUG_MEDIA , "================== Scaler.Config ==================" )
+
+    TInt sourceHandle1( 0 );
+    if ( iSources.Count() > 0 )
+        {
+        CVtImageBitmap* bmp = iSources[ EFirstBitmap ];
+        if ( bmp )
+            {
+            sourceHandle1 = bmp->Bitmap().Handle();
+            }
+        }
+    TInt sourceHandle2( 0 );
+    if ( iSources.Count() > 1 )
+        {
+        CVtImageBitmap* bmp = iSources[ ESecondBitmap ];
+        if ( bmp )
+            {
+            sourceHandle2 = bmp->Bitmap().Handle();
+            }
+        }
+
+    // Do we have to cancel scaling first?
+    TBool cancelled( iVtScaler->IsActive() );
+
+    if ( aSourceHandle1 != sourceHandle1 || aSourceHandle2 != sourceHandle2
+        || aSize != iSize || iMode != aDisplayMode )
+        {
+        if ( cancelled )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:Config cancel" )
+            Cancel();
+            }
+        }
+    else
+        {
+        // Do we need the update => NO
+        __VTPRINTEXITR( "Scaler.ConfigureL %d", EFalse )
+        return EFalse;
+        }
+
+    // Store new mode and size.
+    iMode = aDisplayMode;
+    iSize = aSize;
+
+    // The RVD source images have changed.
+    if ( aSourceHandle1 != sourceHandle1 || aSourceHandle2 != sourceHandle2 )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+            "Scaler:ConfigureL create bitmaps" )
+        CVtImageBitmap* vtBitmap = CVtImageBitmap::NewL( aSourceHandle1 );
+        CleanupStack::PushL( vtBitmap );
+        CVtImageBitmap* vtBitmap2 = CVtImageBitmap::NewL( aSourceHandle2 );
+        CleanupStack::PushL( vtBitmap2 );
+
+	    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ConfigureL source reset" )
+        iSources.ResetAndDestroy();
+        iSources.AppendL( vtBitmap );
+        iSources.AppendL( vtBitmap2 );
+	    CleanupStack::Pop( KVtEngTargetBitmapCount ); // vtBitMaps
+        }
+
+    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ConfigureL create targets" )
+    CVtImageBitmap* vtBitmapT =  CVtImageBitmap::NewL( aSize, aDisplayMode );
+    CleanupStack::PushL( vtBitmapT );
+    CVtImageBitmap* vtBitmapT2 = CVtImageBitmap::NewL( aSize, aDisplayMode );
+    CleanupStack::PushL( vtBitmapT2 );
+
+    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ConfigureL target reset" )
+    iTargets.ResetAndDestroy();
+    iTargets.AppendL( vtBitmapT );
+    iTargets.AppendL( vtBitmapT2 );
+    CleanupStack::Pop( KVtEngTargetBitmapCount ); // vtBitMapTs
+
+    __VTPRINTEXITR( "Scaler.ConfigureL %d", cancelled )
+    return cancelled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::ScalingFinished
+// Callback telling that scaling is done.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::ScalingFinished( TInt aError )
+    {
+    __VTPRINTENTER( "Scaler.ScalingFinished" )
+
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:ScaleFin ", aError )
+
+    if ( aError == KErrNone )
+        {
+        CFbsBitmap& bitmap = iTargets [ iTargetBitmapInUse ]->Bitmap();
+        __VTPRINT2( DEBUG_MEDIA, "Scaler.ScalingFin index", iTargetBitmapInUse )
+
+        if ( iTargetBitmapInUse == EFirstBitmap )
+            {
+            iTargetBitmapInUse = ESecondBitmap;
+            }
+        else
+            {
+            iTargetBitmapInUse = EFirstBitmap;
+            }
+        // Notify client of done scaling
+        iObserver.ScalingCompleted( &bitmap, aError );
+        }
+    else
+        {
+        iObserver.ScalingCompleted( NULL, aError );
+        }
+    __VTPRINTEXIT( "Scaler.ScalingFinished" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::~CVtEngImageScaler
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngImageScaler::~CVtEngImageScaler()
+    {
+    __VTPRINTENTER( "Scaler.~" )
+
+    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Scaler:Dtor" )
+    iTargets.ResetAndDestroy();
+    iTargets.Close();
+    iSources.ResetAndDestroy();
+    iSources.Close();
+    delete iVtScaler;
+    __VTPRINTEXIT( "Scaler.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::CVtEngImageScaler
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngImageScaler::CVtEngImageScaler(
+    MVtEngScalerObserver& aObserver ) :
+    iObserver( aObserver ), iTargetBitmapInUse ( EFirstBitmap ),
+    iScalingMethod( CVtImageScaler::EWeightedAverage )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::Release
+// Interface function implementation to delete the implementation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::Release()
+    {
+    // Delete myself
+  __VTPRINTENTER( "Scaler.Release" )
+    delete this;
+    __VTPRINTEXIT( "Scaler.Release" )
+    }
+
+// -----------------------------------------------------------------------------
+// VtEngScalerFactory::CreateScalerL
+// Creates the image scaler.
+// -----------------------------------------------------------------------------
+//
+MVtEngImageScaler* VtEngScalerFactory::CreateScalerL(
+    MVtEngScalerObserver& aObserver )
+    {
+    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+        "VtEngScalerFactory::CreateScalerL" )
+    return CVtEngImageScaler::NewL( aObserver );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::Cancel
+// Cancels the conversion.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngImageScaler::Cancel()
+    {
+    __VTPRINTENTER( "Scaler.Cancel" )
+    iVtScaler->Cancel();
+    __VTPRINTEXIT( "Scaler.Cancel" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngImageScaler::GetScalingMethodL
+// Gets the used scaling method from local variation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngImageScaler::GetScalingMethodL()
+    {
+    __VTPRINTENTER( "Scaler.GetScalingMethodL" )
+    // Check if the scaling method is non-default
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+    if( settings.CheckBits(
+        KVTLVFlagScalingMethodENearest ) )
+        {
+        iScalingMethod = CVtImageScaler::ENearest;
+        }
+    else if ( settings.CheckBits(
+        KVTLVFlagScalingMethodEBilinear ) )
+        {
+        iScalingMethod = CVtImageScaler::EBilinear;
+        }
+    __VTPRINTEXITR( "Scaler.GetScalingMethodL %d", (TInt) iScalingMethod )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngLocalVideo.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,4532 @@
+/*
+* Copyright (c) 2004-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:  Local video configuration
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngLocalVideo.h"
+#include    "CVtEngMediaHandler.h"
+#include    "VtEngPanic.h"
+#include    "MVtEngFrameObserver.h"
+#include    "CVtEngStateManager.h"
+#include    "CVtEngEventManager.h"
+#include    "MVtEngMedia.h"
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+#include    "VtEngEvents.h"
+#include    <videotelephonydomainpskeys.h>
+#include    <videotelephonyvariant.hrh>
+#include    <capivideosource.h>
+#include    <cvtlogger.h>
+#include    <mvtprotocolhandler.h>
+
+#include    "CVtEngCameraPreferences.h"
+
+// LOCAL CONSTANTS AND MACROS
+
+// Maximum count of providers stored (cameras, still, blank)
+const TInt KVtEngProviderCountMax = 4;
+
+// Max zoom step count.
+const TInt KVtMaxZoomStep = 10;
+
+// If prepare camera is called when provider is ready signal
+// immediately back with positive value.
+const TInt KVtEngAlreadySelected = 1;
+
+// If source is already active signal with this.
+const TInt KVtEngAlreadyActive = 2;
+
+// Number of providers buffered in image sharer
+const TInt KVtEngNumProvidersBuffered = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngLocalVideo
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngLocalVideo(
+    CVtEngMediaHandler& aObserver )
+
+   /** priority is high to ensure that this AO gets scheduled as soon as
+    * possible after signaling. If local video is requested a service, e.g.
+    * source switch while its signaled but not yet scheduled, local video's
+    * internal state may be compromised (signal AO => start selecting new source
+    * => RunL [this would break ongoing source selection]
+    */
+ : CActive( EPriorityHigh ),
+   iRenderingMethod( EUnspecified ),
+   iObserver( aObserver ),
+   iCurrentCamera( MVtEngMedia::ESecondaryCamera ),
+   iLayoutChangeHandler( *this )
+    {
+    ResetIndices();
+    __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.c++")
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ConstructL()
+    {
+    __VTPRINTENTER( "LocVideo.ConstructL" )
+
+    iAsyncCallBack = new ( ELeave ) CAsyncCallBack(
+        TCallBack( CallBackFunc, this ), EPriorityStandard );
+
+    TInt indexMobile( KErrNotFound );
+    iShareImage = CVtEngShareImage::NewL( *this );
+    iSourceController = CVSController::NewL( this );
+    iVideoProviders =
+        new ( ELeave ) CArrayFixFlat<TProviderItem>( KVtEngProviderCountMax );
+    iSource = iSourceController->CreateDataSourceL( this );
+    PauseVideoSending();
+    TInt providers( iSourceController->ProvidersAvailable() );
+    iNumSupportedCameras = providers - 1;
+    ResetIndices();
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.providers=%d",providers)
+    // Get the device specified default camera.
+    TInt cameraId( iCurrentCamera );
+    TInt err( SetCameraTrackingL( cameraId ) );
+    if ( err == KErrNone && cameraId != EPSPreferredCameraUnknown )
+        {
+        // Only if valid camera.
+        iCurrentCamera = MapCameraInternally( cameraId );
+        err = KErrAlreadyExists;
+        }
+
+    while ( providers-- )
+        {
+        CVSDataProvider* provider = NULL;
+        TRAP_IGNORE( provider =
+            iSourceController->CreateDataProviderL( providers, this, iSource ) );
+        if ( provider )
+            {
+            CleanupStack::PushL( provider );
+            TProviderItem item;
+            TVSDataProviderInfo info;
+            provider->ProviderInfo( info );
+            TBool destroy( ETrue );
+            __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.Orient=%d",
+                info.iOrientation )
+            switch ( info.iOrientation )
+                {
+                case TCameraInfo::EOrientationInwards:
+                    SetFlag( EFlagCamera1Available );
+                    item.iType = KVtEngProviderCam1;
+                    if ( err != KErrAlreadyExists )
+                        {
+                        // Set only if value not obtained from PubSub
+                        iCurrentCamera = MVtEngMedia::EPrimaryCamera;
+                        }
+                    iProviderInfoIndexCam1 = providers;
+                    __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.ConL ID C1=%d",
+                        iProviderInfoIndexCam1 )
+                    break;
+                case TCameraInfo::EOrientationOutwards:
+                    // Configures outwards camera, it is treated as camera 1
+                    // if there is only one camera in the device.
+                    ConfigureOutwardsCameraItem( item, providers );
+                    break;
+                case TCameraInfo::EOrientationMobile:
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.Mobile")
+                    item.iType = KVtEngProviderTempImage;
+                    indexMobile = providers;
+                    __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.Mobile ID=%d",
+                        indexMobile )
+                    break;
+                case TCameraInfo::EOrientationUnknown:
+                    {
+                    item.iType = KVtEngProviderImage;
+                    item.iProvider = provider;
+                    item.iProviderState = EPermanent;
+                    destroy = EFalse; // don't delete still provider
+                    CreateBlankProviderL( providers );
+
+                    if ( CVtEngUtility::Settings().
+                    	 IsDefaultStillImageDefined() )
+                        {
+                        CreateDefaultStillImageProviderL( providers );
+                        }
+
+                    iProviderInfoIndexStill = providers;
+                    __VTPRINT2( DEBUG_MEDIA | DEBUG_CONSTRUCT,
+                    "LocVideo.ConL ID Still=%d",iProviderInfoIndexStill )
+                    }
+                    break;
+                default:
+                    break;
+                }
+            iVideoProviders->AppendL( item );
+            CleanupStack::Pop();
+            if ( destroy )
+                {
+                delete provider;
+                provider = NULL;
+                }
+            }
+        }
+    iObserver.SetSelectedCameraId( iCurrentCamera );
+    // Check if mobile is there, and either 1 or 2 is not.
+
+    if ( indexMobile != KErrNotFound )
+        {
+        TProviderItem* item = NULL;
+        const TInt err = GetProviderByType( KVtEngProviderTempImage, item );
+           __ASSERT_ALWAYS( err != KErrNotFound,
+            Panic( EVtEngPanicInvalidInitializationState ) );
+        if ( iProviderInfoIndexCam1 == KErrNotFound )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.ConL Switch 1" )
+            item->iType = KVtEngProviderCam1;
+            iProviderInfoIndexCam1 = indexMobile;
+            SetFlag( EFlagCamera1Available );
+            }
+        else
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "LocVideo.ConL Switch 2" )
+	        DeleteProvider( KVtEngProviderCam2 );
+            item->iType = KVtEngProviderCam2;
+            iProviderInfoIndexCam2 = indexMobile;
+            SetFlag( EFlagCamera2Available );
+            }
+        }
+    __VTPRINTEXIT( "LocVideo.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ConfigureOutwardsCameraItem
+// Creates providers item for outwards camera type. It is treated as
+// a) primary camera in single camera configurations
+// b) secondary camera in two camera configurations
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ConfigureOutwardsCameraItem(
+    TProviderItem& aItem,
+    const TInt aCurrentIndex )
+    {
+    __VTPRINTENTER( "LocVideo.ConfigureOutwardsCameraItem" )
+    if ( iNumSupportedCameras == 1 )
+        {
+        SetFlag( EFlagCamera1Available );
+        aItem.iType = KVtEngProviderCam1;
+        iProviderInfoIndexCam1 = aCurrentIndex;
+        iCurrentCamera = MVtEngMedia::EPrimaryCamera;
+        __VTPRINT2( DEBUG_MEDIA,
+            "LocVideo.ConL ID C1=%d", iProviderInfoIndexCam1 )
+        }
+    else
+        {
+        SetFlag( EFlagCamera2Available );
+        aItem.iType = KVtEngProviderCam2;
+        iProviderInfoIndexCam2 = aCurrentIndex;
+        __VTPRINT2( DEBUG_MEDIA,
+            "LocVideo.ConL ID C2=%d", iProviderInfoIndexCam2 )
+        }
+    __VTPRINTEXITR( "LocVideo.ConfigureOutwardsCameraItem iCurrentCamera=%d",
+            iCurrentCamera )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CallBackFunc
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CompleteOperation( const TInt aResult )
+    {
+    __VTPRINTENTER( "LocVideo.CompleteOperation" )
+    SetResult( aResult );
+    iAsyncCallBack->CallBack();
+    __VTPRINTEXITR( "LocVideo.CompleteOperation %d", aResult )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::VideoChannelOpenedL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::VideoChannelOpenedL()
+    {
+    __VTPRINTENTER( "LocVideo.VideoChannelOpenedL" )
+    if ( iDelayedSelect.IsDelayedSelectPending() )
+        {
+        SelectSourceL( iDelayedSelect.DelayedSelectTarget() );
+        }
+    __VTPRINTEXIT( "LocVideo.VideoChannelOpenedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CallBackFunc
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CallBackFunc( TAny* aPtr )
+    {
+    __VTPRINTENTER( "LocVideo.CallBackFunc" )
+    CVtEngLocalVideo* self = reinterpret_cast< CVtEngLocalVideo* >( aPtr );
+    TInt result( KErrNone );
+    TRAP( result,
+        self->iObserver.HandleLocalVideoOperationCompleteL(
+            self->Result() ) );
+    __VTPRINTEXITR( "LocVideo.CallBackFunc %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::Result
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::Result() const
+    {
+    __VTPRINTENTER( "LocVideo.Result" )
+    __VTPRINTEXITR( "LocVideo.Result %d", iResult )
+    return iResult;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetResult
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetResult( const TInt aResult )
+    {
+    __VTPRINTENTER( "LocVideo.SetResult" )
+    iResult = aResult;
+    __VTPRINTEXITR( "LocVideo.SetResult %d", iResult )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo* CVtEngLocalVideo::NewL(
+    CVtEngMediaHandler& aObserver )
+    {
+    __VTPRINTENTER( "LocVid.NewL" )
+    CVtEngLocalVideo* self = new( ELeave )
+        CVtEngLocalVideo( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "LocVid.NewL" )
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::~CVtEngLocalVideo
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::~CVtEngLocalVideo()
+    {
+    __VTPRINTENTER( "LocVid.~" )
+    // Cancel the object
+    if ( iActiveProvider )
+        {
+        iActiveProvider->DetachFromCameraPreferences();
+        }
+    if ( iAsyncCallBack )
+        {
+        iAsyncCallBack->Cancel();
+        delete iAsyncCallBack;
+        }
+    Cancel();
+    if ( iVideoProviders )
+        {
+        while ( iVideoProviders->Count() )
+            {
+            TProviderItem& item = (*iVideoProviders)[0];
+            CVSDataProvider* provider = item.iProvider;
+            delete provider;
+            iVideoProviders->Delete( 0 );
+            }
+        delete iVideoProviders;
+        }
+
+    delete iCameraListener;
+    iCameraListener = NULL;
+
+    delete iSource;
+    delete iSourceController;
+    DeleteAudioSource();
+    delete iShareImage;
+    __VTPRINTEXIT( "LocVid.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsProviderError
+// Handles error in provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsProviderError( TInt aError )
+    {
+    if( aError == KErrCancel )
+        {
+        vsProviderReady();
+        return;
+        }
+    __VTPRINTENTER( "LocVid.vsProviderError" )
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.ProviderError=%d", aError )
+    iInitializingProvider = NULL;
+    if ( aError != KErrNone )
+        {
+        iShareImage->Error( aError );
+        if ( !iLayoutChangeHandler.ProviderError( aError ) )
+            {
+            const TState previousState = iState;
+            iState = ELocNone;
+            __VTPRINT( DEBUG_MEDIA, " STATE TO NONE" )
+
+            // If the error indicates that camera is in use
+            if ( aError == KErrInUse && previousState == ELocInitializing )
+            {
+            // Store the error to be used later
+            if( iSelectedProvider )
+                {
+                __VTPRINT( DEBUG_MEDIA,
+                "LocVideo.ProviderError in use")
+                iSelectedProvider->iErrorCode = aError;
+                if ( iSelectedProvider->iType == KVtEngProviderCam1 )
+                    {
+                    ClearFlag( EFlagCamera1Available );
+                    }
+                else if ( iSelectedProvider->iType == KVtEngProviderCam2 )
+                    {
+                    ClearFlag( EFlagCamera2Available );
+                    }
+                }
+            }
+        // Camera has been lost
+		if ( aError == KVsErrCameraNoLongerReserved )
+			{
+			if ( !IsActive() )
+                {
+                SetActive();
+                TRequestStatus* status = &iStatus;
+                User::RequestComplete( status, aError );
+                __VTPRINT( DEBUG_MEDIA,
+                	"LocVideo.ProviderError AO start" )
+               	__VTPRINTEXITR(
+                     "LocVid.vsProviderError err=%d", aError )
+
+                __VTPRINT( DEBUG_MEDIA,
+                	"LocVideo.ProviderError iSelectedProvider NULL" )
+                if ( iSelectedProvider )
+                	{
+                	__VTPRINT( DEBUG_MEDIA,
+                	"LocVideo.ProviderError iSelectedProvider NULL" )
+                	iSelectedProvider->iInitialized = EFalse;
+                	iSelectedProvider->iProviderState =
+                    	(CVtEngLocalVideo::TProviderState) aError;
+                	__VTPRINT( DEBUG_MEDIA,
+                	"LocVideo.ProviderError iSelectedProvider NULL" )
+                	}
+                return;
+            	}
+			}
+        if ( iSelectedProvider )
+            {
+            // Try to select the last known to function camera
+            if ( iSelectedProvider->iType == KVtEngProviderCam1 ||
+                 iSelectedProvider->iType == KVtEngProviderCam2 )
+                {
+                if ( !IsActive() )
+                    {
+                    SetActive();
+                    TRequestStatus* status = &iStatus;
+                    User::RequestComplete( status, aError );
+                     __VTPRINT( DEBUG_MEDIA,
+                     "LocVideo.ProviderError AO start" )
+                     __VTPRINTEXITR(
+                     "LocVid.vsProviderError err=%d", aError )
+                     return;
+                     }
+                 }
+                //Error code needed later
+                iSelectedProvider->iInitialized = EFalse;
+                iSelectedProvider->iProviderState =
+                    (CVtEngLocalVideo::TProviderState) aError;
+                iSelectedProvider = NULL;
+                __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                    " selected provider nulled" )
+                }
+            else if ( iActiveProvider &&
+                     !IsFlag( EFlagInitializeOnly ) &&
+                     previousState == ELocSwichingProvider )
+                {
+                iActiveProvider = iFadingProvider;
+                iFadingProvider = NULL;
+                }
+            if ( IsFlag( EFlagSignalSourceSelection ) )
+                {
+                ClearFlag( EFlagSignalSourceSelection );
+                TRAP_IGNORE(
+                    iObserver.HandleLocalVideoOperationCompleteL( aError ) );
+                }
+            }
+        }
+    __VTPRINTEXIT( "LocVid.vsProviderError" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsProviderReady
+// Provider is ready to be taken into use.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsProviderReady()
+    {
+    __VTPRINTENTER( "LocVid.vsProviderReady" )
+
+    __VTPRINT3( DEBUG_MEDIA, "LocVideo.ProviderReady state=%d, initOnly=%d",
+        iState, IsFlag( EFlagInitializeOnly ) )
+    const TState prevState( iState );
+
+    if ( iInitializingProvider )
+        {
+        iInitializingProvider->iInitialized = ETrue;
+
+        // Set camera flags in order to recover
+        // error situation (error occured during init)
+        if ( iInitializingProvider->iType == KVtEngProviderCam1 )
+        	{
+			__VTPRINT( DEBUG_MEDIA, " LocVid.vsProviderReady KVtEngProviderCam1" )
+        	SetFlag( EFlagCamera1Available );
+        	}
+        else if ( iInitializingProvider->iType == KVtEngProviderCam2 )
+        	{
+        	__VTPRINT( DEBUG_MEDIA, " LocVid.vsProviderReady KVtEngProviderCam2" )
+        	SetFlag( EFlagCamera2Available );
+        	}
+
+        iInitializingProvider = NULL;
+        }
+
+    iState = ELocReady;
+    __VTPRINT( DEBUG_MEDIA, " STATE TO READY" )
+
+    if ( iLayoutChangeHandler.ProviderReady() )
+        {
+        __VTPRINTEXIT( "LocVid.vsProviderReady" )
+        return;
+        }
+
+    if ( prevState == ELocInitializing && !IsFlag( EFlagInitializeOnly ) )
+        {
+        TProviderItem* switchTo = iActiveProvider;
+        if ( iSelectedProvider )
+            {
+            iSelectedProvider->iErrorCode = KErrNone;
+            switchTo = iSelectedProvider;
+            iSelectedProvider = NULL;
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selected provider nulled" )
+            }
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.ProviderReady switching")
+        SwitchProvider( switchTo );
+        __VTPRINTEXIT( "LocVid.vsProviderReady" )
+        return;
+        }
+    else
+        {
+        iSelectedProvider = NULL;
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "Selected provider nulled, UDS" )
+        UpdateState();
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVideo.vsProviderReady KVtEngSourceCapsChanged")
+        CVtEngEventManager::NotifyEvent( KVtEngSourceCapsChanged );
+        }
+
+    if ( IsFlag( EFlagSignalSourceSelection ) )
+        {
+        ClearFlag( EFlagSignalSourceSelection );
+        TRAP_IGNORE( iObserver.HandleLocalVideoOperationCompleteL( KErrNone ) );
+        }
+    __VTPRINTEXIT( "LocVid.vsProviderReady" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsProviderSwitchDone
+// Provider switched.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsProviderSwitchDone( CVSDataProvider* aOldProvider )
+    {
+    __VTPRINTENTER( "LocVid.vsProviderSwitchDone" )
+    iState = ELocReady;
+    __VTPRINT( DEBUG_MEDIA, " STATE TO READY" )
+
+    iFadingProvider = NULL;
+
+    if ( iActiveProvider && iActiveProvider->iProvider )
+        {
+        iActiveProvider->iProvider->ProviderInfo( iProviderInfo );
+        TInt error( iActiveProvider->RestoreZoomFactor() );
+        if ( error )
+            {
+            __VTPRINT2( DEBUG_MEDIA,
+                "LocVid.vsProviderSwitchDone restoring stored zoom FAILED %d",
+                error )
+            }
+        }
+
+    iShareImage->ProviderSwitchDone( aOldProvider );
+
+    if ( iActiveProvider && iActiveProvider->iType == KVtEngProviderCam1 )
+        {
+        iCurrentCamera = MVtEngMedia::EPrimaryCamera;
+        iObserver.SetSelectedCameraId( iCurrentCamera );
+        }
+    else if ( iActiveProvider && iActiveProvider->iType == KVtEngProviderCam2 )
+        {
+        iCurrentCamera = MVtEngMedia::ESecondaryCamera;
+        iObserver.SetSelectedCameraId( iCurrentCamera );
+        }
+
+    // Let layout change handler handle providerswitch
+    if ( iLayoutChangeHandler.ProviderSwitchDone( aOldProvider ) )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngLCHProviderSwitchDone );
+        __VTPRINTEXIT( "LocVid.vsProviderSwitchDone" )
+        return;
+        }
+
+    ClearFlag( EFlagFrozen );
+
+    // If initilization of the waiting provider fails fall back to the last one.
+    TVtEngProviderType backupProviderType( KVtEngProviderNone );
+
+    // Delete non-permanent old provider
+    const TInt indexI( ProviderIndexByInstance( aOldProvider ) );
+
+    // delete provider that became unavailable
+    if ( indexI != KErrNotFound )
+        {
+        __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+            "LocVideo.providerSwitchDone indexInstance=%d", indexI )
+        TProviderItem& item( ( *iVideoProviders )[ indexI ] );
+        if ( item.iProviderState != EPermanent &&
+             item.iProviderState != ERefreshing )
+            {
+            DeleteProvider( item );
+            TRAP_IGNORE( item.iProvider = CreateDataProviderL( item.iType ) );
+            }
+        }
+
+    // Uninitialize fading provider
+    const TInt indexF = ProviderIndexByState( EFading );
+    if ( indexF != KErrNotFound )
+        {
+        __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+            "LocVideo.providerSwitchDone fading indexFading=%d", indexF )
+        TProviderItem& item = (*iVideoProviders)[indexF];
+
+        // Mark up type of the last provider.
+        backupProviderType = item.iType;
+
+        DeleteProvider( item );
+        __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+            "LocVideo.providerSwitchDone fading=%d", item.iType )
+        TRAP_IGNORE( item.iProvider = CreateDataProviderL( item.iType ) );
+        }
+
+    // Initialize waiting provider
+    TInt err( KErrNone );
+    const TInt indexW( ProviderIndexByState( EWaiting ) );
+    if ( indexW != KErrNotFound )
+        {
+        __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+            "LocVideo.providerSwitchDone waiting=%d", indexW )
+        TProviderItem& item = (*iVideoProviders)[indexW];
+        item.iProviderState = EUndefined;
+        TRAP( err, InitializeProviderL( item ) );
+        if ( err == KErrNone)
+            {
+            iSelectedProvider = &item;
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selected provider set" )
+            backupProviderType = KVtEngProviderNone;
+            }
+        else
+            {
+            iState = ELocNone;
+            __VTPRINT( DEBUG_MEDIA, " STATE TO NONE" )
+            __VTPRINT2( DEBUG_MEDIA, "failed initializing provider=%d", err )
+            // If initialization failed indicate that provider is not available
+            if ( item.iType == KVtEngProviderCam1 )
+                {
+                ClearFlag( EFlagCamera1Available );
+                }
+            else if ( item.iType == KVtEngProviderCam2 )
+                {
+                ClearFlag( EFlagCamera2Available );
+                }
+            else if( item.iType == KVtEngProviderShareImage )
+                {
+                iShareImage->Error( err );
+                }
+            CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+            }
+        }
+
+    // Reconstruct refreshing (new still image) provider.
+    const TInt indexR( ProviderIndexByState( ERefreshing ) );
+    if ( indexR != KErrNotFound )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+            "LocVideo.providerSwitchDone refreshing")
+        TProviderItem& item = (*iVideoProviders)[indexR];
+        DeleteProvider( item );
+
+        // If still image disabled in settings.
+        CVtEngSettings& settings = CVtEngUtility::Settings();
+        const CVtEngSettings::TVtEngVideoCallConfig& config =
+            settings.Config();
+        const TBool stillImageValid( config.iVideo.iImageIsValid );
+        TRAP( err,
+            {
+            item.iProvider = CreateDataProviderL( item.iType );
+            if ( stillImageValid )
+                {
+                InitializeProviderL( item );
+                }
+            else
+                {
+                item.iProviderState = EPermanent; // change back to original
+                }
+            } );
+        if ( err == KErrNone && stillImageValid )
+            {
+            iSelectedProvider = &item;
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selected provider set" )
+            }
+        else
+            {
+            iState = ELocNone;
+            __VTPRINT2( DEBUG_MEDIA, " STATE TO NONE initerr=%d", err )
+            }
+        }
+
+    // If we have delayed select pending -> initiate new switch and return
+    if ( iDelayedSelect.IsDelayedSelectPending() )
+        {
+        ClearFlag( EFlagCheckRevertToPrevious );
+        TVtEngProviderType pending = iDelayedSelect.DelayedSelectTarget();
+        __VTPRINT2( DEBUG_MEDIA, " delayed select pending type = %d", pending )
+        if( iActiveProvider && iActiveProvider->iType == pending )
+            {
+            // clear the iDelayedSelect to KVtEngProviderUndefined
+            // and no need to select again,continue complete this vsProviderSwitchDone
+            iDelayedSelect.DelayedSelectTarget();
+            }
+        else
+            {
+            TRAP_IGNORE( SelectSourceL( pending ) );
+            __VTPRINTEXIT( "LocVid.vsProviderSwitchDone" )
+            return;
+            }
+        }
+
+    if ( IsFlag( EFlagSignalSourceSelection ) &&
+         iState != ELocInitializing && // Set in InitializeProviderL if called
+         err == KErrNone &&            // but not if init (or create provider in
+                                       // there) failed.
+         !IsFlag( EFlagCheckRevertToPrevious ) )
+        {
+        // Signal only if we're in final state (i.e. not if blank provider
+        // was switched and just started initializing a camera).
+        ClearFlag( EFlagSignalSourceSelection );
+        TRAP_IGNORE( iObserver.HandleLocalVideoOperationCompleteL( KErrNone ) );
+        }
+    else if ( IsFlag( EFlagCheckRevertToPrevious ) &&
+        ( iState == ELocReady || iState == ELocNone ) )
+        {
+        ClearFlag( EFlagCheckRevertToPrevious );
+        MVtEngMedia::TCameraId currentCam( MVtEngMedia::EPrimaryCamera );
+        iObserver.GetCurrentCameraId( currentCam );
+        backupProviderType =
+            ( currentCam==MVtEngMedia::EPrimaryCamera ) ?
+            KVtEngProviderCam1 : KVtEngProviderCam2;
+        }
+
+    __VTPRINT2( DEBUG_MEDIA, "        switch done iState=%d", iState )
+
+    //Inform camera preferences that valid provider is set
+	// Check that valid provider exist
+	// and set it as provider to camera
+	// preferences
+    if ( iActiveProvider )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "switch done prov.state=%d",
+        	iActiveProvider->iProviderState )
+        // Set provider to camera preferences
+        // only if camera preferences exist
+        if ( iCameraPref)
+    		{
+    		__VTPRINT2( DEBUG_MEDIA,
+    		"LocVideo.providerSwitchDone iCameraPref->SetProvider type=%d",
+        		iActiveProvider->iType )
+    		iCameraPref->SetProvider( iActiveProvider->iProvider,
+    		    *iActiveProvider );
+
+            TInt error( iActiveProvider->RestorePreferences() );
+            if ( error )
+                {
+                __VTPRINT2( DEBUG_MEDIA, " restoring preferences FAILED %d",
+                    error )
+                }
+    		}
+    	else
+    		{
+    		__VTPRINT( DEBUG_MEDIA,
+    			"LocVideo.providerSwitchDone camera pref not created" )
+    		}
+        }
+
+    if ( IsFlag( EFlagInitialized ) && iState != ELocInitializing )
+        {
+        __VTPRINT( DEBUG_MEDIA,
+                "LocVideo.providerSwitchDone KVtEngSourceCapsChanged" )
+        CVtEngEventManager::NotifyEvent( KVtEngSourceChanged );
+        }
+
+    TRAP( err, StartViewFinderIfWasStartedL() ); // err is ignored
+
+    if ( backupProviderType != KVtEngProviderNone )
+        {
+        // Initialization of new provider failed,
+        // try reverting back to last one.
+        __VTPRINT2( DEBUG_MEDIA,
+            "LocVideo.providerSwitchDone revert to %d", backupProviderType )
+        TRAP( err, SelectSourceL( backupProviderType ) );
+        if ( err != KErrNone )
+            {
+            CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+            }
+        }
+
+    __VTPRINTEXIT( "LocVid.vsProviderSwitchDone" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsViewFinderFrameReady
+// View finder image can be set.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsViewFinderFrameReady( CFbsBitmap& aFrame )
+    {
+    __VTPRINTENTER( "LocVid.vsViewFinderFrameReady" )
+    if ( iActiveProvider &&
+         iActiveProvider->iType != KVtEngProviderNone )
+        {
+        TRAP_IGNORE( iOptions.iObserver->vtHandleFrameL(
+            MVtEngFrameObserver::ELocalVideoFrame, &aFrame ) );
+        }
+    __VTPRINTEXIT( "LocVid.vsViewFinderFrameReady" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::vsProvidersChanged
+// Provider state has changed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::vsProvidersChanged( TBool aAttached )
+    {
+    __VTPRINTENTER( "LocVid.vsProvidersChanged" )
+
+    __VTPRINT2( DEBUG_MEDIA, "   vsProvidersChanged attached=%d", aAttached )
+    __VTPRINT2( DEBUG_MEDIA, "   vsProvidersChanged state=%d",iState )
+    if ( iAudioSource == NULL )
+        {
+        // If this is called from ConstructL (indirectly) return immediately
+        if ( aAttached || iCurrentCamera == MVtEngMedia::EPrimaryCamera )
+            {
+            SetFlag( EFlagCamera1Available );
+            iObserver.SetSelectedCameraId( MVtEngMedia::EPrimaryCamera, ETrue );
+            }
+        else
+            {
+            ClearFlag( EFlagCamera1Available );
+            iObserver.SetSelectedCameraId(
+                MVtEngMedia::ESecondaryCamera, ETrue );
+            }
+        __VTPRINTEXIT( "LocVid.vsProvidersChanged" )
+        return;
+        }
+
+    // If primary camera was not available and state is not "open"
+    // UI should be requested for answer. Precondition is also that
+    // primary camera is now available.
+    TBool notifyAnswer( EFalse );
+    TInt activeMedia( 0 );
+
+    const MVtEngSessionInfo::TSessionState state(
+        CVtEngUtility::StateManager()->SessionState() );
+
+    __VTPRINT2( DEBUG_MEDIA, "         vsProvidersChanged, call state=%d", state )
+    if ( state == MVtEngSessionInfo::EReceiving )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "         vsProvidersChanged attached=%d", aAttached )
+        if ( !IsFlag( EFlagCamera1Available ) && aAttached )
+            {
+            notifyAnswer = ETrue;
+            }
+        }
+
+    __VTPRINT2( DEBUG_MEDIA,
+        "         vsProvidersChanged answer=%d", notifyAnswer )
+    CVtEngLocalVideo::TVtEngProviderType providerToSelect( KVtEngProviderNone );
+    TRAPD( err, providerToSelect =  UpdateAvailableProvidersL() );
+    if ( err == KErrNone )
+        {
+        // Now get the state to check if video has been disabled
+        GetMediaState( activeMedia );
+        __VTPRINT2( DEBUG_MEDIA,
+            "         vsProvidersChanged mediastate=%d", activeMedia )
+        __VTPRINT2( DEBUG_MEDIA,
+            "         vsProvidersChanged iState=%d", iState )
+
+        // values for checking if switch is allowed
+        TBool activeIsStillOrBlank ( EFalse );
+        TBool activeIsBlankAndNewCam1( EFalse );
+        if ( iActiveProvider )
+            {
+            __VTPRINT2( DEBUG_MEDIA,
+            "         vsProvidersChanged iActivePType=%d", iActiveProvider->iType )
+            if ( iActiveProvider->iType == KVtEngProviderImage ||
+                      iActiveProvider->iType == KVtEngProviderNone )
+                {
+                activeIsStillOrBlank = ETrue;
+                if ( providerToSelect == KVtEngProviderCam1 &&
+                     iActiveProvider->iType == KVtEngProviderNone )
+                    {
+                    activeIsBlankAndNewCam1 = ETrue;
+                    }
+                }
+            }
+        __VTPRINT2( DEBUG_MEDIA,
+            "         vsProvidersChanged blank active new cam1=%d",
+            activeIsBlankAndNewCam1 )
+
+        __VTPRINT2( DEBUG_MEDIA,
+            "         vsProvidersChanged provider=%d",  providerToSelect )
+
+        if ( providerToSelect == KVtEngProviderCam1 )
+            {
+            iObserver.SetSelectedCameraId( MVtEngMedia::EPrimaryCamera );
+            }
+        else if ( providerToSelect == KVtEngProviderCam2 )
+            {
+            // delete provider that became unavailable
+            iObserver.SetSelectedCameraId( MVtEngMedia::ESecondaryCamera );
+            }
+
+        // Check if SelectSource should be called
+        if ( !notifyAnswer && // for incoming calls automatic switch not allowed
+             ( iState == ELocNone || iState == ELocReady ) &&
+             IsFlag( EFlagInitialized ) )
+            {
+            __VTPRINT( DEBUG_MEDIA, "         vsProvidersChanged ok to select" )
+            // Allow switch if video disabled (still/blank active)
+            // and cam1 available.
+            ClearFlag( EFlagInitializeOnly );
+            ClearFlag( EFlagCheckRevertToPrevious );
+            if ( activeIsStillOrBlank &&
+                 providerToSelect == KVtEngProviderCam2 )
+                {
+                SetFlag( EFlagInitializeOnly );
+                }
+            else if ( activeIsBlankAndNewCam1 )
+                {
+                iObserver.AutoEnableVideo();
+                }
+            else if ( providerToSelect == KVtEngProviderNone )
+                {
+                iObserver.AutoEnableVideo( EFalse );
+                }
+            SetFlag( EFlagAutomaticSwitchCallback );
+            TRAP( err, SelectSourceL( providerToSelect ) );
+            ClearFlag( EFlagAutomaticSwitchCallback );
+
+            if ( err != KErrNone )
+                {
+                __VTPRINT2( DEBUG_MEDIA,
+                    "         vsProvidersChanged,select failed=%d", err )
+                if ( providerToSelect == KVtEngProviderCam1 &&
+                     iNumSupportedCameras > 1 )
+                    {
+                    __VTPRINT( DEBUG_MEDIA, "LocVideo.vsProvidersChanged 2 2" )
+                    SetFlag( EFlagCamera2Available );
+                    ClearFlag( EFlagCamera1Available );
+                    TRAP( err, SelectSourceL( KVtEngProviderCam2 ) );
+                    }
+                else if ( providerToSelect == KVtEngProviderCam2 )
+                    {
+                    __VTPRINT( DEBUG_MEDIA,
+                        "LocVideo.vsProvidersChanged 2 still")
+                    ClearFlag( EFlagCamera2Available );
+                    TRAP( err, SelectSourceL( KVtEngProviderImage ) );
+                    }
+                }
+            }
+        else
+            {
+            __VTPRINT( DEBUG_MEDIA, "         vsProvidersChanged Not Changed" )
+            if ( iState == ELocInitializing &&
+                 iSelectedProvider &&
+                 iSelectedProvider->iType != providerToSelect )
+                {
+                SetFlag( EFlagCheckRevertToPrevious );
+                }
+            }
+
+        CVtEngStateManager* states = CVtEngUtility::StateManager();
+        states->Update();
+
+        if ( IsFlag( EFlagCamera1Available ) ||
+             IsFlag( EFlagCamera2Available ) )
+            {
+            if ( notifyAnswer )
+                {
+                __VTPRINT( DEBUG_MEDIA,
+                    "LocVideo.vsProvidersChanged KVtEngSessionAnswerPossible")
+                CVtEngEventManager::NotifyEvent( KVtEngSessionAnswerPossible );
+                }
+            else if ( !notifyAnswer &&
+                // Don't notify before selection is done.
+                      ( iState == ELocReady ||
+                        iState == ELocNone ) )
+                {
+                __VTPRINT( DEBUG_MEDIA,
+                    "LocVideo.vsProvidersChanged KVtEngSourceCapsChanged" )
+                CVtEngEventManager::NotifyEvent( KVtEngSourceCapsChanged );
+                }
+            }
+        else if ( !IsFlag( EFlagCamera1Available ) &&
+            !IsFlag( EFlagCamera2Available ) )
+            {
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.vsProvidersChanged NO CAMS" )
+            CVtEngEventManager::NotifyEvent( KVtEngSourceCapsChanged );
+            }
+        }
+    else
+        {
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVideo.vsProvidersChanged KVtEngResourceMemAllocFailure" )
+        CVtEngEventManager::NotifyEvent( KVtEngResourceMemAllocFailure  );
+        }
+    __VTPRINTEXITR( "LocVid.vsProvidersChanged err=%d", err )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetViewFinderParameters
+// Configures parameters for rendering via window server.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetViewFinderParameters(
+    const TVtEngRenderingOptions& aParams )
+    {
+    __VTPRINTENTER( "LocVid.SetViewFinderParameters" )
+
+    // Before setting the params, stop VF
+    if( ViewFinderStarted() )
+        {
+        StopViewFinder();
+        }
+
+    iOptions.iSize = aParams.iSize;
+    __VTPRINT2( DEBUG_MEDIA,
+        "         width = %d", iOptions.iSize.iWidth );
+    __VTPRINT2( DEBUG_MEDIA,
+        "         height = %d", iOptions.iSize.iHeight );
+
+    iOptions.iObserver = aParams.iObserver;
+    iRenderingMethod = EWindowServer;
+    __VTPRINTEXIT( "LocVid.SetViewFinderParameters" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetViewFinderParameters
+// Configures parameters for rendering with direct screen access.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetViewFinderParameters(
+    const TVtEngRenderingOptionsDSA& aDSA )
+    {
+    __VTPRINTENTER( "LocVid.SetVFParamsDSA" )
+
+    // Before setting the params, stop VF
+    if( ViewFinderStarted() )
+        {
+        StopViewFinder();
+        }
+
+    iRenderingMethod = EDSA;
+    iDsaOptions.iClipRect = aDSA.iClipRect;
+    iDsaOptions.iRect = aDSA.iRect;
+    iDsaOptions.iWindow = &aDSA.iWindow;
+    iDsaOptions.iWs = &aDSA.iWs;
+    iDsaOptions.iWsSD = &aDSA.iWsSD;
+    __VTPRINTEXIT( "LocVid.SetVFParamsDSA" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetViewFinderParameters
+// Configures parameters for rendering with display posting.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetViewFinderParameters(
+    const TVtEngRenderingOptionsDP& aDP )
+    {
+    __VTPRINTENTER( "LocVid.SetVFParamsDP" )
+
+    // Before setting the params, stop VF
+    if( ViewFinderStarted() )
+        {
+        StopViewFinder();
+        }
+
+    iRenderingMethod = EDP;
+    iDsaOptions.iClipRect = aDP.iClipRect;
+    iDsaOptions.iRect = aDP.iRect;
+    iDsaOptions.iWindow = &aDP.iWindow;
+    iDsaOptions.iWs = &aDP.iWs;
+    iDsaOptions.iWsSD = &aDP.iWsSD;
+    __VTPRINTEXIT( "LocVid.SetVFParamsDP" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetDefaultStillImageL
+// Sets default still image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetDefaultStillImageL()
+    {
+    __VTPRINTENTER( "LocVid.SetDefaultStillImageL" )
+
+   	TProviderItem* item = NULL;
+    GetProviderByType( KVtEngProviderDefaultStillImage, item );
+    if ( item )
+        {
+        CVSDataProvider* provider = item->iProvider;
+
+        if ( provider && item->iType == KVtEngProviderDefaultStillImage )
+            {
+            if ( item->iInitialized )
+                {
+                StopViewFinder();
+
+                TInt providerIndex =
+                    ProviderIndex( KVtEngProviderDefaultStillImage );
+
+                TProviderItem* defaultStillProviderItem =
+                    &( *iVideoProviders )[providerIndex];
+                SwitchProvider( defaultStillProviderItem );
+                }
+            else
+                {
+                InitializeProviderL( *item );
+                iSelectedProvider = item;
+                }
+            }
+        }
+    __VTPRINTEXIT( "LocVid.SetDefaultStillImageL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetStillImageL
+// Sets still image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetStillImageL( TBool aSetAsActive )
+    {
+    __VTPRINTENTER( "LocVid.SetStillImageL" )
+
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+    const CVtEngSettings::TVtEngVideoCallConfig& config =
+        settings.Config();
+    const TBool stillImageValid( config.iVideo.iImageIsValid );
+    if ( iState == ELocInitializing && stillImageValid )
+        {
+        __VTPRINT( DEBUG_MEDIA, "  setStill failed" )
+        User::Leave( KErrNotReady );
+        }
+
+    TInt count( iVideoProviders->Count() );
+    TBool done( EFalse );
+    while ( count-- )
+        {
+        TProviderItem& item = ( *iVideoProviders )[count];
+        CVSDataProvider* provider = item.iProvider;
+
+        if ( item.iType == KVtEngProviderImage )
+            {
+            if ( provider && item.iInitialized )
+                {
+                // If still image provider is active change to temp provider
+                if ( iActiveProvider &&
+                     ( iActiveProvider->iType == KVtEngProviderImage ) )
+                    {
+                    __VTPRINT( DEBUG_MEDIA, "Act.prov. must be deleted" )
+                    StopViewFinder();
+                    iActiveProvider->iProviderState = ERefreshing;
+                    TInt providerIndex = ProviderIndex( KVtEngProviderNone );
+                    TProviderItem* blankProviderItem =
+                        &( *iVideoProviders )[providerIndex];
+                    SwitchProvider( blankProviderItem );
+                    __VTPRINTEXIT( "LocVideo.SetStillImageL" )
+                    return;
+                    }
+
+                //Only way to change image is first delete the provider
+                delete provider;
+                item.iProvider = NULL;
+
+                // Create it again.
+                // If there is a provider info for still.
+                if ( iProviderInfoIndexStill != KErrNotFound )
+                    {
+                    item.iProvider = iSourceController->CreateDataProviderL(
+                        iProviderInfoIndexStill,
+                        this, iSource );
+                    item.iType = KVtEngProviderImage;
+                    item.iInitialized = EFalse;
+                    }
+                }
+            // Do initialization only if valid image (still not
+            // cleared in settings).
+            if ( stillImageValid )
+                {
+                InitializeProviderL( item );
+                if ( aSetAsActive )
+                    {
+                    iSelectedProvider = &item;
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                        " selected provider set" )
+                    }
+                }
+            done = ETrue;
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                "LocVideo.SetStillImageL ok" )
+            }
+        }
+    if ( !done )
+        {
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.SetStillImageL fail")
+        User::Leave( KErrGeneral );
+        }
+    __VTPRINTEXIT( "LocVid.SetStillImageL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeL
+// Initializes default blank provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeL()
+    {
+    __VTPRINTENTER( "LocVid.InitializeL" )
+    const TInt index( ProviderIndex( KVtEngProviderNone ) );
+    TProviderItem* item = &(*iVideoProviders)[index];
+    if ( iActiveProvider &&
+         iActiveProvider->iType == KVtEngProviderImage )
+        {
+        // Blank provider is set to active only
+        // if there is not valid still image.
+        SetFlag( EFlagInitializeOnly );
+        iSelectedProvider  = item;
+        }
+    else
+        {
+        iActiveProvider = item;
+        }
+    InitializeProviderL( *item );
+    SetFlag( EFlagSignalSourceSelection );
+    SetFlag( EFlagInitialized );
+    __VTPRINTEXIT( "LocVid.InitializeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SelectSourceL
+// Selects source.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::SelectSourceL( TVtEngProviderType aSource )
+    {
+    __VTPRINTENTER( "LocVid.SelectSourceL" )
+
+    __VTPRINT2( DEBUG_MEDIA, "  source=%d", aSource )
+
+    if ( iDelayedSelect.IsDelayedSelectPending() &&
+         ( aSource != KVtEngProviderShareImage ) &&
+         ( aSource == KVtEngProviderCam1 ||
+           aSource == KVtEngProviderCam2 ||
+           aSource == KVtEngProviderImage ) )
+        {
+        aSource = iDelayedSelect.DelayedSelectTarget();
+        }
+
+    if( IsProviderWaiting( aSource ) )
+        {
+        // If waiting for provide switch and a provider initialization
+        // don't allow selection.
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSourceL already waiting" )
+        User::Leave( KErrNotReady );
+        }
+
+    // To be selected source is already active
+    if ( IsActiveProvider( aSource ) )
+        {
+        Cancel();
+        TRequestStatus* status = &iStatus;
+        SetActive();
+        User::RequestComplete( status, KVtEngAlreadyActive );
+        SetFlag( EFlagSignalSourceSelection );
+        __VTPRINT2( DEBUG_MEDIA, "LocVideo.SelectSourceL start AO=%d",
+            KVtEngAlreadyActive )
+        if ( iActiveProvider )
+            {
+            __VTPRINT2( DEBUG_MEDIA, "LocVideo. activeProv type=%d",
+                iActiveProvider->iType )
+            }
+        // In case there were errors, NULL the selected provider
+        // to be able to initialize it when needed
+        if( iSelectedProvider )
+            {
+            if( iSelectedProvider->iErrorCode )
+                {
+                iSelectedProvider->iInitialized = EFalse;
+                iSelectedProvider->iProviderState =
+                    (CVtEngLocalVideo::TProviderState)
+                    iSelectedProvider->iErrorCode;
+                iSelectedProvider = NULL;
+                __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selprovider nulled" )
+                }
+            }
+        // Not actually switching but virtually doing it because
+        // async callback will be made.
+        __VTPRINTEXITR( "LocVid.SelectSourceL %d", ETrue )
+        return ETrue;
+        }
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.Selectsource iState=%d", iState )
+    if ( iState == ELocInitializing &&
+         aSource == KVtEngProviderImage &&
+         iActiveProvider &&
+         iActiveProvider->iType != KVtEngProviderNone )
+        {
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVideo.SelectSource initialization pending" )
+        User::Leave( KErrNotReady );
+        }
+    // We have switch pending
+    else if ( iState == ELocSwichingProvider )
+        {
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVideo.SelectSource switching -> set delayed select" )
+        iDelayedSelect.NotifyDelayedSelect( aSource );
+        __VTPRINTEXITR( "LocVid.SelectSourceL %d", ETrue )
+        return ETrue;
+        }
+
+    TBool initialized( EFalse );
+    TProviderItem item;
+    TInt providerIndex( GetProviderByType( aSource, item ) );
+
+    if ( providerIndex != KErrNotFound )
+        {
+        // requested provider found, set initialization status
+        __VTPRINT2( DEBUG_MEDIA, "LocVideo.SelectSource index=%d", providerIndex )
+        initialized = item.iInitialized;
+        }
+    else
+        { // requested provider not found
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource create provider" )
+        // Try to create provider
+        TInt index = KErrNotFound;
+        switch ( aSource )
+            {
+            case KVtEngProviderCam2:
+                index = iProviderInfoIndexCam2;
+                break;
+            case KVtEngProviderNone:
+            case KVtEngProviderImage:
+            case KVtEngProviderDefaultStillImage:
+            // Image sharing
+            case KVtEngProviderShareImage:
+                index = iProviderInfoIndexStill;
+                break;
+            case KVtEngProviderCam1:
+                index = iProviderInfoIndexCam1;
+            default:
+                break;
+            }
+
+        __VTPRINT2( DEBUG_MEDIA,
+            "LocVideo.SelectSource create provider ID=%d", index )
+        if ( index != KErrNotFound )
+            {
+            TProviderItem newItem;
+            newItem.iProvider =
+                iSourceController->CreateDataProviderL(
+                index, this, iSource );
+            newItem.iType = aSource;
+            CleanupStack::PushL( newItem.iProvider );
+            iVideoProviders->AppendL( newItem );
+            CleanupStack::Pop();
+            providerIndex = iVideoProviders->Count() - 1;
+            __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+                "LocVideo.SelectSource create provider ok=%d",
+                newItem.iProvider != NULL )
+            }
+        }
+
+    TBool initOrSwitch = EFalse;
+
+    // Initialize provider
+    if ( providerIndex != KErrNotFound && !initialized )
+        {
+        if ( iActiveProvider->iProviderState != EPermanent )
+            {
+            // Active provider must be destroyed and new one initialized
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource del Act.prov" )
+            (*iVideoProviders)[providerIndex].iProviderState = EWaiting;
+            iActiveProvider->iProviderState = EFading;
+            StopViewFinder();
+            providerIndex = ProviderIndex( KVtEngProviderNone );
+            __VTPRINT2( DEBUG_MEDIA, "LocVideo.SelectSource index for none=%d",
+                providerIndex )
+            }
+        else
+            {
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource do init" )
+            UninitializeProviderL();
+            TProviderItem& initItem = ( *iVideoProviders )[providerIndex];
+            InitializeProviderL( initItem );
+            // This item is stored, make it initialized only when callback
+            // received.
+            iSelectedProvider = &initItem;
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " selected provider set" )
+            initOrSwitch = InitializingOrSwitching();
+            __VTPRINTEXITR( "LocVid.SelectSourceL %d", initOrSwitch )
+            return initOrSwitch;
+            }
+        }
+
+    // Switch provider
+    if ( providerIndex != KErrNotFound )
+        {
+        if ( !IsFlag( EFlagInitializeOnly ) )
+            {
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource ready for switch")
+            StopViewFinder();
+            TProviderItem* switchItem = &(*iVideoProviders)[providerIndex];
+            __VTPRINT2( DEBUG_MEDIA,
+                "LocVideo.SelectSource switchItem %d", switchItem->iType )
+            SwitchProvider( switchItem );
+            }
+        else if ( initialized && IsFlag( EFlagInitializeOnly ) )
+            {
+            __VTPRINT2( DEBUG_MEDIA,
+                "LocVideo.SelectSource already initialized start AO %d",
+                KVtEngAlreadySelected )
+            TProviderItem* switchItem = &( *iVideoProviders )[providerIndex];
+            iActiveProvider = switchItem;
+            Cancel();
+            TRequestStatus* status = &iStatus;
+            SetActive();
+            User::RequestComplete( status, KVtEngAlreadySelected );
+            }
+        else
+            {
+            __VTPRINT3( DEBUG_MEDIA, "   initialized=%d,flags=%d",
+                initialized, iFlags )
+            }
+        }
+
+    // Error
+    if ( iActiveProvider == NULL )
+        {
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.SelectSource leave" )
+        User::Leave( KErrNotFound );
+        }
+
+    initOrSwitch = InitializingOrSwitching();
+    __VTPRINTEXITR( "LocVid.SelectSourceL %d", initOrSwitch )
+    return initOrSwitch;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeProviderL
+// Initializes a provider.
+// ----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeProviderL(
+    TProviderItem& aProviderItem )
+    {
+    __VTPRINTENTER( "LocVid.InitializeProviderL" )
+
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d", aProviderItem.iType )
+
+    if ( iInitializingProvider )
+        {
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVideo.InitProv ERROR, already initializing" )
+        User::Leave( KErrNotReady );
+        }
+
+    iInitializingProvider = &aProviderItem;
+
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+    const CVtEngSettings::TVtEngVideoCallConfig& config =
+        settings.Config();
+    TPckgBuf< TVSStillImageDataProviderParams > pckg;
+
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d", aProviderItem.iType )
+    CVSDataProvider* provider = aProviderItem.iProvider;
+    if ( provider == NULL )
+        {
+        aProviderItem.iInitialized = EFalse;
+        aProviderItem.iProvider = CreateDataProviderL( aProviderItem.iType );
+        provider = aProviderItem.iProvider;
+        }
+    else if ( aProviderItem.iInitialized )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv AO start %d", KErrNone )
+        Cancel();
+        TRequestStatus* status = &iStatus;
+        SetActive();
+        User::RequestComplete( status, KErrNone );
+        __VTPRINTEXIT( "LocVid.InitializeProviderL" )
+        return;
+        }
+    User::LeaveIfNull( provider );
+    switch ( aProviderItem.iType )
+        {
+        case KVtEngProviderCam1:
+        case KVtEngProviderCam2:
+            provider->InitializeL( KNullDesC8 );
+            iState = ELocInitializing;
+            __VTPRINT( DEBUG_MEDIA, " STATE TO INITIALIZING" )
+            __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d",
+                aProviderItem.iType )
+            break;
+        case KVtEngProviderNone:
+            // Blank provider.
+            pckg().iInitialize =
+                TVSStillImageDataProviderParams::EInitializeAsBlankImage;
+            provider->InitializeL( pckg );
+            iState = ELocInitializing;
+            __VTPRINT( DEBUG_MEDIA, " STATE TO INITIALIZING" )
+            __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d",
+                aProviderItem.iType )
+            break;
+        case KVtEngProviderImage:
+            {
+             if ( config.iVideo.iImageIsValid )
+                {
+                pckg().iInitialize =
+                    TVSStillImageDataProviderParams::EInitializeFromGeneralSettings;
+                provider->InitializeL( pckg );
+                iState = ELocInitializing;
+                __VTPRINT( DEBUG_MEDIA, " STATE TO INITIALIZING" )
+                __VTPRINT( DEBUG_MEDIA, "LocVideo.InitProv Still image")
+                }
+             else
+                {
+                User::Leave( KErrPathNotFound );
+                }
+            }
+            break;
+        case KVtEngProviderDefaultStillImage:
+                pckg().iInitialize =
+                    TVSStillImageDataProviderParams::EInitializeAsDefaultStillImage;
+
+            provider->InitializeL( pckg );
+            iState = ELocInitializing;
+            __VTPRINT( DEBUG_MEDIA, " STATE TO INITIALIZING" )
+            __VTPRINT2( DEBUG_MEDIA, "LocVideo.InitProv type=%d",
+                aProviderItem.iType )
+            break;
+        default:
+            Panic( EVtEngPanicNoVideoProvider );
+            break;
+        }
+    //aProviderItem.iInitialized = ETrue;
+    __VTPRINTEXIT( "LocVid.InitializeProviderL" )
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeShareProviderL
+// Initializes a provider that is used for sharing.
+// ----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeShareProviderL(
+    TProviderItem& aProviderItem, const TDesC8& aParams )
+    {
+    __VTPRINTENTER( "LocVid.InitializeShareProviderL" )
+    aProviderItem.iProvider->InitializeL( aParams );
+    aProviderItem.iInitialized = ETrue;
+    iState = ELocInitializing;
+    SetFlag( EFlagSignalSourceSelection | EFlagInitializeOnly );
+    __VTPRINTEXIT( "LocVid.InitializeShareProviderL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ReCreateProviderL
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::ReCreateProviderL(
+    TProviderItem& aProviderItem, const TVtEngProviderType aType )
+    {
+    __VTPRINTENTER( "LocVid.ReCreateProviderL" )
+
+    TInt index( KErrNotFound );
+
+    switch ( aType )
+        {
+        case KVtEngProviderShareImage:
+            index = iProviderInfoIndexStill;
+            break;
+
+        default:
+            User::Leave( KErrNotSupported );
+        }
+
+    // Delete old instance
+    DeleteProvider( aProviderItem );
+
+    // Create new instance
+    aProviderItem.iProvider = iSourceController->CreateDataProviderL(
+        index, this, iSource );
+    aProviderItem.iType = aType;
+
+    __VTPRINTEXIT( "LocVid.ReCreateProviderL" )
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngLocalVideo::CameraIdToType
+// Camera ID to type mapping.
+// ----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType CVtEngLocalVideo::CameraIdToType(
+    MVtEngMedia::TCameraId aId )
+    {
+    TVtEngProviderType type( KVtEngProviderCam2 );
+    switch ( aId )
+        {
+        case MVtEngMedia::EPrimaryCamera:
+            type = KVtEngProviderCam1;
+            break;
+        case MVtEngMedia::ESecondaryCamera:
+            type = KVtEngProviderCam2;
+            break;
+        default:
+            type = KVtEngProviderNone;
+            break;
+        }
+    return type;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtEngLocalVideo::RunL
+// CActive heir, acts according to status.
+// ----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::RunL()
+    {
+    __VTPRINTENTER( "LocVid.RunL" )
+
+    const TInt status( iStatus.Int() );
+    TVtEngProviderType providerType = KVtEngProviderNone;
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.RunL %d", status )
+    switch ( status )
+        {
+        case KVtEngAlreadySelected:
+            SetFlag( EFlagSignalSourceSelection );
+            vsProviderReady();
+            break;
+        case KVtEngAlreadyActive:
+            TRAP_IGNORE(
+                iObserver.HandleLocalVideoOperationCompleteL( KErrNone ) );
+            break;
+        case KErrNone:
+            vsProviderSwitchDone( NULL );
+            UpdateState();
+            break;
+        // Camera has been lost during VT
+        case KVsErrCameraNoLongerReserved:
+        	__VTPRINT2( DEBUG_MEDIA, "LocVideo.status =%d",
+                status )
+            //delete provider here and null pointer
+            if ( iSelectedProvider )
+            	{
+            	DeleteProvider( *iSelectedProvider );
+            	iSelectedProvider = NULL;
+            	}
+
+            // Check if still is in use
+            providerType = KVtEngProviderImage;
+            GetHighestSelectableProvider( providerType );
+
+            __VTPRINT2( DEBUG_MEDIA, "LocVideo.providerType=%d",
+                providerType )
+
+        	iObserver.AutoEnableVideo( EFalse );
+            SetFlag( EFlagAutomaticSwitchCallback );
+        	TRAPD( err, SelectSourceL( providerType ) );
+        	ClearFlag( EFlagAutomaticSwitchCallback );
+
+            if ( err != KErrNone )
+                {
+                TRAP( err, iObserver.HandleLocalVideoOperationCompleteL( err) );
+                }
+            break;
+         default:
+            // error
+            {
+            switch( iSelectedProvider->iType )
+                {
+            case KVtEngProviderCam1:
+                ClearFlag( EFlagCamera1Available );
+                break;
+            case KVtEngProviderCam2:
+                ClearFlag( EFlagCamera2Available );
+                break;
+            default:
+                break;
+                }
+            DeleteProvider( *iSelectedProvider );
+            iSelectedProvider = NULL;
+            MVtEngMedia::TCameraId currentCam( MVtEngMedia::EPrimaryCamera );
+            iObserver.GetCurrentCameraId( currentCam );
+            TVtEngProviderType providerType( CameraIdToType( currentCam ) );
+            GetHighestSelectableProvider( providerType );
+            TRAPD( err, SelectSourceL( providerType ) );
+            if ( err != KErrNone )
+                {
+                TRAP( err, iObserver.HandleLocalVideoOperationCompleteL( err) );
+                }
+            }
+        }
+    __VTPRINTEXIT( "LocVid.RunL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsActiveProvider
+// Returns ETrue if given provider is already active.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsActiveProvider( TVtEngProviderType aType ) const
+    {
+    __VTPRINTENTER( "LocVid.IsActiveProvider" )
+    const TBool active(
+        ( iActiveProvider && iActiveProvider->iType == aType ) ||
+        ( iSelectedProvider && iSelectedProvider->iType == aType ) );
+    __VTPRINTEXITR( "LocVid.IsActiveProvider %d", active )
+    return active;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::DoCancel
+// Does nothing.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::DoCancel()
+    {
+    __VTPRINTENTER( "LocVid.DoCancel" )
+    __VTPRINTEXIT( "LocVid.DoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ActiveProvider
+// Returns active provider.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType CVtEngLocalVideo::ActiveProvider() const
+    {
+    if ( iActiveProvider )
+        {
+        return iActiveProvider->iType;
+        }
+    return KVtEngProviderNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StartViewFinderIfWasStartedL
+// View finder image can be set.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StartViewFinderIfWasStartedL()
+    {
+    __VTPRINTENTER( "LocVid.StartViewFinderIfWasStartedL" )
+    if ( IsFlag( EFlagUIForeground ) && IsFlag( EFlagVFEnabled ) &&
+         iState == ELocReady )
+        {
+        StartViewFinderL();
+        }
+    __VTPRINTEXIT( "LocVid.StartViewFinderIfWasStartedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StartViewFinderL
+// Starts view finder.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StartViewFinderL( TBool aClientRequest )
+    {
+    __VTPRINTENTER( "LocVid.StartViewFinderL" )
+    __ASSERT_ALWAYS( iVideoProviders->Count(),
+        Panic ( EVtEngPanicNoVideoProvider ) );
+
+    if ( aClientRequest )
+        {
+        SetFlag( EFlagVFEnabled );
+        }
+    if ( iRenderingMethod == EUnspecified || !iActiveProvider )
+        {
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.startVF error")
+        User::Leave( KErrNotReady );
+        }
+    CVSDataProvider* provider = iActiveProvider->iProvider;
+    if ( !provider )
+        {
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.startVF error no provider")
+        User::Leave( KErrNotReady );
+        }
+    else if ( provider->ViewFinderActive() )
+        {
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.startVF already started")
+            iViewFinderState = ( iRenderingMethod == EWindowServer ) ?
+                EVFReceivingBitmaps : EVFRenderingDsa;
+        __VTPRINTEXIT( "LocVid.StartViewFinderL" )
+        return;
+        }
+    else if ( !IsFlag( EFlagInitialized ) )
+        {
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVideo.startVF not initialized")
+        __VTPRINTEXIT( "LocVid.StartViewFinderL" )
+        return;
+        }
+    else if ( iState != ELocReady )
+        {
+        __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN,
+            "LocVideo.startVF incorrect iState=%d", iState )
+        }
+    else
+        {
+        // Lint requires this one
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVideo.startVF unsupported clause" )
+        }
+
+    CheckOthersStopped( *provider );
+    if ( iRenderingMethod == EWindowServer )
+        {
+        TSize size( iOptions.iSize );
+        provider->StartViewFinderBitmapsL( size );
+        iViewFinderState = EVFReceivingBitmaps;
+        __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "                started" )
+        }
+    else
+        {
+        provider->StartViewFinderDirectL(
+            *(iDsaOptions.iWs),
+            *(iDsaOptions.iWsSD),
+            *(iDsaOptions.iWindow),
+            iDsaOptions.iRect,
+            iDsaOptions.iClipRect );
+        iViewFinderState = EVFRenderingDsa;
+        }
+
+    if( iActiveProvider->iType == CVtEngLocalVideo::KVtEngProviderCam1 &&
+        !provider->ViewFinderMirror() )
+        {
+        provider->SetViewFinderMirrorL( ETrue );
+        }
+
+    __VTPRINTEXIT( "LocVid.StartViewFinderL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StopViewFinder
+// Stops view finder.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StopViewFinder( TBool aClientRequest )
+    {
+    __VTPRINTENTER( "LocVid.StopViewFinder" )
+    if ( aClientRequest )
+        {
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.stopVF clearing EFlagVFEnabled" )
+        ClearFlag( EFlagVFEnabled );
+        }
+    if ( iActiveProvider &&
+         iViewFinderState != EVFNone &&
+         iActiveProvider->iProvider &&
+         iActiveProvider->iProvider->ViewFinderActive() )
+        {
+        TRAP_IGNORE( iOptions.iObserver->vtHandleFrameL(
+            MVtEngFrameObserver::ELocalVideoFrame, NULL ) );
+        iActiveProvider->iProvider->StopViewFinder();
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.stopVF Stopped" )
+        if ( IsFlag( EFlagAutomaticSwitchCallback )  ||
+            IsFlag( EFlagUIBackground ) )
+            {
+            // UI needs to be notified if stop done due to automatic
+            // source switch (from vsProvidersChanged).
+            ClearFlag( EFlagAutomaticSwitchCallback );
+            CVtEngEventManager::NotifyEvent( KVtEngViewFinderStopped );
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.stopVF Notified" )
+            }
+        }
+    iViewFinderState = EVFNone;
+    __VTPRINTEXIT( "LocVid.StopViewFinder" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::FreezeL
+// Freezes provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::FreezeL()
+    {
+    __VTPRINTENTER( "LocVid.FreezeL" )
+    if( OkToFreeze() )
+        {
+        iActiveProvider->iProvider->FreezeL();
+        SetFlag( EFlagFrozen );
+        }
+    __VTPRINTEXIT( "LocVid.FreezeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UnfreezeL
+// Unfreezes provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::UnfreezeL()
+    {
+    __VTPRINTENTER( "LocVid.UnfreezeL" )
+    if( OkToUnfreeze() )
+        {
+        if ( !iLayoutChangeHandler.UnfreezeL() )
+            {
+            iActiveProvider->iProvider->UnfreezeL();
+            if ( iDelayedSelect.IsDelayedSelectPending() )
+                {
+                TVtEngProviderType type( iDelayedSelect.DelayedSelectTarget() );
+                __VTPRINT2( DEBUG_MEDIA,
+                    "LocVideo.UnfreezeL delayed switch to %d", type )
+                SelectSourceL( type );
+                }
+            else
+                {
+                CompleteOperation( KErrNone );
+                }
+            }
+        ClearFlag( EFlagFrozen );
+        }
+    __VTPRINTEXIT( "LocVid.UnfreezeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CheckOthersStopped
+// Stops view finder of other providers than the one given as parameter.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CheckOthersStopped( const CVSDataProvider& aProvider )
+    {
+    __VTPRINTENTER( "LocVid.CheckOthersStopped" )
+    TInt count( iVideoProviders->Count() );
+    while ( count-- )
+        {
+        TProviderItem& item = ( *iVideoProviders )[count];
+        if ( item.iProvider &&
+             item.iProvider != &aProvider &&
+             item.iProvider->ViewFinderActive() )
+            {
+            item.iProvider->StopViewFinder();
+            __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "LocVideo.OtherStop" )
+            }
+        }
+    __VTPRINTEXIT( "LocVid.CheckOthersStopped" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::Source
+// Returns video source.
+// -----------------------------------------------------------------------------
+//
+MVTVideoSource* CVtEngLocalVideo::Source() const
+    {
+    return iSource;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::AudioSource
+// Returns audio source.
+// -----------------------------------------------------------------------------
+//
+MVTAudioSource* CVtEngLocalVideo::AudioSource() const
+    {
+    return iAudioSource;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMediaState
+// Returns media state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetMediaState( TInt& aActiveMedia )
+    {
+    aActiveMedia = 0;
+    if ( !IsFlag( EFlagAudioMuted ) )
+        {
+        aActiveMedia |= MVtEngMedia::EMediaAudio;
+        // Check if the thing is muted
+        }
+
+    if ( iActiveProvider )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetMediaState provider type=%d",
+            iActiveProvider->iType )
+        switch ( iActiveProvider->iType )
+            {
+            case KVtEngProviderCam1:
+            case KVtEngProviderCam2:
+            case KVtEngProviderImage:
+            case KVtEngProviderShareImage:
+                aActiveMedia |= MVtEngMedia::EMediaVideo;
+                break;
+            default:
+                break;
+            }
+        }
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN,
+        "LocVideo.GetMediaState media state=%d", aActiveMedia )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMediaSource
+// Returns media source.
+// -----------------------------------------------------------------------------
+//
+MVtEngMedia::TMediaSource CVtEngLocalVideo::GetMediaSource()
+    {
+    MVtEngMedia::TMediaSource source( MVtEngMedia::EMediaNone );
+    if ( iActiveProvider )
+        {
+        switch ( iActiveProvider->iType )
+            {
+            case KVtEngProviderCam1:
+            case KVtEngProviderCam2:
+                source = MVtEngMedia::EMediaCamera;
+                break;
+            case KVtEngProviderShareImage:
+                source = MVtEngMedia::EMediaShare;
+                break;
+            case KVtEngProviderImage:
+            case KVtEngProviderDefaultStillImage:
+                source = MVtEngMedia::EMediaStillImage;
+                break;
+            default:
+                source = MVtEngMedia::EMediaNone;
+                break;
+            }
+        }
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetMediaSource src=%d", (TInt) source )
+    return source;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetSourceCaps
+// Returns capability of providers .
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetSourceCaps( TInt& aCaps )
+    {
+    aCaps = 0;
+    TInt count( iVideoProviders->Count() );
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetSourceCaps count=%d", count )
+    while ( count-- )
+        {
+        switch ( iVideoProviders->At(count).iType )
+            {
+            case KVtEngProviderCam1:
+                __VTPRINT( DEBUG_MEDIA,
+                    "LocVideo.GetSourceCaps cam1" )
+                if ( IsFlag( EFlagCamera1Available ) )
+                    {
+                    __VTPRINT( DEBUG_MEDIA,
+                        "LocVideo.GetSourceCaps cam1 flagged" )
+                    aCaps |= MVtEngMedia::ESourceCapsPrimaryCamera;
+                    }
+                break;
+            case KVtEngProviderCam2:
+                __VTPRINT( DEBUG_MEDIA, "LocVideo.GetSourceCaps cam2" )
+                if ( IsFlag( EFlagCamera2Available ) )
+                    {
+                    __VTPRINT( DEBUG_MEDIA,
+                        "LocVideo.GetSourceCaps cam2 flagged" )
+                    aCaps |= MVtEngMedia::ESourceCapsSecondaryCamera;
+                    }
+                break;
+            case KVtEngProviderImage:
+                {
+                __VTPRINT( DEBUG_MEDIA,
+                    "LocVideo.GetSourceCaps image" )
+                // Make sure that image is valid
+                CVtEngSettings& settings = CVtEngUtility::Settings();
+                const CVtEngSettings::TVtEngVideoCallConfig& config =
+                settings.Config();
+                if( config.iVideo.iImageIsValid )
+                    {
+                    aCaps |= MVtEngMedia::ESourceCapsStillImage;
+                    }
+                }
+                break;
+            default:
+               break;
+            }
+        }
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetSourceCaps caps=%d", aCaps )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeOnly
+// Sets boolean to indicate if the provider is to be initialized only.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeOnly( TBool aInitOnly )
+    {
+    InitializeOnlyEx( GetMediaSource() != MVtEngMedia::EMediaCamera &&
+        aInitOnly );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeOnlyEx
+// Sets boolean to indicate if the provider is to be initialized only. Does
+// not check current media source.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeOnlyEx( TBool aInitOnly )
+    {
+    SetFlag( EFlagSignalSourceSelection );
+    ClearFlag( EFlagInitializeOnly );
+    if ( aInitOnly )
+        {
+        SetFlag( EFlagInitializeOnly );
+        }
+#ifdef VTDEBUG
+    if ( IsFlag( EFlagInitializeOnly ) )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " initOnly SET" )
+        }
+    else
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, " initOnly CLEARED" )
+        }
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetProviderByType
+// Return provider of particular type.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetProviderByType(
+    TVtEngProviderType aType,
+    TProviderItem& aItem )
+    {
+    TInt ret( KErrNotFound );
+    TInt count( iVideoProviders->Count() );
+    while ( count-- )
+        {
+        if ( ( *iVideoProviders )[count].iType == aType )
+            {
+            aItem = ( *iVideoProviders )[count];
+            ret = count;
+            count = 0;
+            }
+        }
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetProviderByType idx=%d", ret )
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetProviderByType
+// Return provider of particular type.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetProviderByType(
+    TVtEngProviderType aType,
+    TProviderItem*& aItem )
+    {
+    TInt ret( KErrNotFound );
+    TInt count( iVideoProviders->Count() );
+    while ( count-- )
+        {
+        if ( ( *iVideoProviders )[count].iType == aType )
+            {
+            aItem = &( *iVideoProviders )[count];
+            ret = count;
+            count = 0;
+            }
+        }
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetProviderByType* idx=%d", ret )
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetProviderByInstance
+// Return provider with particular provider instance.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetProviderByInstance(
+    const CVSDataProvider* aInstance,
+    TProviderItem*& aItem ) const
+    {
+    TInt indexI( ProviderIndexByInstance( aInstance ) );
+    if ( indexI != KErrNotFound )
+        {
+        aItem = &( *iVideoProviders )[ indexI ];
+        }
+    else
+        {
+        aItem = NULL;
+        }
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetProviderByType* idx=%d", indexI )
+    return indexI;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ProviderIndex
+// Returns provider index by type.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::ProviderIndex( TVtEngProviderType aType ) const
+    {
+    for( TInt count = iVideoProviders->Count() - 1; count >= 0; count-- )
+        {
+        if ( ( *iVideoProviders )[ count ].iType == aType )
+            {
+            return count;
+            }
+        }
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ProviderIndexByState
+// Gets a provider index by state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::ProviderIndexByState( TProviderState aState ) const
+    {
+    for( TInt count = iVideoProviders->Count() - 1; count >= 0; count-- )
+        {
+        if ( ( *iVideoProviders )[ count ].iProviderState == aState )
+            {
+            return count;
+            }
+        }
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ProviderIndexByInstance
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::ProviderIndexByInstance(
+    const CVSDataProvider* aInstance) const
+    {
+    for( TInt count = iVideoProviders->Count() - 1; count >= 0; count-- )
+        {
+        if ( ( *iVideoProviders )[ count ].iProvider == aInstance )
+            {
+            return count;
+            }
+        }
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateDataProviderL
+// Creates VideoSource provider by type.
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider* CVtEngLocalVideo::CreateDataProviderL(
+    TVtEngProviderType aType )
+    {
+    __VTPRINTENTER( "LocVid.CreateDataProviderL" )
+    __VTPRINT2( DEBUG_MEDIA, "  provider type=%d", aType )
+    TInt index = KErrNotFound;
+    switch ( aType )
+        {
+        case KVtEngProviderNone:
+        case KVtEngProviderImage:
+        case KVtEngProviderShareImage:
+        case KVtEngProviderDefaultStillImage:
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL Still" )
+            index = iProviderInfoIndexStill;
+            break;
+        case KVtEngProviderCam1:
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL Cam1" )
+           index = iProviderInfoIndexCam1;
+            break;
+        case KVtEngProviderCam2:
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL Cam2" )
+            index = iProviderInfoIndexCam2;
+            break;
+        default:
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL Mobile" )
+            break;
+        }
+
+    CVSDataProvider* provider = NULL;
+    if ( index != KErrNotFound )
+        {
+        __VTPRINT( DEBUG_MEDIA, "LocVideo.CreateDataProviderL provider is" )
+        provider =
+            iSourceController->CreateDataProviderL(
+            index, this, iSource );
+        }
+
+    __VTPRINT2( DEBUG_MEDIA, " provider created=%d",
+        ( TInt ) ( provider != NULL ) )
+    __VTPRINTEXIT( "LocVid.CreateDataProviderL" )
+    return provider;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateBlankProvider
+// Creates blank provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CreateBlankProviderL( const TInt aIndex )
+    {
+    __VTPRINTENTER( "LocVid.CreateBlankProviderL" )
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.CreateBlankProviderL idx=%d", aIndex )
+    CVSDataProvider* provider = NULL;
+    TRAP_IGNORE( provider = iSourceController->CreateDataProviderL(
+        aIndex, this, iSource ) );
+    CleanupStack::PushL( provider );
+    TProviderItem item;
+    item.iProvider = provider;
+    item.iType = KVtEngProviderNone;
+    item.iInitialized = EFalse;
+    item.iProviderState = EPermanent;
+    iVideoProviders->AppendL( item );
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "LocVid.CreateBlankProviderL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateDefaultStillImageProviderL
+// Creates default still image provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CreateDefaultStillImageProviderL( const TInt aIndex )
+    {
+    __VTPRINTENTER( "LocVid.CreateDefaultStillImageProviderL" )
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.CreateDefaultStillImageProviderL idx=%d", aIndex )
+    CVSDataProvider* provider = NULL;
+    TRAP_IGNORE( provider = iSourceController->CreateDataProviderL(
+        aIndex, this, iSource ) );
+    CleanupStack::PushL( provider );
+    TProviderItem item;
+    item.iProvider = provider;
+    item.iType = KVtEngProviderDefaultStillImage;
+    item.iInitialized = EFalse;
+    item.iProviderState = EPermanent;
+    iVideoProviders->AppendL( item );
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "LocVid.CreateDefaultStillImageProviderL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UpdateAvailableProvidersL
+// Updates current providers and their information.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType
+    CVtEngLocalVideo::UpdateAvailableProvidersL()
+    {
+    __VTPRINTENTER( "LocVid.UpdateAvailableProvidersL" )
+    TVtEngProviderType type( KVtEngProviderNone );
+    TInt count( iSourceController->ProvidersAvailable() );
+    iNumSupportedCameras = count - 1;
+    TVSDataProviderInfo providerInfo;
+    TBool primaryAvailable( EFalse );
+    TBool secondaryAvailable( EFalse );
+    TBool mobileAvailable( EFalse );
+    TInt indexMobile( KErrNotFound );
+    ClearFlag( EFlagCamera1Available );
+    ClearFlag( EFlagCamera2Available );
+    ResetIndices();
+    while ( count-- )
+        {
+        iSourceController->ProviderInfoL( count, providerInfo );
+        if ( providerInfo.iOrientation == TCameraInfo::EOrientationInwards ||
+            // treat outwards camera as primary when only 1 cam in the system
+             ( providerInfo.iOrientation == TCameraInfo::EOrientationOutwards &&
+              iNumSupportedCameras == 1 ) )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP inw" )
+            type = KVtEngProviderCam1;
+            primaryAvailable = ETrue;
+            SetFlag( EFlagCamera1Available );
+            iProviderInfoIndexCam1 = count;
+            }
+        else if (
+            providerInfo.iOrientation == TCameraInfo::EOrientationOutwards )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP outw" )
+            secondaryAvailable = ETrue;
+            SetFlag( EFlagCamera2Available );
+            iProviderInfoIndexCam2 = count;
+            }
+        else if ( providerInfo.iOrientation == TCameraInfo::EOrientationMobile )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP mobile" )
+            mobileAvailable = ETrue;
+            indexMobile = count;
+            }
+        else if ( providerInfo.iOrientation == TCameraInfo::EOrientationUnknown )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP still" )
+            CVtEngSettings& settings = CVtEngUtility::Settings();
+            const CVtEngSettings::TVtEngVideoCallConfig& config =
+                settings.Config();
+            if ( config.iVideo.iImageIsValid )
+                {
+                iProviderInfoIndexStill = count;
+                }
+            }
+        }
+    if ( !primaryAvailable && mobileAvailable )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP 1 upd" )
+        type = KVtEngProviderCam1;
+        iProviderInfoIndexCam1 = indexMobile;
+        primaryAvailable = ETrue;
+        SetFlag( EFlagCamera1Available );
+        }
+    else if ( primaryAvailable && mobileAvailable )
+        {
+        // No 1, 2 and mobile.
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP 2 upd" )
+        DeleteProvider( KVtEngProviderCam2 );
+		secondaryAvailable = ETrue;
+        iProviderInfoIndexCam2 = indexMobile;
+        SetFlag( EFlagCamera2Available );
+        }
+    else if ( !primaryAvailable && secondaryAvailable )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP !1 & 2" )
+        type = KVtEngProviderCam2;
+        }
+    else if ( type == KVtEngProviderNone )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP none" )
+        CVtEngSettings& settings = CVtEngUtility::Settings();
+        const CVtEngSettings::TVtEngVideoCallConfig& config =
+            settings.Config();
+        if ( config.iVideo.iImageIsValid )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.UAP valid image" )
+            type = KVtEngProviderImage;
+            }
+        }
+
+    __VTPRINTEXITR( "LocVid.UpdateAvailableProvidersL %d", type )
+    return type;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SwitchProvider
+// Switches to active provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SwitchProvider( TProviderItem* aSwitchToItem )
+    {
+    __VTPRINTENTER( "LocVid.SwitchProvider" )
+
+    iState = ELocSwichingProvider;
+    __VTPRINT( DEBUG_MEDIA, " STATE TO SWITCHING" )
+    iFadingProvider = iActiveProvider;
+    iActiveProvider = aSwitchToItem;
+    TRAPD( err, iSource->SwitchDataProviderL( iActiveProvider->iProvider ) );
+    if ( err != KErrNone )
+        {
+        iState = ELocReady; // go to AO
+        __VTPRINT( DEBUG_MEDIA, " STATE TO READY" )
+        }
+    switch ( iState )
+        {
+        case ELocReady: // Switch done. Sync.
+            {
+            // Entered here if SwitchDataProviderL causes direct call to
+            // vsProviderSwitchDone. Since provider switch should be async
+            // from client point of view now start AO and signal in RunL.
+            Cancel();
+            TRequestStatus* status = &iStatus;
+            SetActive();
+            User::RequestComplete( status, err );
+            __VTPRINT2( DEBUG_MEDIA,
+                "LocVideo.SwitchProvider AO start %d", err )
+            }
+            // fall through
+        case ELocSwichingProvider: // Async.
+        case ELocNone:
+            SetFlag( EFlagSignalSourceSelection );
+            break;
+        default:
+            break;
+        }
+    __VTPRINTEXIT( "LocVid.SwitchProvider" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SwitchProvider
+// Overloaded method that takes new active provider as a parameter.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SwitchProvider( TProviderItem& aProviderItem )
+    {
+    __VTPRINTENTER( "LocVid.SwitchProvider by aProviderItem" )
+    StopViewFinder( EFalse );
+    SwitchProvider( &aProviderItem );
+    __VTPRINTEXIT( "LocVid.SwitchProvider by aProviderItem" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsInitialized
+// Checks if a provider with given id is initialized.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::IsInitialized(
+    MVtEngMedia::TCameraId aId,
+    TBool& aInitialized )
+    {
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.IsInitialized ID:%d", aId )
+    TInt count( iVideoProviders->Count() );
+    TVtEngProviderType type = CameraIdToType( aId );
+    aInitialized = EFalse;
+    TInt err( KErrNotFound );
+    while ( count-- )
+        {
+        TProviderItem& item = ( *iVideoProviders )[count];
+        if ( item.iType == type )
+            {
+            __VTPRINT( DEBUG_MEDIA, "LocVideo.IsInitialized found" )
+            aInitialized = item.iInitialized;
+            if ( ( !aInitialized && item.iProviderState < KErrNone ) ||
+                item.iErrorCode < KErrNone )
+                {
+                __VTPRINT( DEBUG_MEDIA, "LocVideo.IsInitialized problems" )
+                err = item.iErrorCode;
+                }
+            else
+                {
+                err = KErrNone;
+                }
+            count = 0; // break
+            }
+        }
+    __VTPRINT3( DEBUG_MEDIA | DEBUG_RETURN,
+        "LocVideo.IsInitialized isInitialized=%d,err=%d", aInitialized, err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UpdateState
+// Updates view finder state.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::UpdateState()
+    {
+    __VTPRINTENTER( "LocVid.UpdateState" )
+
+    if ( iActiveProvider )
+        {
+        CVSDataProvider* provider = iActiveProvider->iProvider;
+        __VTPRINT2 ( DEBUG_MEDIA, "LocVideo.UpdateState, provider active",
+            provider->ViewFinderActive() )
+        if ( provider && provider->ViewFinderActive())
+            {
+            iViewFinderState = ( iRenderingMethod == EWindowServer ) ?
+                EVFReceivingBitmaps : EVFRenderingDsa;
+            }
+        }
+    ClearFlag( EFlagInitializeOnly );
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN,
+        "LocVideo.UpdateState iViewFinderState %d", iViewFinderState )
+    __VTPRINTEXIT( "LocVid.UpdateState" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializingOrSwitching
+// Is either initializing or doing a provider switch.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::InitializingOrSwitching() const
+    {
+    return ( iState == ELocInitializing ||
+             iState == ELocSwichingProvider );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UninitializeProviderL
+// Uninitializes initialized non-permanent provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::UninitializeProviderL()
+    {
+    __VTPRINTENTER( "LocVid.UninitializeProviderL" )
+    TInt count( iVideoProviders->Count() );
+    while ( count-- )
+        {
+        TProviderItem& item = ( *iVideoProviders )[count];
+        if ( item.iProviderState == EUndefined && item.iInitialized )
+            {
+            DeleteProvider( item );
+            item.iProvider = CreateDataProviderL( item.iType );
+            }
+        }
+    __VTPRINTEXIT( "LocVid.UninitializeProviderL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetCameraInfo
+// Gets camera info.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetCameraInfo( MVtEngMedia::TCameraId aId,
+    MVtEngMedia::TCameraInfo& aInfo )
+    {
+    TBool initialized( EFalse );
+    TInt err( IsInitialized( aId, initialized ) );
+    TVSDataProviderInfo info;
+    if ( initialized && err == KErrNone )
+        {
+        TVtEngProviderType type = CameraIdToType( aId );
+        TProviderItem item;
+        GetProviderByType( type, item );
+        item.iProvider->ProviderInfo( info );
+        aInfo.iMaxDigitalZoom = info.iMaxDigitalZoom;
+        aInfo.iMaxZoom = info.iMaxZoom;
+        aInfo.iMinZoom = info.iMinZoom;
+        aInfo.iMajorZoomStepCount =
+            CalculateMajorDigitalZoomStepCount( item.iProvider );
+        }
+    return initialized ? err : KErrNotReady;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetDigitalZoomFactor
+// Gets current zoom step.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetDigitalZoomFactor( TInt& aCurrentStep )
+    {
+    if ( !iActiveProvider ||
+         !iActiveProvider->iProvider )
+        {
+        return KErrNotReady;
+        }
+    aCurrentStep = iActiveProvider->iProvider->DigitalZoomFactor();
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.GetZ %d", aCurrentStep )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMaxDigitalZoomStep
+// Gets max. digital zoom step.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetMaxDigitalZoomStep( TInt& aMaxZoomStep )
+    {
+    if ( !iActiveProvider ||
+         !iActiveProvider->iProvider )
+        {
+        return KErrNotReady;
+        }
+    aMaxZoomStep = iProviderInfo.iMaxDigitalZoom;
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+        "LocVideo.MaxZStep %d", aMaxZoomStep )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMajorDigitalZoomStepCount
+// Gets number of major zoom level leaps.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::
+    GetMajorDigitalZoomStepCount( TInt& aCount, TBool /*aProviderSupplied*/ )
+    {
+    /*__VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+        "LocVideo.GetMajZStepCount %d", aProviderSupplied )*/
+    if ( !iActiveProvider || !iActiveProvider->iProvider )
+        {
+        return KErrNotReady;
+        }
+    aCount = CalculateMajorDigitalZoomStepCount( iProviderInfo );
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+        "LocVideo.GetMajZStepCount %d", aCount )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetMajorDigitalZoomStep
+// Maps major step to zoom step. Note: aIndex is given in range
+// [0 .. CalculateMajorDigitalZoomStepCount() - 1]
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::GetMajorDigitalZoomStep( const TInt aIndex, TInt& aStep )
+    {
+    if ( !iActiveProvider || !iActiveProvider->iProvider )
+        {
+        // No active provider.
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "LocVideo.GetMajZStep NO active")
+        return;
+        }
+    if ( iProviderInfo.iMaxDigitalZoom > KVtMaxZoomStep )
+        {
+        aStep = iProviderInfo.iMaxDigitalZoom *
+            Min( KVtMaxZoomStep, Max( 0, aIndex ) ) / KVtMaxZoomStep;
+        }
+    else
+        {
+        aStep = Min( iProviderInfo.iMaxDigitalZoom, Max( 0, aIndex ) );
+        }
+    __VTPRINT3( DEBUG_MEDIA | DEBUG_DETAIL,
+        "LocVideo.GetMajZStep idx=%d,step=%d", aIndex, aStep )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetFreezeSupported
+// Gets freeze supported value from provider.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::GetFreezeSupported( TBool& aFreezeSupported ) const
+    {
+    __VTPRINTENTER( "LocVideo.GetFreezeSupported" )
+    if ( !iActiveProvider ||
+         !iActiveProvider->iProvider )
+        {
+        __VTPRINTEXIT( "LocVideo.GetFreezeSupported KErrNotReady")
+        return KErrNotReady;
+        }
+    aFreezeSupported = iProviderInfo.iFreezeSupported;
+    __VTPRINTEXITR( "LocVideo.GetFreezeSupported %d", aFreezeSupported )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::OkToFreeze
+// Returns ETrue if it is ok to freeze provider (i.e. freeze is supported AND
+// provider is not currently frozen)
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::OkToFreeze() const
+    {
+    __VTPRINTENTER( "LocVideo.OkToFreeze" )
+    TBool isOk( EFalse );
+    if ( iActiveProvider &&
+         iActiveProvider->iProvider )
+        {
+        isOk = ( iProviderInfo.iFreezeSupported && !IsFlag( EFlagFrozen ) );
+        }
+    __VTPRINTEXITR( "LocVideo.OkToFreeze %d", isOk )
+    return isOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::OkToUnfreeze
+// Returns ETrue if it is ok to unfreeze provider (i.e. freeze is supported AND
+// provider is currently frozen)
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::OkToUnfreeze() const
+    {
+    __VTPRINTENTER( "LocVideo.OkToUnfreeze" )
+    TBool isOk( EFalse );
+    if ( iActiveProvider &&
+         iActiveProvider->iProvider )
+        {
+        isOk = ( iProviderInfo.iFreezeSupported && IsFlag( EFlagFrozen ) );
+        }
+    __VTPRINTEXITR( "LocVideo.OkToUnfreeze %d", isOk )
+    return isOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::Mute
+// Sets the audio state as muted.
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::Mute()
+    {
+    SetFlag( EFlagAudioMuted );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::UnMute
+// Sets the audio state on again.
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::UnMute()
+    {
+    ClearFlag( EFlagAudioMuted );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetUIForeground
+// Sets UI foreground state.
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::SetUIForeground( TBool aForeground )
+    {
+    __VTPRINTENTER( "LocVideo.SetUIForeground" )
+    __VTPRINT2( DEBUG_GEN, " foreground=%d", aForeground )
+
+    //Error indicator
+    TInt err = KErrNone;
+    if ( aForeground )
+        {
+        if ( iDelayedSelect.IsDelayedSelectPending() )
+            {
+            TVtEngProviderType type( iDelayedSelect.DelayedSelectTarget() );
+            __VTPRINT2( DEBUG_MEDIA,
+                "LocVideo.SetUIForeground delayed switch to %d", type )
+            SelectSourceL( type );
+            }
+        
+        SetFlag( EFlagUIForeground );
+        ClearFlag( EFlagUIBackground );
+        if ( IsFlag( EFlagVFEnabled ) )
+            {
+            //Ignore error
+            TRAP (err, StartViewFinderL( EFalse ));
+            }
+        else
+            {
+            MVtEngMedia::TShareObjectState sharingState;
+            GetObjectSharingState( sharingState );
+            if ( sharingState == MVtEngMedia::ESharingImage )
+                {
+                //Ignore error
+                TRAP (err, StartViewFinderL( ETrue ));
+                }
+            }
+        }
+    else
+        {
+        ClearFlag( EFlagUIForeground );
+        SetFlag( EFlagUIBackground );
+        StopViewFinder( EFalse );
+        ClearFlag( EFlagUIBackground );
+        }
+    __VTPRINTEXIT( "LocVideo.SetUIForeground" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetObjectSharingState
+// Get current media object sharing state.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::GetObjectSharingState(
+    MVtEngMedia::TShareObjectState& aObjectSharingState ) const
+    {
+    __VTPRINTENTER( "LocVid.GetObjectSharingState" )
+    if( iActiveProvider && iActiveProvider->iProvider )
+        {
+        iShareImage->GetObjectSharingState( aObjectSharingState );
+        }
+    else
+        {
+        aObjectSharingState = MVtEngMedia::ENotAbleToShare;
+        }
+    __VTPRINTEXITR( "LocVid.GetObjectSharingState %d", aObjectSharingState )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::InitializeShareImageL
+// Start Image sharing initialization.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::InitializeShareImageL(
+    const MVtEngMedia::TShareObjectImageParameters& aParameters,
+    TBool& aFirstTime )
+    {
+    __VTPRINTENTER( "LocVid.InitializeShareImageL" )
+
+    iShareImage->InitializeL( aParameters,
+    iActiveProvider->iType, aFirstTime );
+
+    __VTPRINTEXIT( "LocVid.InitializeShareImageL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StartShareImageL
+// Stop sharing Image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StartShareImageL()
+    {
+    __VTPRINTENTER( "LocVid.StartShareImageL" )
+    const TBool delayed( iDelayedSelect.IsDelayedSelectPending() );
+    const TVtEngProviderType type( iDelayedSelect.DelayedSelectTarget() );
+    iShareImage->ShareL();
+    if ( delayed )
+        {
+        __VTPRINT2( DEBUG_MEDIA,
+            "LocVid.StartShareImageL IsDelayedSelectPending type = %d",
+             type )
+        iShareImage->NotifyCameraChanged( type );
+        }
+    __VTPRINTEXIT( "LocVid.StartShareImageL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::StopShareImageL
+// Stop sharing Image.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::StopShareImageL()
+    {
+    __VTPRINTENTER( "LocVid.StopShareImageL" )
+    iShareImage->StopL();
+    __VTPRINTEXIT( "LocVid.StopShareImageL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ShareError
+// Report error to image sharer.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ShareError( TInt aError )
+    {
+    __VTPRINTENTER( "LocVid.ShareError" )
+    iShareImage->Error( aError );
+    __VTPRINTEXIT( "LocVid.ShareError" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ShareStoredSource
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType CVtEngLocalVideo::ShareStoredSource() const
+    {
+    __VTPRINTENTER( "LocVid.ShareStoredSource" )
+    const TVtEngProviderType stored( iShareImage->StoredSource() );
+    __VTPRINTEXITR( "LocVid.ShareStoredSource = %d", stored )
+    return stored;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SettingsChanged
+// Called when GS settings changed.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SettingsChanged()
+    {
+    __VTPRINTENTER( "LocVid.SettingsChanged" )
+    iShareImage->SettingsChanged();
+    __VTPRINTEXIT( "LocVid.SettingsChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetIsPrepareCameraCalled
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetIsPrepareCameraCalled( TBool aCalled )
+    {
+    __VTPRINTENTER( "LocVid.SetIsPrepareCameraCalled" )
+    iPrepareCameraCalled = aCalled;
+    __VTPRINTEXITR( "LocVid.SetIsPrepareCameraCalled %d", iPrepareCameraCalled )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsPrepareCameraCalled
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsPrepareCameraCalled() const
+    {
+    __VTPRINTENTER( "LocVid.IsPrepareCameraCalled" )
+    __VTPRINTEXITR( "LocVid.IsPrepareCameraCalled %d", iPrepareCameraCalled )
+    return iPrepareCameraCalled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::HandleLayoutChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::HandleLayoutChangeL()
+    {
+    __VTPRINTENTER( "LocVid.HandleLayoutChangeL" )
+    iLayoutChangeHandler.HandleLayoutChangeL();
+    __VTPRINTEXIT( "LocVid.HandleLayoutChangeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsDelayedSelectPending
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsDelayedSelectPending() const
+    {
+    return iDelayedSelect.IsDelayedSelectPending();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::DeleteProvider
+// Deletes provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::DeleteProvider(
+    TProviderItem& aItem )
+    {
+    __VTPRINTENTER( "LocVid.DeleteProvider" )
+    aItem.iProviderState = EUndefined;
+    if ( aItem.iProvider &&
+         aItem.iInitialized &&
+         aItem.iProvider->ViewFinderActive() )
+        {
+        aItem.iProvider->StopViewFinder();
+        }
+    delete aItem.iProvider;
+    aItem.iInitialized = EFalse;
+    aItem.iProvider = NULL;
+    __VTPRINTEXIT( "LocVid.DeleteProvider" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::DeleteProvider
+// Deletes provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::DeleteProvider( const TVtEngProviderType aType )
+    {
+    TProviderItem dummy;
+    const TInt pos( GetProviderByType( aType, dummy ) );
+    if ( pos >= 0 ) // valid index
+        {
+        TProviderItem& item = ( *iVideoProviders )[pos];
+        DeleteProvider( item );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::Reset
+// Resets local video handler.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::Reset()
+    {
+    __VTPRINTENTER( "LocVid.Reset" )
+
+    __VTPRINT( DEBUG_MEDIA, "LocVideo.Reset" )
+    DeleteProvider( KVtEngProviderCam1 );
+    DeleteProvider( KVtEngProviderCam2 );
+    DeleteAudioSource();
+
+    ClearFlag( EFlagAudioMuted |
+               EFlagSignalSourceSelection |
+               EFlagInitialized |
+               EFlagVFEnabled |
+               EFlagFrozen );
+
+    __VTPRINT( DEBUG_MEDIA, "LocVideo.Reset clearing EFlagVFEnabled and other" )
+
+    StopViewFinder();
+    __VTPRINTEXIT( "LocVid.Reset" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetDigitalZoomFactorL
+// Sets video provider's digital zoom step.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetDigitalZoomFactorL( TInt aDigitalZoomFactor )
+    {
+    __VTPRINTENTER( "LocVid.SetDigitalZoomFactorL" )
+    __VTPRINT2( DEBUG_MEDIA, "LocVideo.SetZoom %d", aDigitalZoomFactor )
+    if ( !iActiveProvider ||
+         !iActiveProvider->iProvider )
+        {
+        User::Leave( KErrNotReady );
+        }
+    CVSDataProvider* provider( iActiveProvider->iProvider );
+    provider->SetDigitalZoomFactorL( aDigitalZoomFactor );
+    iActiveProvider->iStoredZoomFactor = provider->DigitalZoomFactor();
+    __VTPRINTEXIT( "LocVid.SetDigitalZoomFactorL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetFlag
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetFlag( const TInt aFlag )
+    {
+    iFlags |= aFlag;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ClearFlag
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ClearFlag( const TInt aFlag )
+    {
+    iFlags &= ~aFlag;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsFlag
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsFlag( const TInt aFlag ) const
+    {
+    return ( ( iFlags & aFlag ) != 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CalculateMajorDigitalZoomStepCount
+// Utility function to calculate amount of major zoom steps.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CalculateMajorDigitalZoomStepCount(
+    CVSDataProvider* aProvider )
+    {
+    TVSDataProviderInfo info;
+    aProvider->ProviderInfo( info );
+    return CalculateMajorDigitalZoomStepCount( info );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CalculateMajorDigitalZoomStepCount
+// Utility function to calculate amount of major zoom steps.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CalculateMajorDigitalZoomStepCount(
+    const TVSDataProviderInfo& aInfo ) const
+    {
+    TInt zStepCount( aInfo.iMaxDigitalZoom ?
+        aInfo.iMaxDigitalZoom + 1 : 0 );
+    TInt maxZStepCount( KVtMaxZoomStep + 1 );
+    return zStepCount > maxZStepCount ? maxZStepCount : zStepCount;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::TProviderItem
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TProviderItem::TProviderItem() :
+    iProvider( NULL ),
+    iType( KVtEngProviderUndefined ),
+    iInitialized( EFalse ),
+	iErrorCode( 0 ),
+    iProviderState( EUndefined ),
+    iStoredZoomFactor( 0 ),
+    iZFErr( KErrNone ),
+    iCamPrefs( NULL ),
+    iFirstTime( ETrue )
+    {
+    __VTPRINTENTER( "LocVid.TProviderItem.ctor" )
+    ResetStoredValues();
+    __VTPRINTEXITR( "LocVid.TProviderItem.ctor $%x", TInt( this ) )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::~TProviderItem
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TProviderItem::~TProviderItem()
+    {
+    __VTPRINTENTER( "LocVid.TProviderItem.~" )
+    DetachFromCameraPreferences();
+    __VTPRINTEXITR( "LocVid.TProviderItem.~ $%x", TInt( this ) )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::ResetStoredValues
+// Resets stored values.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::ResetStoredValues()
+    {
+    __VTPRINTENTER( "LocVid.ResetStoredValues" )
+    DetachFromCameraPreferences();
+    __VTPRINTEXIT( "LocVid.ResetStoredValues" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::RestoreZoomFactor
+// Tries to restore zoom factor.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::TProviderItem::RestoreZoomFactor()
+    {
+    __VTPRINTENTER( "LocVid.RestoreZoomFactor" )
+    TRAP( iZFErr,
+        {
+        if ( iProvider && !iZFErr )
+            {
+            iProvider->SetDigitalZoomFactorL( iStoredZoomFactor );
+            iStoredZoomFactor = iProvider->DigitalZoomFactor();
+            __VTPRINT2( DEBUG_GEN, "LocVideo.RestoreZoomFactor ZF now = %d",
+                iStoredZoomFactor )
+            }
+        } );
+    __VTPRINTEXITR( "LocVid.RestoreZoomFactor %d", iZFErr )
+    return iZFErr;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::RestorePreferences
+// Tries to restore preferences.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::TProviderItem::RestorePreferences()
+    {
+    __VTPRINTENTER( "LocVid.RestorePreferences" )
+    TRAPD( error,
+        {
+        if ( iCamPrefs && iProvider && !iFirstTime )
+            {
+            if ( !iCtErr )
+                {
+                iProvider->SetColorToneL(
+                    CCamera::CCameraImageProcessing::TEffect( iColorTone ) );
+                }
+            if ( !iWbErr )
+                {
+                iProvider->SetWhiteBalanceL(
+                    CCamera::TWhiteBalance( iWhiteBalance ) );
+                }
+            if ( !iBrErr )
+                {
+                iProvider->SetBrightnessL( iBrightness );
+                }
+            if ( !iCrErr )
+                {
+                iProvider->SetContrastL( iContrast );
+                }
+            }
+        } );
+    __VTPRINTEXITR( "LocVid.RestorePreferences %d", error )
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::Attach
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::Attach( MVtEngCameraPreferences&
+    aCamPrefs )
+    {
+    __VTPRINTENTER( "LocVid.Attach" )
+    iCamPrefs = &aCamPrefs;
+    if ( iFirstTime )
+        {
+        iCtErr = iCamPrefs->GetColorTone( iColorTone );
+        iWbErr = iCamPrefs->GetWhiteBalance( iWhiteBalance );
+        iBrErr = iCamPrefs->GetBrightness( iBrightness );
+        iCrErr = iCamPrefs->GetContrast( iContrast );
+        iFirstTime = EFalse;
+        }
+    __VTPRINTEXITR( "LocVid.Attach $%x", TInt( iCamPrefs ) )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::ColorToneUpdated
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::ColorToneUpdated(
+    MVtEngCameraPreferences::TColorTone aColorTone )
+    {
+    __VTPRINTENTER( "LocVid.ColorToneUpdated" )
+    iCtErr = KErrNone;
+    iColorTone = aColorTone;
+    __VTPRINTEXITR( "LocVid.ColorToneUpdated %d", aColorTone )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::WhiteBalanceUpdated
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::WhiteBalanceUpdated(
+    MVtEngCameraPreferences::TWhiteBalance aWhiteBalance )
+    {
+    __VTPRINTENTER( "LocVid.WhiteBalanceUpdated" )
+    iWbErr = KErrNone;
+    iWhiteBalance = aWhiteBalance;
+    __VTPRINTEXITR( "LocVid.WhiteBalanceUpdated %d", aWhiteBalance )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::BrightnessUpdated
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::BrightnessUpdated( TInt aBrightness )
+    {
+    __VTPRINTENTER( "LocVid.BrightnessUpdated" )
+    iBrErr = KErrNone;
+    iBrightness = aBrightness;
+    __VTPRINTEXITR( "LocVid.BrightnessUpdated %d", aBrightness )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::ContrastUpdated
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::ContrastUpdated( TInt aContrast )
+    {
+    __VTPRINTENTER( "LocVid.ContrastUpdated" )
+    iCrErr = KErrNone;
+    iContrast = aContrast;
+    __VTPRINTEXITR( "LocVid.ContrastUpdated %d", aContrast )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::Detach
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::Detach( MVtEngCameraPreferences& )
+    {
+    __VTPRINTENTER( "LocVid.Detach" )
+    iCamPrefs = NULL;
+    __VTPRINTEXIT( "LocVid.Detach" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TProviderItem::DetachFromCameraPreferences
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TProviderItem::DetachFromCameraPreferences()
+    {
+    __VTPRINTENTER( "LocVid.DetachFromCameraPreferences" )
+    if ( iCamPrefs )
+        {
+        static_cast< CVtEngCameraPreferences* >( iCamPrefs )->Detach( *this );
+        iCamPrefs = NULL;
+        }
+    __VTPRINTEXIT( "LocVid.DetachFromCameraPreferences" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateAudioSource
+// Creates audio source.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::CreateAudioSource()
+    {
+    __VTPRINTENTER( "LocVid.CreateAudioSource" )
+    TInt err = KErrNone;
+    // Check if this really a target compilation
+#if !defined( __WINS__ )
+    iAudioSource = VTProtocolFactory::CreateAudioSource();
+    if ( !iAudioSource )
+        {
+        err = KErrNoMemory;
+        }
+#endif // !(__WINS__)
+    __VTPRINTEXITR( "LocVid.CreateAudioSource %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::DeleteAudioSource
+// Deletes audio source.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::DeleteAudioSource()
+    {
+    __VTPRINTENTER( "LocVid.DeleteAudioSource" )
+    if( iAudioSource )
+        {
+        VTProtocolFactory::DeletAudioSource(iAudioSource);
+        iAudioSource = NULL;
+        }
+    __VTPRINTEXIT( "LocVid.DeleteAudioSource" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::PauseVideoSending
+// Pause video sending.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::PauseVideoSending()
+    {
+    __VTPRINTENTER( "LocVid.PauseVideoSending" )
+    if ( iSource )
+        {
+        iSource->PauseSending();
+        }
+    __VTPRINTEXIT( "LocVid.PauseVideoSending" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ResumeVideoSending
+// Resume video sending.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ResumeVideoSending()
+    {
+    __VTPRINTENTER( "LocVid.ResumeVideoSending" )
+    if ( iSource )
+        {
+        iSource->ResumeSending();
+        }
+    __VTPRINTEXIT( "LocVid.ResumeVideoSending" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ViewFinderStarted
+// Is view finder started.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::ViewFinderStarted() const
+    {
+    CVSDataProvider* provider = NULL;
+    if( iActiveProvider )
+        {
+         provider = iActiveProvider->iProvider;
+        }
+    if ( !provider )
+        {
+        return EFalse;
+        }
+    return provider->ViewFinderActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ViewFinderStarted
+// Is view finder started.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsFrozen() const
+    {
+    TBool result = IsFlag( EFlagFrozen );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::ResetIndices
+// Resets the provider info indices.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::ResetIndices()
+    {
+    iProviderInfoIndexCam1 = KErrNotFound;
+    iProviderInfoIndexCam2 = KErrNotFound;
+    iProviderInfoIndexStill = KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetCameraTracking
+// Sets a listener for camera P & S data.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::SetCameraTrackingL( TInt& aProviderIndex )
+    {
+    __VTPRINTENTER( "LocVideo.SetCameraTracking" )
+    iCameraListener = CVtEngPubSubsListener::NewL( KPSUidVTMediaConfiguration,
+        KPSPreferredCamera, this );
+
+    __VTPRINTEXIT( "LocVideo.SetCameraTracking" )
+    return iCameraListener->Get( aProviderIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngInitializer::HandleNotifyPSL
+// Notification of changed port value.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::HandleNotifyPSL(
+    const TUid /*aUid */, const TInt& /* aKey */,
+    const TRequestStatus& aStatus )
+    {
+    __VTPRINTENTER( "LocVideo.handleNotifyPSL " )
+    if ( aStatus.Int() == KErrNone )
+        {
+        // Get the new camera value.
+        TInt cameraId( EPSPreferredCameraUnknown );
+        iCameraListener->Get( cameraId );
+        // No need to check error, since MapCameraInternally will return
+        // current camera, and no actions will be taken.
+        MVtEngMedia::TCameraId camId( MapCameraInternally( cameraId ) );
+
+        TVtEngProviderType providerType( KVtEngProviderUndefined );
+        TInt result( KErrNone );
+        switch( camId )
+            {
+            case MVtEngMedia::EPrimaryCamera:
+                if( IsFlag( EFlagCamera1Available ) )
+                    {
+                    providerType = KVtEngProviderCam1;
+                    }
+                else
+                    {
+                    result = KErrNotFound;
+                    }
+                break;
+
+            case MVtEngMedia::ESecondaryCamera:
+                if( IsFlag( EFlagCamera2Available ) )
+                    {
+                    providerType = KVtEngProviderCam2;
+                    }
+                else
+                    {
+                    result = KErrNotFound;
+                    }
+                break;
+
+            default:
+                result = KErrNotSupported;
+                break;
+            }
+
+        User::LeaveIfError( result );
+
+        // If we're sharing, then notify camera change to image sharer
+        if ( GetMediaSource() == MVtEngMedia::EMediaShare ||
+             iShareImage->IsInitializingShare() )
+            {
+            iShareImage->NotifyCameraChanged( providerType );
+            }
+        // If current provider is camera
+        else if ( GetMediaSource() == MVtEngMedia::EMediaCamera )
+            {
+            // If current camera is different than new
+            if ( iCurrentCamera != camId )
+                {
+                // If VT is in the foreground and Provider is unfrozen
+                if ( IsFlag( EFlagUIForeground ) && !IsFrozen() && !iObserver.IsVideoChannelClosed() )
+                    {
+                    // select camera..
+                    SelectSourceL( providerType );
+                    }
+                else
+                    {
+                    iObserver.SetSelectedCameraId( camId );
+                    // ..else notify delayed select
+                    iLayoutChangeHandler.CancelHandleLayoutChange();
+                    iDelayedSelect.NotifyDelayedSelect( providerType );
+                    }
+                }
+            else
+                {
+                // else ignore
+                }
+            }
+        // Else store camera type and on next SelectSourceL() use this instead
+        else
+            {
+            iObserver.SetSelectedCameraId( camId );
+            // If prepare camera has not been called, then just
+            // update preferred camera
+            if ( GetMediaSource()!= MVtEngMedia::EMediaNone && 
+                    ( IsPrepareCameraCalled() || iObserver.IsVideoChannelClosed() ) )
+                {
+                iLayoutChangeHandler.CancelHandleLayoutChange();
+                iDelayedSelect.NotifyDelayedSelect( providerType );
+                }
+            else
+                {
+                iCurrentCamera = camId;
+                }
+            }
+        }
+    __VTPRINTEXIT( "LocVideo.HandleNotifyPSL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::SetCurrentCameraId
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::SetCurrentCameraId( MVtEngMedia::TCameraId aCamId )
+    {
+    __VTPRINTENTER( "LocVideo.SetCurrentCameraId" )
+    iCurrentCamera = aCamId;
+    iObserver.SetSelectedCameraId( aCamId );
+    __VTPRINTEXITR( "LocVideo.SetCurrentCameraId camId = %d", aCamId )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::MapCameraInternally
+// Maps camera id to internal data structures.
+// -----------------------------------------------------------------------------
+//
+MVtEngMedia::TCameraId CVtEngLocalVideo::MapCameraInternally( TInt aCameraId )
+    {
+    __VTPRINT2( DEBUG_GEN, "LocVideo.MapCameraInternally cameraId=%d",
+        aCameraId )
+    if ( aCameraId == EPSPreferredCameraInwards ||
+         iNumSupportedCameras == 1 )
+        {
+        return MVtEngMedia::EPrimaryCamera;
+        }
+    else  if ( aCameraId == EPSPreferredCameraOutwards )
+        {
+        return MVtEngMedia::ESecondaryCamera;
+        }
+    __VTPRINT2( DEBUG_GEN, "LocVideo.MapCameraInternally curCam=%d", iCurrentCamera )
+    return iCurrentCamera;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CameraAvailable
+// Checks camera availabitility.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::
+    CameraAvailable( CVtEngLocalVideo::TVtEngProviderType &aType )
+    {
+    __VTPRINT2( DEBUG_GEN, "LocVideo.CameraAvailable In.type=%d ", aType )
+    if ( iCurrentCamera == MVtEngMedia::EPrimaryCamera )
+        {
+        if ( IsFlag( EFlagCamera1Available ) )
+            {
+            aType = KVtEngProviderCam1;
+            }
+        }
+    else if ( iCurrentCamera == MVtEngMedia::ESecondaryCamera )
+        {
+        if ( IsFlag( EFlagCamera2Available ) )
+            {
+            aType = KVtEngProviderCam2;
+            }
+        }
+    __VTPRINT2( DEBUG_GEN, "LocVideo.CameraAvailable Out.type=%d", aType )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::IsProviderWaiting
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::IsProviderWaiting( TVtEngProviderType aType ) const
+    {
+    __VTPRINTENTER( "LocVid.IsProviderWaiting" )
+    TBool isWaiting( EFalse );
+    TInt indexWaiting( ProviderIndexByState( EWaiting ) );
+    if ( indexWaiting != KErrNotFound )
+        {
+        TProviderItem& item = ( *iVideoProviders )[ indexWaiting ];
+        isWaiting = ( item.iType == aType );
+        }
+    __VTPRINTEXITR( "LocVid.IsProviderWaiting %d", isWaiting )
+    return isWaiting;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::GetHighestSelectableProvider
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::GetHighestSelectableProvider(
+    CVtEngLocalVideo::TVtEngProviderType& aPreferred ) const
+    {
+    __VTPRINTENTER( "LocVid.GetHighestSelectableProvider" )
+    const TVtEngProviderType preferred = aPreferred;
+    switch ( preferred )
+        {
+        case KVtEngProviderCam1:
+            if ( IsFlag( EFlagCamera1Available ) )
+                {
+                // cam1 is selectable, jump out
+                break;
+                }
+            // othwerwise fall through to next in priority order
+        case KVtEngProviderCam2:
+            if ( IsFlag( EFlagCamera2Available ) &&
+            // Do not allow change to another camera without user permission,
+            // i.e. test preferred was cam1 but it wasn't available.
+                preferred != KVtEngProviderCam1 )
+                {
+                // cam2 is selectable
+                aPreferred = KVtEngProviderCam2;
+                break;
+                }
+            // othwerwise fall through to next in priority order
+        case KVtEngProviderImage:
+            if ( CVtEngUtility::Settings().Config().iVideo.iImageIsValid )
+                {
+                aPreferred = KVtEngProviderImage;
+                break;
+                }
+            // othwerwise fall through to next in priority order
+        case KVtEngProviderNone:
+        default:
+            // always available
+            aPreferred = KVtEngProviderNone;
+            break;
+        }
+    __VTPRINTEXITR( "LocVid.GetHighestSelectableProvider %d", aPreferred )
+    return ( preferred == aPreferred );
+    }
+
+// Implementation of CVtEngLocalVideo::CVtEngShareImage
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::NewL
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngShareImage* CVtEngLocalVideo::CVtEngShareImage::NewL(
+    CVtEngLocalVideo& aLocalVideo )
+    {
+    CVtEngShareImage* self = new ( ELeave ) CVtEngShareImage( aLocalVideo );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::~CVtEngShareImage
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngShareImage::~CVtEngShareImage()
+    {
+    DeleteProviders();
+    iBuffered.ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::InitializeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::InitializeL(
+    const MVtEngMedia::TShareObjectImageParameters& aParameters,
+    TVtEngProviderType aCurrent,
+    TBool& aFirstTime )
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.InitializeL" )
+    if ( IsInitializing() )
+        {
+        // Already initializing.
+        User::Leave( KErrNotReady );
+        }
+
+
+    CVtEngLocalVideo::TProviderItem* freeProviderItem = FetchProviderItem();
+    if ( !freeProviderItem )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    iParameters = aParameters;
+    CreateProviderL( *freeProviderItem );
+    InitializeProviderL( *freeProviderItem );
+
+    // Only set stored type when sharing is started, if resharing (i.e. sharing
+    // new image when already sharing other image), then don't change stored
+    // type.
+    if ( iStoredType == KVtEngProviderUndefined )
+        {
+        iSettingsChanged = EFalse;
+        iOriginalStoredType = iStoredType = aCurrent;
+        aFirstTime = ETrue;
+        }
+    else
+        {
+        aFirstTime = EFalse;
+        }
+    iInitializingProvider = freeProviderItem;
+    SetState( EInitializing );
+    __VTPRINTEXIT( "LocVid.ShareImage.InitializeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::ShareL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::ShareL()
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.ShareL" )
+    if ( !IsInitializing() && iInitializingProvider )
+        {
+        User::Leave( KErrNotReady );
+        }
+    iActiveProvider = iInitializingProvider;
+    iInitializingProvider = NULL;
+    iLocalVideo->SwitchProvider( *iActiveProvider );
+    SetState( ESharing );
+    __VTPRINTEXIT( "LocVid.ShareImage.ShareL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::StopL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::StopL()
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.StopL" )
+    iLocalVideo->InitializeOnly( EFalse );
+
+    CVtEngLocalVideo::TVtEngProviderType target( StoredSource() );
+    if ( iOriginalStoredType != target )
+        {
+        TProviderItem* item = NULL;
+        if ( iLocalVideo->GetProviderByType( iOriginalStoredType, item )
+             != KErrNotFound )
+            {
+            if ( item->iProviderState != EPermanent )
+                {
+                iLocalVideo->DeleteProvider( *item );
+                }
+            }
+        }
+
+    if ( iSettingsChanged )
+        {
+        if ( target == KVtEngProviderDefaultStillImage )
+            {
+            DeleteProvider( target );
+            }
+        DeleteProvider( KVtEngProviderImage );
+        }
+
+    __VTPRINT2( DEBUG_MEDIA, "LocVid.ShareImage.StopL select %d",
+        target )
+    iLocalVideo->SelectSourceL( target );
+
+    if ( iStoredType == KVtEngProviderCam1 ||
+         iStoredType == KVtEngProviderCam2 )
+        {
+        MVtEngMedia::TCameraId camId(
+            iStoredType == KVtEngProviderCam1 ?
+                MVtEngMedia::EPrimaryCamera :
+                 MVtEngMedia::ESecondaryCamera );
+        iLocalVideo->SetCurrentCameraId( camId );
+        __VTPRINT2( DEBUG_MEDIA, "LocVid.ShareImage.StopL set camId %d",
+            camId )
+        }
+    SetState( EStopped );
+    __VTPRINTEXIT( "LocVid.ShareImage.StopL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::Error
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::Error( TInt
+#ifdef _DEBUG
+    aError
+#endif // _DEBUG
+    )
+    {
+    TState stateAfter( EStopped );
+    __VTPRINTENTER( "LocVid.ShareImage.Error" )
+    if ( IsInitializing() )
+        {
+        iInitializingProvider = NULL;
+        stateAfter = iPreviousState;
+        }
+    else if ( iState == ESharing )
+        {
+        if ( iLocalVideo->iObserver.GetPendingCommand() != KVtEngInitializeShareImage )
+            {
+            CVtEngEventManager::NotifyEvent( KVtEngShareImageDecodingError );
+            }
+        stateAfter = ESharing;
+        //iActiveProvider = NULL;
+        }
+    SetState( stateAfter );
+#ifdef _DEBUG
+    __VTPRINTEXITR( "LocVid.ShareImage.Error %d", aError )
+#endif // _DEBUG
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::StoredSource
+//
+// Returns stored source for this share session. Stored source may have changed
+// during share (e.g. when GS still image is being sent but during share
+// GS still image is disabled => still image cannot be used anymore and thus
+// None provider must be activated). All these conditions are checked by this
+// method.
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType
+    CVtEngLocalVideo::CVtEngShareImage::StoredSource() const
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.StoredSource" )
+    CVtEngLocalVideo::TVtEngProviderType stored( iStoredType );
+
+    if ( iOriginalStoredType == KVtEngProviderNone ||
+         iOriginalStoredType == KVtEngProviderImage ||
+         iOriginalStoredType == KVtEngProviderDefaultStillImage )
+        {
+        if ( CVtEngUtility::Settings().Config().iVideo.iImageIsValid )
+            {
+            stored = KVtEngProviderImage;
+            }
+        else if ( CVtEngUtility::Settings().IsDefaultStillImageDefined() )
+            {
+            stored = KVtEngProviderDefaultStillImage;
+            }
+        else
+            {
+            stored = KVtEngProviderNone;
+            }
+        }
+    __VTPRINTEXITR( "LocVid.ShareImage.StoredSource = %d", stored )
+    return stored;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::CVtEngShareImage
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::CVtEngShareImage::CVtEngShareImage(
+    CVtEngLocalVideo& aLocalVideo )
+    : iLocalVideo( &aLocalVideo ), iState( EStopped ),
+      iStoredType( KVtEngProviderUndefined ),
+      iOriginalStoredType( KVtEngProviderUndefined ),
+      iBuffered( 2 ), iSettingsChanged( EFalse )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::ConstructL()
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.ConstructL" )
+    for ( TInt i = 0; i < KVtEngNumProvidersBuffered; i++ )
+        {
+        TProviderItem* item = new (ELeave) TProviderItem();
+        CleanupStack::PushL( item );
+        User::LeaveIfError( iBuffered.Append( item ) );
+        CleanupStack::Pop(); // item
+        }
+    __VTPRINTEXIT( "LocVid.ShareImage.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::Parameters
+// -----------------------------------------------------------------------------
+//
+const MVtEngMedia::TShareObjectImageParameters&
+    CVtEngLocalVideo::CVtEngShareImage::Parameters() const
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.Parameters" )
+    __VTPRINTEXIT( "LocVid.ShareImage.Parameters" )
+    return iParameters;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::IsInitializing
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::CVtEngShareImage::IsInitializing() const
+    {
+    TBool isInitializing( iState == EInitializing );
+    __VTPRINTENTER( "LocVid.ShareImage.IsInitializing" )
+    __VTPRINTEXITR( "LocVid.ShareImage.IsInitializing %d", isInitializing )
+    return isInitializing;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::SetState
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::SetState( const TState aNewState )
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.SetState" )
+    // Signal UI when entering or leaving initializing state
+    if ( aNewState == EInitializing )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngShareImageInitializeBegin );
+        }
+    else if ( iState == EInitializing )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngShareImageInitializeEnd );
+        }
+    // Reset stored type when stopping
+    if( aNewState == EStopped )
+        {
+        iOriginalStoredType = iStoredType = KVtEngProviderUndefined;
+        iSettingsChanged = EFalse;
+        }
+    iPreviousState = iState;
+    iState = aNewState;
+    __VTPRINTEXITR( "LocVid.ShareImage.SetState iState = %d", iState )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::GetProviderItemL
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TProviderItem*
+    CVtEngLocalVideo::CVtEngShareImage::FetchProviderItem() const
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.FetchProviderItem" )
+    for( TInt i = 0; i < iBuffered.Count(); i++ )
+        {
+        if( ( iBuffered[ i ] != iActiveProvider ) &&
+            ( iBuffered[ i ] != iInitializingProvider ) )
+            {
+            __VTPRINTEXIT( "LocVid.ShareImage.FetchProviderItem" )
+            return iBuffered[ i ];
+            }
+        }
+    __VTPRINTEXIT( "LocVid.ShareImage.FetchProviderItem" )
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::CreateProviderL
+// -----------------------------------------------------------------------------
+void CVtEngLocalVideo::CVtEngShareImage::CreateProviderL(
+    TProviderItem& aProviderItem )
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.CreateProviderL" )
+    iLocalVideo->ReCreateProviderL( aProviderItem, KVtEngProviderShareImage );
+    __VTPRINTEXIT( "LocVid.ShareImage.CreateProviderL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::InitializeProviderL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::InitializeProviderL(
+    TProviderItem& aProviderItem )
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.InitializeProviderL" )
+    if( IsInitializing() )
+        {
+        User::Leave( KErrNotReady );
+        }
+    TPckgBuf< TVSStillImageDataProviderParams > pckg( Parameters() );
+#ifdef _DEBUG
+    RDebug::Print( _L( "LocVid.ShareImage.InitializeProviderL: %S" ),
+        &( pckg().iFileName ) );
+#endif // _DEBUG
+    iLocalVideo->InitializeShareProviderL( aProviderItem, pckg );
+    __VTPRINTEXIT( "LocVid.ShareImage.InitializeProviderL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::DeleteProvider
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::DeleteProvider(
+    TVtEngProviderType aProviderType )
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.DeleteProvider" )
+    TProviderItem* pItem;
+    if ( iLocalVideo->GetProviderByType( aProviderType, pItem )
+         != KErrNotFound )
+        {
+        iLocalVideo->DeleteProvider( *pItem );
+        }
+    __VTPRINTEXIT( "LocVid.ShareImage.DeleteProvider" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::GetObjectSharingState
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::GetObjectSharingState(
+    MVtEngMedia::TShareObjectState& aObjectSharingState ) const
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.GetObjectSharingState" )
+    switch ( iState )
+        {
+        case EStopped:
+            aObjectSharingState = MVtEngMedia::ENotSharing;
+            break;
+
+        case EInitializing:
+            aObjectSharingState = MVtEngMedia::EInitializingShareImage;
+            break;
+
+        case ESharing:
+            aObjectSharingState = MVtEngMedia::ESharingImage;
+            break;
+
+        default:
+            aObjectSharingState = MVtEngMedia::ENotAbleToShare;
+            break;
+        }
+    __VTPRINTEXIT( "LocVid.ShareImage.GetObjectSharingState" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::IsInitializingShare
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::CVtEngShareImage::IsInitializingShare() const
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.IsInitializingShare" )
+    const TBool result( iState == EInitializing );
+    __VTPRINTEXITR( "LocVid.ShareImage.IsInitializingShare %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::SettingsChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::SettingsChanged()
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.SettingsChanged" )
+    iSettingsChanged = ETrue;
+    __VTPRINTEXIT( "LocVid.ShareImage.SettingsChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::ProviderSwitchDone
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::ProviderSwitchDone(
+    CVSDataProvider* aOldProvider )
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.ProviderSwitchDone" )
+    //if ( iState == EStopped )
+        {
+        for ( TInt i = iBuffered.Count() - 1; i >= 0; i-- )
+            {
+            if ( iBuffered[ i ]->iProvider == aOldProvider )
+                {
+                iLocalVideo->DeleteProvider( *iBuffered[ i ] );
+                break;
+                }
+            }
+        }
+    __VTPRINTEXIT( "LocVid.ShareImage.ProviderSwitchDone" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::NotifyCameraChanged
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::NotifyCameraChanged(
+    const TVtEngProviderType& aProviderType )
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.NotifyCameraChanged" )
+    if ( ( iState == EInitializing ) || ( iState == ESharing ) )
+        {
+        iStoredType = aProviderType;
+        }
+    __VTPRINTEXIT( "LocVid.ShareImage.NotifyCameraChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::DeleteProviders
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::DeleteProviders()
+    {
+    __VTPRINTENTER( "LocVid.ShareImage.DeleteProviders" )
+    for ( TInt i = 0; i < iBuffered.Count(); i++ )
+        {
+        iLocalVideo->DeleteProvider( *iBuffered[ i ] );
+        }
+    __VTPRINTEXIT( "LocVid.ShareImage.DeleteProviders" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CVtEngShareImage::CancelInitialize
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CVtEngShareImage::CancelInitialize()
+    {
+    __VTPRINTENTER( "CVtEngLocalVideo.CVtEngShareImage.CancelInitialize");
+    if( iInitializingProvider )
+        {
+        if(iInitializingProvider->iProvider)
+            {
+            __VTPRINT( DEBUG_MEDIA,"iInitializingProvider->iProvider->CancelInitializing()");
+            iInitializingProvider->iProvider->CancelInitializing();
+            }
+        }
+    __VTPRINTEXIT( "CVtEngLocalVideo.CVtEngShareImage.CancelInitialize");
+    }
+// Implementation of CVtEngLocalVideo::TVtEngDelayedSelect
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngDelayedSelect::TVtEngDelayedSelect
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngDelayedSelect::TVtEngDelayedSelect()
+    : iDelayedProviderType( KVtEngProviderUndefined )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngDelayedSelect::NotifyDelayedSelect
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngDelayedSelect::NotifyDelayedSelect(
+    const TVtEngProviderType& aProviderType )
+    {
+    __VTPRINTENTER( "LocVid.DelSel.NotifyDelayedSelect" )
+    iDelayedProviderType = aProviderType;
+    __VTPRINTEXIT( "LocVid.DelSel.NotifyDelayedSelect" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngDelayedSelect::IsDelayedSelectPending
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngDelayedSelect::IsDelayedSelectPending() const
+    {
+    __VTPRINTENTER( "LocVid.DelSel.IsDelayedSelectPending" )
+    const TBool result( iDelayedProviderType != KVtEngProviderUndefined );
+    __VTPRINTEXITR( "LocVid.DelSel.IsDelayedSelectPending %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngDelayedSelect::DelayedSelectTarget
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngProviderType
+CVtEngLocalVideo::TVtEngDelayedSelect::DelayedSelectTarget()
+    {
+    __VTPRINTENTER( "LocVid.DelSel.DelayedSelectTarget" )
+    TVtEngProviderType current( iDelayedProviderType );
+    iDelayedProviderType = KVtEngProviderUndefined;
+    __VTPRINTEXITR( "LocVid.DelSel.DelayedSelectTarget %d", current )
+    return current;
+    }
+
+// Implementation of CVtEngLocalVideo::TVtEngLayoutChangeHandler
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::TVtEngLayoutChangeHandler
+// -----------------------------------------------------------------------------
+//
+CVtEngLocalVideo::TVtEngLayoutChangeHandler::TVtEngLayoutChangeHandler(
+     CVtEngLocalVideo& aLocalVideo )
+    : iLocalVideo( &aLocalVideo ), iState( EIdle ),
+      iStored( KVtEngProviderUndefined )
+    {
+    __VTPRINTEXIT( "LocVid.LayoutCH.Ctor" )
+    __VTPRINTEXIT( "LocVid.LayoutCH.Ctor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::UnfreezeL
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngLayoutChangeHandler::UnfreezeL()
+    {
+    TBool result( EFalse );
+    __VTPRINTENTER( "LocVid.LayoutCH.UnfreezeL" )
+    if ( iState == ELayoutChangePending )
+        {
+        result = ETrue;
+        DoHandleLayoutChangeL();
+        }
+    __VTPRINTEXITR( "LocVid.LayoutCH.UnfreezeL %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::HandleLayoutChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::HandleLayoutChangeL()
+    {
+    __VTPRINTENTER( "LocVid.LayoutCH.HandleLayoutChangeL" )
+    TInt error( KErrNone );
+    if ( iState != EIdle )
+        {
+        if ( iState == ELayoutChangePending )
+            {
+            __VTPRINT( DEBUG_MEDIA,
+                "LocVid.LayoutCH.HandleLayoutChangeL PENDING" )
+            }
+        else
+            {
+            __VTPRINT( DEBUG_MEDIA,
+                "LocVid.LayoutCH.HandleLayoutChangeL NOT ready" )
+            error = KErrNotReady;
+            }
+        CompleteOperation( error );
+        }
+    else
+        {
+        // Only do reinitialize if camera is active source
+        if ( iLocalVideo->GetMediaSource() == MVtEngMedia::EMediaCamera &&
+             !iLocalVideo->IsDelayedSelectPending() )
+            {
+            if ( !iLocalVideo->IsFrozen() )
+                {
+                __VTPRINT( DEBUG_MEDIA,
+                    "LocVid.LayoutCH.HandleLayoutChangeL camera active, reinitialize" )
+                DoHandleLayoutChangeL();
+                }
+            else
+                {
+                iState = ELayoutChangePending;
+                __VTPRINT( DEBUG_MEDIA,
+                    "LocVid.LayoutCH.HandleLayoutChangeL flag set, frozen" )
+                CompleteOperation( error );
+                }
+            }
+        else
+            {
+            __VTPRINT( DEBUG_MEDIA,
+                "LocVid.LayoutCH.HandleLayoutChangeL no op, camera is not active" )
+            CompleteL( error );
+            }
+        }
+    __VTPRINTEXITR( "LocVid.LayoutCH.HandleLayoutChangeL %d", error )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::CancelHandleLayoutChange
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::CancelHandleLayoutChange()
+    {
+    __VTPRINTENTER( "LocVid.LayoutCH.CancelHandleLayoutChange" )
+    if ( iState == ELayoutChangePending )
+        {
+        iState = EIdle;
+        }
+    __VTPRINTEXITR( "LocVid.LayoutCH.CancelHandleLayoutChange iState = %d",
+        iState )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::DoHandleLayoutChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::DoHandleLayoutChangeL()
+    {
+    __VTPRINTENTER( "LocVid.LayoutCH.DoHandleLayoutChangeL" )
+    iStored = iLocalVideo->ActiveProvider();
+    iState = ESwitchingBlank;
+    TVtEngProviderType providerType( KVtEngProviderNone );
+    // Use user defined image, if available
+    if ( CVtEngUtility::Settings().IsDefaultStillImageDefined() )
+        {
+        providerType = KVtEngProviderDefaultStillImage;
+        }
+    iLocalVideo->SelectSourceL( providerType );
+    __VTPRINTEXIT( "LocVid.LayoutCH.DoHandleLayoutChangeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::Complete
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngLocalVideo::TVtEngLayoutChangeHandler::Complete( const TInt aError )
+    {
+    __VTPRINTENTER( "LocVid.LayoutCH.Complete" )
+    TRAPD( error, CompleteL( aError ) );
+    __VTPRINTEXITR( "LocVid.LayoutCH.Complete %d", error )
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::CompleteL
+// Resets internal state and completes asynchronous operation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::CompleteL( const TInt aError )
+    {
+    __VTPRINTENTER( "LocVid.LayoutCH.CompleteL" )
+    iStored = KVtEngProviderUndefined;
+    iState = EIdle;
+    CompleteOperation( aError );
+    __VTPRINTEXIT( "LocVid.LayoutCH.CompleteL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::CompleteOperation
+// Completes asynchronous operation.
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::TVtEngLayoutChangeHandler::CompleteOperation(
+    const TInt aError )
+    {
+    __VTPRINTENTER( "LocVid.LayoutCH.CompleteOperation" )
+    iLocalVideo->CompleteOperation( aError );
+    __VTPRINTEXIT( "LocVid.LayoutCH.CompleteOperation" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderError
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderError( TInt aError )
+    {
+    TBool handled( EFalse );
+    __VTPRINTENTER( "LocVid.LayoutCH.ProviderError" )
+    if ( iState != EIdle && iState != ELayoutChangePending )
+        {
+        handled = ETrue;
+        Complete( aError );
+        }
+    __VTPRINTEXITR( "LocVid.LayoutCH.ProviderError %d", handled )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderReady
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderReady()
+    {
+    TBool handled( EFalse );
+    __VTPRINTENTER( "LocVid.LayoutCH.ProviderReady" )
+    switch ( iState )
+        {
+    case ESwitchingCamera:
+    case EIdle:
+        break;
+
+    case EInitializingCamera:
+        handled = ETrue;
+        iState = ESwitchingCamera;
+        TRAPD( error, iLocalVideo->SelectSourceL( iStored ) );
+        if ( error )
+            {
+            Complete( error );
+            }
+        break;
+
+    case ESwitchingBlank:
+        handled = ETrue;
+        break;
+        }
+    __VTPRINTEXITR( "LocVid.LayoutCH.ProviderReady %d", handled )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderSwitchDone
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngLocalVideo::TVtEngLayoutChangeHandler::ProviderSwitchDone(
+    CVSDataProvider* aOldProvider )
+    {
+    TBool handled( EFalse );
+    __VTPRINTENTER( "LocVid.LayoutCH.ProviderSwitchDone" )
+    switch ( iState )
+        {
+    case EIdle:
+        // nothing to do
+        break;
+
+    case ESwitchingBlank:
+        {
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVid.LayoutCH.ProviderSwitchDone ESwitchingBlank" )
+        handled = ETrue;
+        iState = EInitializingCamera;
+        TProviderItem* providerItem;
+        const TInt result(
+            iLocalVideo->GetProviderByInstance( aOldProvider, providerItem ) );
+        if ( result != KErrNotFound )
+            {
+            iLocalVideo->DeleteProvider( *providerItem );
+            iLocalVideo->iCameraPref->SetProvider( NULL,
+                    *iLocalVideo->iActiveProvider );
+
+            __VTPRINT( DEBUG_MEDIA,
+                "LocVid.LayoutCH.ProviderSwitchDone initializing provider" )
+
+            TRAPD( error, iLocalVideo->InitializeProviderL( *providerItem ) );
+
+            if ( error )
+                {
+                __VTPRINT2( DEBUG_MEDIA,
+                    "LocVid.LayoutCH.ProviderSwitchDone ERROR %d in initialize",
+                    error )
+                Complete( error );
+                }
+            }
+        else
+            {
+            __VTPRINT( DEBUG_MEDIA,
+                "LocVid.LayoutCH.ProviderSwitchDone provider NOT found" )
+            Complete( result );
+            }
+        }
+        break;
+
+    case EInitializingCamera:
+        handled = ETrue;
+        break;
+
+    case ESwitchingCamera:
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVid.LayoutCH.ProviderSwitchDone ESwitchingCamera" )
+        TRAP_IGNORE( iLocalVideo->StartViewFinderIfWasStartedL() );
+        //Re-Set provider to camera preference. Otherwise, after layout change, the provider in camera preference will be invalid
+        iLocalVideo->iCameraPref->SetProvider( iLocalVideo->iActiveProvider->iProvider,
+                    *iLocalVideo->iActiveProvider );
+        handled = ETrue;
+        __VTPRINT( DEBUG_MEDIA,
+            "LocVid.LayoutCH.ProviderSwitchDone reinit done" )
+        Complete( KErrNone );
+        break;
+        }
+    __VTPRINTEXITR( "LocVid.LayoutCH.ProviderSwitchDone %d", handled )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CreateCameraPreferencesL
+// -----------------------------------------------------------------------------
+//
+CVtEngCameraPreferences* CVtEngLocalVideo::CreateCameraPreferencesL()
+    {
+	__VTPRINTENTER( "LocVid.CreateCameraPreferencesL" )
+    iCameraPref = CVtEngCameraPreferences::NewL();
+
+	// Check if provider exist and set it
+	// as provider to camera preferences
+    if ( iActiveProvider )
+    	{
+    	__VTPRINT( DEBUG_MEDIA,
+    	"LocVideo.CreateCameraPreferencesL SetProvider" )
+    	iCameraPref->SetProvider( iActiveProvider->iProvider,
+    	    *iActiveProvider );
+    	}
+
+    __VTPRINTEXIT( "LocVid.CreateCameraPreferencesL" )
+	return iCameraPref;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngLocalVideo::CancelInitializeShareImage
+// -----------------------------------------------------------------------------
+//
+void CVtEngLocalVideo::CancelInitializeShareImage()
+    {
+    __VTPRINTENTER( "CVtEngLocalVideo.CancelInitializeShareImage");
+    iShareImage->CancelInitialize();
+    __VTPRINTEXIT( "CVtEngLocalVideo.CancelInitializeShareImage");
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngMediaHandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,4580 @@
+/*
+* Copyright (c) 2004-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:  Implementation of video session interface.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngMediaHandler.h"
+#include    "CVtEngLocalVideo.h"
+#include    "CVtEngRemoteVideo.h"
+#include    "MVtEngFrameObserver.h"
+#include    "CVtEngStateManager.h"
+#include    "CVtEngOperation.h"
+#include    "TVtEngRendering.h"
+#include    "TVtEngRenderingDSA.h"
+#include    "TVtEngRenderingDP.h"
+#include    "TVtEngRenderingNGA.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngInitializer.h"
+#include    "CVtEngEventManager.h"
+#include    "CVtEngSettings.h"
+#include    "CVtEngHandlerContainer.h"
+#include    "MVtEngDtmfHandler.h"
+#include    "cvtengmdtrcommandsender.h"
+#include    "VtEngPanic.h"
+#include    <sysutil.h>
+#include    <cvtlogger.h>
+#include    <mvtprotocolhandler.h>
+#include    <e32des8.h>
+#include    <videotelephonyvariant.hrh>
+#include    <es_sock.h> // BigEndian
+
+#include    <mvtengcamerapreferences.h>
+#include    "cvtengrecord2file.h"
+
+// MACROS
+#ifdef VTDEBUG
+// In debug mode sinks and sources are not necessarily added.
+#define ADD_VIDEO_SINK { \
+    if ( DEBUG_CFG_NO_VIDEO_SINK == 0 )  { AddVideoSink(); } }
+#define ADD_VIDEO_SOURCE { \
+    if ( DEBUG_CFG_NO_VIDEO_SOURCE == 0 )  { AddVideoSource(); } }
+#define ADD_AUDIO_SOURCE \
+    { if ( DEBUG_CFG_NO_AUDIO_SOURCE == 0 )  { AddAudioSource(); } }
+#define ADD_AUDIO_SINK \
+    { if ( DEBUG_CFG_NO_AUDIO_SINK == 0 )  { AddAudioSink(); } }
+#else
+// In release mode they are added.
+#define ADD_VIDEO_SINK AddVideoSink();
+#define ADD_VIDEO_SOURCE AddVideoSource();
+#define ADD_AUDIO_SOURCE AddAudioSource();
+#define ADD_AUDIO_SINK AddAudioSink();
+#endif // VTDEBUG
+
+// CONSTANTS
+const TInt KVtEngOperationArraySize     = 2;
+// System version string buffer length.
+const TInt KVtEngSwVersionTextLength    = KSysUtilVersionTextLength;
+// Country code for version information.
+const TUint8 KVtEngCountryCodeForProto     = 60;
+// Extension code for version information (unknown).
+const TUint8 KVtEngExtensionForProto       = 0;
+// Manufacturer code for version information (unknown).
+const TUint32 KVtEngManufacturerForProto   = 0;
+// Timer to detect too long disconnect.
+const TInt KVtEngDisconnectionTimer = 20000000;
+// Space character constant.
+const TText KVtEngCharacterSpace( ' ' );
+// New line (\n) character constant.
+const TInt KVtEngCharacterEndLine( 10 );
+
+// Multiplex delay in milliseconds
+const TInt KVtEngMultiplexingDelay = 150;
+
+// TradeOff values
+const TInt KVtEngTradeOffDetailMax = 9;
+const TInt KVtEngTradeOffNormalMax = 19;
+const TInt KVtEngTradeOffMotionMax = 31;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CVtEngMediaHandler
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::CVtEngMediaHandler() :
+    iProtoState( MVtProtocolCommand::EIdle ),
+    iAudioCtrl(0),
+    iProtoMaxVolume(0),
+    iTempProviderInfo( CVtEngLocalVideo::KVtEngProviderNone ),
+    iH324Config( 0 ),
+    iH263Encoder( 0 )
+    {
+    if ( CVtEngUtility::Settings().IsDefaultStillImageDefined() )
+        {
+        iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderDefaultStillImage;
+        }
+
+    // Check is AMR-WB supported or not in platform. Adjusted using local
+    // variation.
+    if ( CVtEngUtility::Settings().CheckBits( KVTLVFlagEnableAMR_WB ) )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++ AMR-WB set ON" )
+        iSdkInitInfo.iAMRWBOn = ETrue;
+        }
+    else
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++ AMR-WB set OFF" )
+        iSdkInitInfo.iAMRWBOn = EFalse;
+        }
+        
+    if ( CVtEngUtility::Settings().CheckBits( KVTLVFlagDisableMpeg4 ) )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++ Mpeg4  set OFF" )
+        iSdkInitInfo.iDisableMpeg4 = ETrue;        
+        }
+    else
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++ Mpeg4  set ON" )
+        iSdkInitInfo.iDisableMpeg4 = EFalse;
+        }
+
+    __VTPRINT( DEBUG_MEDIA | DEBUG_CONSTRUCT, "MH.c++" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ConstructL()
+    {
+    __VTPRINTENTER( "MH.ConstructL" )
+
+    iAsyncCallback = CIdle::NewL( CActive::EPriorityHigh );
+    iPendingOps = new ( ELeave)
+        CArrayFixFlat<TCmdOpPair>( KVtEngOperationArraySize );
+    iPendingOps->SetReserveL( KVtEngOperationArraySize );
+    
+    __VTPRINT2( DEBUG_MEDIA, "DebugFlags used are %d", CVtLogger::Flags() )
+
+    iLocalVideo = CVtEngLocalVideo::NewL( *this );
+    __VTPRINTEXIT( "MH.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler* CVtEngMediaHandler::NewL()
+    {
+    CVtEngMediaHandler* self = new( ELeave )CVtEngMediaHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::~CVtEngMediaHandler
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::~CVtEngMediaHandler()
+    {
+    __VTPRINTENTER( "MH.~" )
+    if ( iPendingOps )
+        {
+        iPendingOps->Reset(); // Make sure this is empty
+        delete iPendingOps;
+        }
+    delete iPendingOp;
+    delete iTimer;
+    delete iAsyncCallback;
+    delete iLocalVideo;
+    delete iRemoteVideo;
+    __VTPRINTEXIT( "MH.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetMediaState
+// Returns media state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetMediaState(
+    const TMediaDirection aMediaDirection,
+    TInt& aActiveMedia ) const
+    {
+    __VTPRINT2( DEBUG_MEDIA, "MH.GetMediaState direction=%d", aMediaDirection )
+    aActiveMedia = 0;
+    switch ( aMediaDirection )
+        {
+        case EMediaOutgoing:
+            {
+            const TInt result( iLocalVideo->GetMediaState( aActiveMedia ) );
+            if ( !IsFlag( EOutVideoChannelClosed ) )
+                {
+                aActiveMedia |= EMediaVideoChannelOpen;
+                }
+            if ( !IsFlag( EOutAudioChannelClosed ) )
+                {
+                aActiveMedia |= EMediaAudioChannelOpen;
+                }
+            return result;
+            }
+
+        case EMediaIncoming:
+            aActiveMedia = iRemoteMediaState;
+            if ( ( iRemoteVideo && !iRemoteVideo->GetDsaState() ) )
+                {
+                aActiveMedia &= (~EMediaVideo);
+                }
+            __VTPRINT2( DEBUG_MEDIA, "MH.remoteState=%d", aActiveMedia )
+            return KErrNone;
+
+        default:
+            break;
+        }
+    return KErrNotSupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RenderingStarted
+// Returns the state of video.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::RenderingStarted(
+    const TMediaDirection aDirection ) const
+    {
+    __VTPRINT2( DEBUG_MEDIA, "MH.RS %d", aDirection )
+    TBool started( EFalse );
+    if( aDirection == EMediaOutgoing )
+        {
+        started = iLocalVideo->ViewFinderStarted();
+        }
+    else // EMediaIncoming
+        {
+        started = iRemoteVideo->GetDsaState();
+        }
+
+    __VTPRINT2( DEBUG_MEDIA, "MH.RS started %d", started )
+    return started;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetSource
+// Returns active source.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetSource( TMediaSource& aSource ) const
+    {
+    TInt err( KErrNotReady );
+    if ( iLocalVideo )
+        {
+        aSource = iLocalVideo->GetMediaSource();
+        err = KErrNone;
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetSourcesCaps
+// Returns source selection capabilities.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetSourcesCaps( TInt& aCaps ) const
+    {
+    TInt err( KErrNotReady );
+    if ( iLocalVideo )
+        {
+        err = iLocalVideo->GetSourceCaps( aCaps );
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetCurrentCameraId
+// Returns current camera.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetCurrentCameraId( TCameraId& aId ) const
+    {
+    __VTPRINT( DEBUG_GEN, "MH.GetCurrentCameraId")
+    aId = iSelectedCameraId;
+    TInt err( KErrNotReady );
+
+    TBool initialized( EFalse );
+    err = iLocalVideo->IsInitialized( aId, initialized );
+    if ( !initialized && ( err != KErrInUse ) )
+        {
+        __VTPRINT2( DEBUG_GEN, "MH.GetCurrentCameraId err=%d", KErrNotReady )
+        return KErrNotReady;
+        }
+    __VTPRINT2( DEBUG_GEN, "MH.GetCurrentCameraId initialized err=%d", err )
+    return err;//Not initialized
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetCameraInfo
+// Returns camera information.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetCameraInfo(
+    const TCameraId aId, TCameraInfo& aInfo ) const
+    {
+    return iLocalVideo->GetCameraInfo( aId, aInfo );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetCurrentZoomStep
+// Returns current zooming.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetCurrentZoomStep( TInt& aCurrentStep )
+    {
+    return iLocalVideo->GetDigitalZoomFactor( aCurrentStep );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetMaxZoomStep
+// Returns maximum zooming.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetMaxZoomStep( TInt& aMaxZoomStep )
+    {
+    return iLocalVideo->GetMaxDigitalZoomStep( aMaxZoomStep );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetMajorZoomStepCount
+// Gets number of major zoom level leaps.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetMajorZoomStepCount( TInt& aCount )
+    {
+    return iLocalVideo->GetMajorDigitalZoomStepCount( aCount );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetMajorZoomStep
+// Maps major zoom leap step to corresponding step index.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::GetMajorZoomStep( TInt aIndex, TInt& aStep )
+    {
+    if ( iLocalVideo )
+        {
+        iLocalVideo->GetMajorDigitalZoomStep( aIndex, aStep );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetFreezeSupported
+// Maps major zoom leap step to corresponding step index.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetFreezeSupported( TBool& aFreezeSupported) const
+    {
+    if ( iLocalVideo )
+        {
+        return iLocalVideo->GetFreezeSupported( aFreezeSupported );
+        }
+    return KErrNotReady;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetFreezeState
+// Returns KErrNotReady if provider is not ready yet. If KErrNone is returned
+// then aFrozen will be ETrue if the provider is frozen, EFalse otherwise.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetFreezeState( TBool& aFrozen ) const
+    {
+    if ( iLocalVideo )
+        {
+        aFrozen = iLocalVideo->IsFrozen();
+        return KErrNone;
+        }
+    return KErrNotReady;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetDsaState
+// Returns media state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::GetDsaState(
+    const TMediaDirection aMediaDirection,
+    TBool& aActive ) const
+    {
+    if ( !iRemoteVideo )
+        {
+        return KErrNotReady;
+        }
+    switch ( aMediaDirection )
+        {
+        case EMediaOutgoing:
+            break;
+        case EMediaIncoming:
+            aActive = iRemoteVideo->GetDsaState();
+            return KErrNone;
+        default:
+            break;
+        }
+    return KErrNotSupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::VideoCallConnected
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::VideoCallConnected () const
+	  {
+    TBool connected = EFalse;
+    if ( MVtProtocolCommand::EConnected == iProtoState )
+        {
+    	  connected = ETrue;
+        }
+    return connected;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetVideoQuality
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::GetVideoQuality( TVideoQuality& aVideoQuality ) const
+    {
+    __VTPRINTENTER( "MH.GetVideoQuality" )
+    aVideoQuality = iVideoQuality.VideoQuality();
+    __VTPRINTEXIT( "MH.GetVideoQuality" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetObjectSharingState
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::GetObjectSharingState(
+    TShareObjectState& aObjectSharingState ) const
+    {
+    __VTPRINTENTER( "MH.GetObjectSharingState" )
+    if( iProtoState == MVtProtocolCommand::EConnected )
+        {
+        iLocalVideo->GetObjectSharingState( aObjectSharingState );
+        }
+    else
+        {
+        aObjectSharingState = ENotAbleToShare;
+        }
+    __VTPRINTEXIT( "MH.GetObjectSharingState" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetCameraOrientations
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::GetCameraOrientations(
+    TCameraOrientation& aPrimaryCameraOrientation,
+    TCameraOrientation& aSecondaryCameraOrientation ) const
+    {
+    __VTPRINTENTER( "MH.GetCameraOrientations" )
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+    settings.GetCameraOrientations( aPrimaryCameraOrientation,
+        aSecondaryCameraOrientation );
+    __VTPRINTEXIT( "MH.GetCameraOrientations" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RequestLastRemoteFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::RequestLastRemoteFrame( )
+    {
+    __VTPRINTENTER( "MH.RequestLastRemoteFrame" )    
+    if( iRemoteVideo )
+        iRemoteVideo->RequestLastFrame();    
+    __VTPRINTEXIT( "MH.RequestLastRemoteFrame" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ValidateCommand
+// Checks if command is valid in current proto state.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::ValidateCommand( const TVtEngCommandId aCommand ) const
+    {
+    __VTPRINTENTER( "MH.ValidateCommand" )
+    __VTPRINT2( DEBUG_MEDIA, "MH.ValidateCommand cmd=%d", aCommand )
+    TInt okToPerform( KErrNotReady );
+    if ( iInitialized )
+        {
+        switch ( aCommand )
+            {
+            case KVtEngMuteOutgoingAudio:
+            case KVtEngUnmuteOutgoingAudio:
+                // mute/unmute not possible if audio channel closed.
+                if ( IsFlag( EOutAudioChannelClosed ) ) {
+                    break;
+                }
+            case KVtEngSetAudioRouting:
+            case KVtEngSetAudioVolume:
+                if ( ( iProtoState == MVtProtocolCommand::EConnected ) && !iPendingOp )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                break;            
+            case KVtEngIncreaseAudioVolume:
+            case KVtEngDecreaseAudioVolume:
+
+                if ( iProtoState == MVtProtocolCommand::EConnected )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                break;
+            case KVtEngRequestLastRemoteFrame:            
+                if ( iProtoState == MVtProtocolCommand::EConnected )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                break;
+            case KVtEngPrepareViewFinder:
+            case KVtEngPrepareViewFinderDSA:
+            case KVtEngPrepareRemoteRenderDSA:
+            case KVtEngPrepareViewFinderDP:
+            case KVtEngPrepareRemoteRenderDP:
+            case KVtEngPrepareRemoteRenderNGA:
+                okToPerform = KErrNone; // can be done any time
+                break;
+
+            case KVtEngHandleLayoutChange:
+                if ( iLocalVideo && iLocalVideo->ActiveProvider() !=
+                        CVtEngLocalVideo::KVtEngProviderNone  && !iPendingOp )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                break;
+
+            case KVtEngSetZoomStep:
+                {
+                const CVtEngLocalVideo::TVtEngProviderType
+                    activeProvider( iLocalVideo->ActiveProvider() );
+                if ( iRequestStatus == NULL &&
+                     iVSInitState == EInitStateNone &&
+                     ( activeProvider == CVtEngLocalVideo::KVtEngProviderCam1 ||
+                     activeProvider == CVtEngLocalVideo::KVtEngProviderCam2 ) )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                }
+                break;
+            case KVtEngSetSource:
+                if ( !IsFlag( EOutVideoChannelClosed ) )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                // when EOutVideoChannelClosed is active
+                // don't allow source switch because it may require
+                // pause or resume on Protocol which would fail when video
+                // channel is closed.
+                // Note1: this is especially for the case when channel is
+                // closed after being already open.
+                // Note2: it must be possible to set source already before Protocol
+                // is connected (in MONA calls) so Proto state check is not done.
+                 break;
+            case KVtEngPrepareCamera:
+            case KVtEngStartViewFinder:
+            case KVtEngFreeze:
+            case KVtEngUnfreeze:
+                if ( iRequestStatus == NULL &&
+                     // If initialising or change provider during reset then
+                     // not allowed
+                     iVSInitState == EInitStateNone &&
+                     // If terminate ongoing then not allowed
+                     iProtoState != MVtProtocolCommand::EIdle )
+                    {
+                    okToPerform = KErrNone;
+                    if( aCommand == KVtEngFreeze )
+                        {
+                        if( !iLocalVideo->OkToFreeze() )
+                            {
+                            okToPerform = KErrNotReady;
+                            }
+                        }
+                    else if( aCommand == KVtEngUnfreeze )
+                        {
+                        if( !iLocalVideo->OkToUnfreeze() )
+                            {
+                            okToPerform = KErrNotReady;
+                            }
+                        }
+                   }
+                break;
+            case KVtEngSetVideoQuality:
+                if( IsPending( ESetVideoQuality ) != KErrNotFound )
+                    {
+                    okToPerform = KErrNotReady;
+                    }
+                else
+                    {
+                    if ( iRequestStatus == NULL && iProtoState != MVtProtocolCommand::EIdle )
+                        {
+                        okToPerform = KErrNone;
+                        }
+                    }
+                break;
+
+            case KVtEngInitializeShareImage:
+                {
+                TShareObjectState objectSharingState;
+                GetObjectSharingState( objectSharingState );
+                if ( ( objectSharingState != ENotAbleToShare ) &&
+                    ( objectSharingState != EInitializingShareImage ) &&
+                    !IsFlag( EOutVideoChannelClosed ) )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                }
+                break;
+
+            case KVtEngStartShareImage:
+                {
+                TShareObjectState objectSharingState;
+                GetObjectSharingState( objectSharingState );
+                if( objectSharingState != ENotAbleToShare )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                }
+                break;
+
+            case KVtEngStopShareImage:
+                {
+                TShareObjectState objectSharingState;
+                GetObjectSharingState( objectSharingState );
+                if ( ( objectSharingState == ESharingImage ) &&
+                    !IsFlag( EOutVideoChannelClosed ) )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                }
+                break;
+
+            case KVtEngTerminateSession:
+                if ( iProtoState == MVtProtocolCommand::EConnected ||
+                     iProtoState == MVtProtocolCommand::EConnecting )
+                    {
+                    okToPerform = KErrNone;
+                    }
+                break;
+
+            default:
+                okToPerform= KErrNotSupported;
+                break;
+            }
+        }
+    __VTPRINT2( DEBUG_MEDIA, "MH.ValidateCommand okToPerform=%d", okToPerform )
+    __VTPRINTEXIT( "MH.ValidateCommand" )
+    return okToPerform;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::IsVideoChannelClosed
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::IsVideoChannelClosed() const
+    {
+    __VTPRINTENTER( "MH.IsVideoChannelClosed" )
+    const TBool result( IsFlag( EOutVideoChannelClosed ) );
+    __VTPRINTEXITR( "MH.IsVideoChannelClosed %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleL
+// Handles a request.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleL( CVtEngOperation& aOperation )
+    {
+    __VTPRINTENTER( "MH.HandleL" )
+
+    const TVtEngCommandId id( aOperation.Command() );
+    if ( !iInitialized )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.Handle not ready" )
+        User::Leave( KErrNotReady );
+        }
+    __VTPRINT2( DEBUG_MEDIA, "MH.Handle cmdId=%d", id )
+    switch ( id )
+        {
+        case KVtEngSetUIForeground:
+            TBool foregroundValue;
+            TVtEngOpParamUtil<TBool>::Set( foregroundValue, aOperation );
+            if( iLocalVideo )
+                {
+                iLocalVideo->SetUIForeground( foregroundValue );
+                }
+            if( iRemoteVideo )
+                {
+                iRemoteVideo->SetUIForegroundL( foregroundValue );
+                }
+            break;
+
+        case KVtEngSetAudioVolume:
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH.Handle.Vol" )
+            MVtEngAudio::TVtEngOutputVolume volSetting;
+            TVtEngOpParamUtil<MVtEngAudio::TVtEngOutputVolume>::Set(
+                volSetting, aOperation );
+
+            // Store volume.
+            CVtEngSettings& settings = CVtEngUtility::Settings();
+            settings.SetVolume(
+                volSetting.iHandsetVolume,
+                volSetting.iHandsfreeVolume,
+                ETrue );
+            settings.SetVolume(
+                volSetting.iHandsetVolume,
+                volSetting.iHandsfreeVolume,
+                EFalse );
+
+            // Update volume.
+            iPendingVolumeOp = &aOperation;
+            AssignPendingOp( aOperation );
+            UpdateVolume();
+
+            if ( IsPending( ESetAudioVolume ) == KErrNotFound )
+                {
+                // No volume operation ongoing. Need to complete operation by itself.
+                AsyncCompleteOp();
+                }
+            }
+            break;
+
+        case KVtEngIncreaseAudioVolume:
+            {
+            CVtEngAudioHandler& audioHandler(
+                static_cast< CVtEngAudioHandler& >(
+                    CVtEngUtility::StateManager()->Handlers().Audio() ) );
+            if ( audioHandler.IncreaseVolume() )
+                {
+                UpdateVolume();
+                }
+            }
+            break;
+
+        case KVtEngDecreaseAudioVolume:
+            {
+            CVtEngAudioHandler& audioHandler(
+                static_cast< CVtEngAudioHandler& >(
+                    CVtEngUtility::StateManager()->Handlers().Audio() ) );
+            if ( audioHandler.DecreaseVolume() )
+                {
+                UpdateVolume();
+                }
+            }
+            break;
+
+        case KVtEngMuteOutgoingAudio:
+            {
+            // No Local video if not on target
+#if !defined( __WINS__ )
+            AddOperation( EMuteAudio,
+                iSessionCommand->PauseAudioL( *iLocalVideo->AudioSource()) );
+#endif // !WINS
+            AssignPendingOp( aOperation );
+            }
+            break;
+        case KVtEngUnmuteOutgoingAudio:
+            {
+            // No Local video if not on target
+#if !defined( __WINS__ )
+            AddOperation ( EUnmuteAudio,
+                iSessionCommand->ResumeAudioL( *iLocalVideo->AudioSource() ) );
+#endif // !WINS
+            AssignPendingOp( aOperation );
+            }
+            break;
+        case KVtEngPrepareViewFinder:
+            {
+            const TPckgC<TVtEngRenderingOptions>& pckg =
+                static_cast< const TPckgC<TVtEngRenderingOptions>& >
+                ( *aOperation.Parameters() );
+            const TVtEngRenderingOptions& options = pckg();
+            iLocalVideo->SetViewFinderParameters( options );
+            }
+            break;
+        case KVtEngPrepareRemoteRenderNGA:
+            {
+            const TPckgC<TVtEngRenderingOptionsNGA>& pckg =
+                static_cast< const TPckgC<TVtEngRenderingOptionsNGA>& >
+                ( *aOperation.Parameters() );
+            const TVtEngRenderingOptionsNGA& options = pckg();
+             iRemoteVideo->SetRenderingParametersL( options );     
+            }
+            break;
+        case KVtEngPrepareViewFinderDSA:
+        case KVtEngPrepareRemoteRenderDSA:
+            {
+            const TPckgC<TVtEngRenderingOptionsDSA>& pckg =
+                static_cast< const TPckgC<TVtEngRenderingOptionsDSA>& >
+                ( *aOperation.Parameters() );
+            const TVtEngRenderingOptionsDSA& options = pckg();
+            if ( id == KVtEngPrepareViewFinderDSA )
+                {
+                iLocalVideo->SetViewFinderParameters( options );
+                }
+            else if ( iRemoteVideo )
+                {
+                iRemoteVideo->SetRenderingParametersL( options );
+                }
+            }
+            break;
+
+        case KVtEngPrepareViewFinderDP:
+        case KVtEngPrepareRemoteRenderDP:
+            {
+            const TPckgC<TVtEngRenderingOptionsDP>& pckg =
+                static_cast< const TPckgC<TVtEngRenderingOptionsDP>& >
+                ( *aOperation.Parameters() );
+            const TVtEngRenderingOptionsDP& options = pckg();
+            if ( id == KVtEngPrepareViewFinderDP )
+                {
+                iLocalVideo->SetViewFinderParameters( options );
+                }
+            else if ( iRemoteVideo )
+                {
+                iRemoteVideo->SetRenderingParametersL( options );
+                }
+            }
+            break;
+
+        case KVtEngHandleLayoutChange:
+            iLocalVideo->HandleLayoutChangeL();
+            AssignPendingOp( aOperation );
+            break;
+
+        case KVtEngSetSource:
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH.set source" )
+            MVtEngMedia::TMediaSource source;
+            TVtEngOpParamUtil<MVtEngMedia::TMediaSource>::Set( source,
+                aOperation );
+
+            iLocalVideo->InitializeOnly( EFalse );
+            TOperation startedOp( ENone );
+            switch ( source )
+                {
+                case EMediaCamera:
+                    __VTPRINT( DEBUG_MEDIA, "EMediaCamera" )
+                    iTempProviderInfo =
+                    ( iSelectedCameraId == ESecondaryCamera ) ?
+                        CVtEngLocalVideo::KVtEngProviderCam2 :
+                        CVtEngLocalVideo::KVtEngProviderCam1;
+
+                    SetFlag( EProtoContVideoBlankProv );
+                    startedOp = EnableVideoL( ETrue );
+                    if ( startedOp == ENone )
+                        {
+                        // Did nothing
+                        ClearFlag( EProtoContVideoBlankProv );
+                        }
+                    iLocalVideo->ResumeVideoSending();
+                    break;
+                case EMediaCameraPri:
+                    __VTPRINT( DEBUG_MEDIA, "EMediaCameraPri" )
+                    iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderCam1;
+                    iSelectedCameraId = EPrimaryCamera;
+                    ClearFlag( EProtoContVideoBlankProv );
+                    break;
+                case EMediaCameraSec:
+                    __VTPRINT( DEBUG_MEDIA, "EMediaCameraSec" )
+                    iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderCam2;
+                    iSelectedCameraId = ESecondaryCamera;
+                    ClearFlag( EProtoContVideoBlankProv );
+                    break;
+                case EMediaStillImage:
+                    __VTPRINT( DEBUG_MEDIA, "EMediaStillImage" )
+                    iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderImage;
+                    SetFlag( EProtoContVideoBlankProv );
+                    startedOp = EnableVideoL( ETrue );
+                    if ( startedOp == ENone )
+                        {
+                        // Did nothing
+                        ClearFlag( EProtoContVideoBlankProv );
+                        }
+                    break;
+                case EMediaNone:
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "EMediaNone" )
+                    if ( CVtEngUtility::Settings().
+                    	 IsDefaultStillImageDefined() )
+                        {
+                        iTempProviderInfo =
+                        CVtEngLocalVideo::KVtEngProviderDefaultStillImage;
+
+                        SetFlag( EProtoContVideoBlankProv );
+                        startedOp = EnableVideoL( ETrue );
+                        if ( startedOp == ENone )
+                            {
+                            // Did nothing
+                            ClearFlag( EProtoContVideoBlankProv );
+                            }
+                        }
+                    else
+                        {
+                        iTempProviderInfo =
+                        CVtEngLocalVideo::KVtEngProviderNone;
+
+                        ClearFlag( EProtoContVideoBlankProv );
+                        SetFlag( EProtoPauseVideoBlankProv );
+                        if ( !IsFlag(
+                            EProtoVideoSourceAdded ) && iProtoState != MVtProtocolCommand::EConnected )
+                            {
+                            // Set as not enabled video when no sources
+                            __VTPRINT( DEBUG_MEDIA, "MH.set blanked - not ready" )
+                            EnableVideoL( EFalse );
+                            }
+                        else
+                            {
+                            // we have "done" something
+                            startedOp = EDisableVideo;
+                            iLocalVideo->PauseVideoSending();
+                            }
+                        }
+                    break;
+                default:
+                    __VTPRINT( DEBUG_MEDIA, "invalid source" )
+                    User::Leave( KErrArgument );
+                }
+            TBool selectOngoing( EFalse );
+            ClearFlag( ESourceUpdateNeeded );
+            TInt err( KErrNone );
+
+            // Either pausing or switching between still and camera
+            if ( !IsFlag( EProtoContVideoBlankProv ) )
+                {
+                TRAP( err, selectOngoing =
+                    iLocalVideo->SelectSourceL( iTempProviderInfo ) );
+                __VTPRINT3( DEBUG_MEDIA, "     ongoing=%d, op=%d",selectOngoing,
+                    startedOp )
+                }
+
+            if ( ( selectOngoing || IsFlag( EProtoContVideoBlankProv ) ||
+                IsFlag( EProtoContVideoBlankInit ) ) &&
+                startedOp != ENone && err == KErrNone )
+                {
+                // Enabling/disabling video started. Set flag that operation
+                // should be completed only when both callback from Protocol and
+                // local video (switch done) are complete.
+                __VTPRINT( DEBUG_MEDIA, "MH.set source 2stage" )
+                SetFlag( ETwoStageOperation );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            AssignPendingOp( aOperation );
+            }
+            break;
+        case KVtEngPrepareCamera:
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH.prepare cam" )
+            MVtEngMedia::TPrepareCameraParams params;
+            if ( aOperation.Parameters() )
+                {
+                TVtEngOpParamUtil< MVtEngMedia::TPrepareCameraParams >
+                    ::Set( params, aOperation );
+                }
+            else
+                {
+                params.iMediaSource = EMediaCamera;
+                params.iInitialize = ETrue;
+                }
+            CVtEngLocalVideo::TVtEngProviderType
+                type( CVtEngLocalVideo::KVtEngProviderCam1 );
+            switch ( params.iMediaSource )
+                {
+                case EMediaCamera:
+                    type = ( iSelectedCameraId == ESecondaryCamera ) ?
+                    CVtEngLocalVideo::KVtEngProviderCam2 :
+                        CVtEngLocalVideo::KVtEngProviderCam1;
+                    break;
+                case EMediaCameraPri:
+                    iSelectedCameraId = EPrimaryCamera;
+                    type = CVtEngLocalVideo::KVtEngProviderCam1;
+                    break;
+                case EMediaCameraSec:
+                    iSelectedCameraId = ESecondaryCamera;
+                    type = CVtEngLocalVideo::KVtEngProviderCam2;
+                    break;
+                default:
+                    User::Leave( KErrArgument );
+                    break;
+                }
+            iLocalVideo->SetIsPrepareCameraCalled( ETrue );
+            AssignPendingOp( aOperation );
+            if ( params.iInitialize )
+                {
+                __VTPRINT( DEBUG_MEDIA, "MH.prepare cam iInitialize TRUE" )
+                iLocalVideo->InitializeOnly();
+                ClearFlag( ESourceUpdateNeeded );
+                iLocalVideo->SelectSourceL( type );
+                }
+            else
+                {
+                __VTPRINT( DEBUG_MEDIA,
+                    "MH.prepare cam iInitialize FALSE, complete with KErrNone" )
+                AsyncCompleteOp( KErrNone );
+                }
+            }
+            break;
+
+        case KVtEngSetZoomStep:
+            {
+            TInt zoom( 0 );
+            TVtEngOpParamUtil<TInt>::Set( zoom, aOperation );
+            iLocalVideo->SetDigitalZoomFactorL( zoom );
+            }
+            break;
+
+        case KVtEngFreeze:
+            iLocalVideo->FreezeL();
+            break;
+
+        case KVtEngUnfreeze:
+            iLocalVideo->UnfreezeL();
+            AssignPendingOp( aOperation );
+            break;
+
+        case KVtEngStartViewFinder:
+            iLocalVideo->StartViewFinderL( ETrue );
+            break;
+        case KVtEngStopViewFinder:
+            iLocalVideo->StopViewFinder( ETrue );
+            break;
+        case KVtEngStartRenderRemote:
+            iRemoteVideo->StartVideoL();
+            break;
+        case KVtEngStopRenderRemote:
+            iRemoteVideo->StopVideoRendering();
+            break;
+        case KVtEngPauseRenderRemote:
+            iRemoteVideo->PauseVideoL();
+            break;
+        case KVtEngRequestLastRemoteFrame:
+            RequestLastRemoteFrame();
+            break;            
+        case KVtEngTerminateSession:
+            AssignPendingOp( aOperation );
+            break;
+
+        // Set video quality
+        case KVtEngSetVideoQuality:
+            {
+            TVideoQuality videoQuality( EVideoQualityUndefined );
+            TVtEngOpParamUtil< TVideoQuality >::Set( videoQuality, aOperation );
+            SetPeerVideoQuality( videoQuality );
+            }
+            break;
+
+        // Initialize share
+        case KVtEngInitializeShareImage:
+            {
+            TShareObjectImageParameters parameters;
+            TVtEngOpParamUtil< TShareObjectImageParameters >::Set(
+                parameters, aOperation );
+            TBool firstTime = EFalse;
+            iLocalVideo->InitializeShareImageL( parameters, firstTime );
+            AssignPendingOp( aOperation );
+            if ( firstTime )
+                {
+                iVideoAction = IsFlag( EProtoVideoTrackPaused ) ?
+                    EVideoActionEnable : EVideoActionNone;
+                }
+            }
+            break;
+
+        // Start share
+        case KVtEngStartShareImage:
+            iLocalVideo->StartShareImageL();
+            AssignPendingOp( aOperation );
+            break;
+
+        // Stop Image sharing
+        case KVtEngStopShareImage:
+            {
+            // If video sending needs to be paused when sharing is stopped
+            // then do it before doing the actual provider switch. It is
+            // done before hand to prevent dummy frame sending to receiving
+            // end (ie. black frame).
+            const TBool needsPause( iLocalVideo->ShareStoredSource() ==
+                CVtEngLocalVideo::KVtEngProviderNone );
+            if ( needsPause )
+                {
+                // With this flag we prevent premature operation
+                // complete after the pause command has been executed.
+                iPauseNoCompleteOp = ETrue;
+                EnableVideoL( EFalse );
+                }
+            // reset the action flag.
+            iVideoAction = EVideoActionNone;
+            iLocalVideo->StopShareImageL();
+            AssignPendingOp( aOperation );
+            }
+            break;
+
+        default:
+            User::Leave( KErrNotSupported );
+            break;
+        }
+    __VTPRINTEXIT( "MH.HandleL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSessionCommandEventL
+// Handles command completion in protocol engine.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSessionCommandEventL(
+    const TVtCommandResponse& aResponse )
+    {
+    __VTPRINTENTER( "MH.HandleSessionCommandEventL" )
+    const TVtCommandType type( aResponse.iCmdType );
+    if ( type == EVtCommandGetSDKInfo )
+        {
+        // ignore completely
+        __VTPRINTEXIT( "MH.HandleSessionCommandEventL" )
+        return;
+        }
+    const TInt protoCmdId( aResponse.iCmdId );
+    const TInt protoResponse( aResponse.iCmdStatus );
+    TInt event( KVtEngEventNone );
+    __VTPRINT2( DEBUG_MEDIA, "MH.protoComC type=%d", type )
+    __VTPRINT3( DEBUG_MEDIA, "MH.protoComC cmdId=%d,response=%d", protoCmdId, protoResponse )
+
+    CVtEngStateManager* states = CVtEngUtility::StateManager();
+    switch ( type )
+        {
+        case EVtCommandGetProtocolState:
+            break;
+        case EVtCommandInit://PVT_COMMAND_INIT -> ESetup
+            {
+            CVtEngUtility* utils = CVtEngUtility::EngineUtils();
+            iSessionCommand = utils->Initializer().GetSessionCommand();
+            iRemoteVideo = CVtEngRemoteVideo::NewL( *iSessionCommand, *states );
+            iInitialized = ETrue;
+            iProtoState = MVtProtocolCommand::ESetup;
+            __VTPRINT( DEBUG_MEDIA, "MH.protoComC: ESetup" )
+            states->Update();
+
+			// Get interfaces towards H324 and video encoder
+			QueryProtoInterfacesL();
+            }
+            break;
+        case EVtCommandGetProtocolInterface:
+            {
+            __VTPRINT2( DEBUG_MEDIA, "MH.protoComC:IF response=%d", protoCmdId )
+            if ( protoResponse == KErrNone &&
+                 ( iProtoState == MVtProtocolCommand::ESetup ||
+				   iProtoState == MVtProtocolCommand::EInitializing || // Allowed to query when initializing also
+                   iProtoState == MVtProtocolCommand::EConnecting ||
+                   iProtoState == MVtProtocolCommand::EConnected ) )
+                {
+                __ASSERT_DEBUG(
+                    IsPending( EGet324CtrlInterface ) != KErrNotFound
+                    || IsPending( EGetH263EncInterface ) != KErrNotFound,
+                    Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+                    //Check which interface.
+                if ( MatchResponseToPendingOps(
+                    protoCmdId, EGet324CtrlInterface ) && iH324Config )
+                    {
+                    __VTPRINT( DEBUG_MEDIA, "MH.protoComC:324 IF" )
+                    iH324Config->SetObserverL ( this );
+
+					// Create DTMF handler with H324 interface.
+					CVtEngUtility* utils = CVtEngUtility::EngineUtils();
+					TRAP_IGNORE( utils->Initializer().CreateDtmfHandlerL( iH324Config ) );
+
+                    // Set version to protocol -- cannot cause problem
+#ifdef VTDEBUG
+                    TRAPD( err, SetVersionInfoL() );
+                    if ( err != KErrNone )
+                        {
+                        __VTPRINT2( DEBUG_MEDIA,
+                            "MH.protoComC:324 IF VersionInfo failed=%d", err )
+                        }
+#else
+                    TRAP_IGNORE( SetVersionInfoL() );
+#endif
+                    // Set resolutions to Proto.
+                    SetSupportedResolutions();
+
+					// Set Fast options
+					SetFastCsupOptions();
+
+                    SetFlag( EProto324IFAcquired );
+                    RemoveOperation( protoCmdId );
+                    states->Update();
+                    }
+                else if ( MatchResponseToPendingOps(
+                    protoCmdId, EGetH263EncInterface ) )
+                    {
+                    __VTPRINT( DEBUG_MEDIA, "MH.protoComC:IF 263 created" )
+                    iH263Encoder->SetObserverL( this );
+                    RemoveOperation( protoCmdId );
+                    }
+                else
+                    {
+                    // Not supported interface.
+                    __VTPRINT( DEBUG_MEDIA, "MH.protoComC:NOT requested" )
+                    }
+                }
+            else
+                {
+                // failed or not in appropriate state
+                __VTPRINT( DEBUG_MEDIA, "MH.protoComC:query IF fail/incorrect state" )
+                RemoveOperation( protoCmdId );
+                }
+            }
+            break;
+
+        case EVtCommandResume:
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.protoComC Resume" )
+
+            __ASSERT_DEBUG(
+                IsPending( EUnmuteAudio ) != KErrNotFound ||
+                IsPending( EEnableVideo ) != KErrNotFound ||
+                IsPending( EEnableVideoInternal ) != KErrNotFound,
+                Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+            // Was command unmute audio?
+            const TBool audioEnabled(
+                MatchResponseToPendingOps( protoCmdId, EUnmuteAudio ) );
+
+            if ( protoResponse == KErrNone )
+                {
+                if ( audioEnabled )
+                    {
+                    iLocalVideo->UnMute();
+                    event = KVtEngAudioUnmuted;
+                    }
+                else
+                    {
+                    iLocalVideo->ResumeVideoSending();
+                    }
+                }
+
+            // Was command enable video?
+            const TBool videoEnabledByUser(
+                MatchResponseToPendingOps( protoCmdId, EEnableVideo ) );
+
+            RemoveOperation( protoCmdId );
+
+            if ( videoEnabledByUser && IsFlag( ETwoStageOperation ) )
+                {
+                // Two-phase operation (resume + switch, resume completed)
+                __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                    "MH.video Resume 1st stage" )
+                ClearFlag( ETwoStageOperation );
+                ClearFlag( ESourceUpdateNeeded );
+                iLocalVideo->SelectSourceL( iTempProviderInfo );
+                iTempProviderInfo = CVtEngLocalVideo::KVtEngProviderNone;
+                }
+            else if ( videoEnabledByUser || audioEnabled )
+                {
+                __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.video Resume " )
+                CompleteOp( protoResponse );
+                }
+
+            // Do send an intra message
+            if ( IsFlag( EProtoVideoTrackPaused ) )
+                {
+                ClearFlag( EProtoVideoTrackPaused );
+                if ( IsFlag( EProtoSendIntraFrame ) )
+                    {
+                    RequestFrame();
+                    }
+                }
+            }
+            break;
+        case EVtCommandPause: // Audio or video disable
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.protoComC Pause" )
+            __ASSERT_DEBUG( iRequestStatus ||
+                // uninit ongoing, still possible
+                // to receive callback from protocol
+                ( IsPending( EMuteAudio )    != KErrNotFound ||
+                IsPending( EDisableVideo ) != KErrNotFound ),
+                Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+            TBool videoDisabled( EFalse );
+
+            // was command disable audio?
+            if ( MatchResponseToPendingOps( protoCmdId, EMuteAudio ) )
+                {
+                iLocalVideo->Mute();
+                event = KVtEngAudioMuted;
+                }
+            else
+                {
+                // was command disable video?
+                videoDisabled = MatchResponseToPendingOps(
+                    protoCmdId, EDisableVideo );
+                if ( videoDisabled )
+                    {
+                    SetFlag( EProtoVideoTrackPaused );
+                    }
+                }
+            RemoveOperation( protoCmdId );
+            if ( IsFlag( ETwoStageOperation ) && videoDisabled )
+                {
+                __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                    "MH.video pause 1st stage" )
+                // First event out of two that DisableVideo video
+                // is complete (waiting for event from local video).
+
+                if ( !IsPending( EEnableVideo ) )
+                    {
+                    ClearFlag( ETwoStageOperation );
+                    }
+                else
+                    {
+                    // Except if pause was not user originated, i.e
+                    // pause done in the beginning because there is no
+                    // still image to be sent in MT call and video is paused
+                    // (user has not yet allowed video sending).
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                    "MH.video paused, 2stage NOT CLEARED" )
+                    }
+                }
+            else
+                {
+                if ( !iPauseNoCompleteOp )
+                    {
+                    CompleteOp( protoResponse );
+                    }
+                else
+                    {
+                    iPauseNoCompleteOp = EFalse;
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                        "MH.video paused due to share stop, clearing flag" )
+                    }
+                }
+            }
+            break;
+        case EVtCommandAddDataSink:
+            {
+			__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink");
+            if ( protoResponse == KErrNone )
+                {
+                __ASSERT_DEBUG( iRequestStatus ||
+                    // uninit ongoing, still possible
+                    // to receive callback from pv2way
+                    ( IsPending( EAddVideoSink ) != KErrNotFound ||
+                    IsPending( EAddAudioSink ) != KErrNotFound ),
+                    Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+                __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.data sink added" )
+
+                if ( MatchResponseToPendingOps( protoCmdId, EAddVideoSink )
+                        && ( iRemoteMediaState & EMediaVideoPreparing ) )
+                    {
+                    // Video sink added
+                    SetFlag( EProtoVideoSinkAdded );
+                    iRemoteMediaState &= ~EMediaVideoPreparing;
+                    iRemoteMediaState |= EMediaVideo;
+					__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink for VIDEO OK.");
+                    }
+                else if ( MatchResponseToPendingOps( protoCmdId, EAddAudioSink )
+                            && ( iRemoteMediaState & EMediaAudioPreparing ) )
+                    {
+                    // Audio sink added
+                    SetFlag( EProtoAudioSinkAdded );
+                    iRemoteMediaState &= ~EMediaAudioPreparing;
+                    iRemoteMediaState |= EMediaAudio;
+					__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink for AUDIO OK.");
+                    // DevSound created in Proto => temporary devSound needed
+                    // for making audio routing work can be released now.
+                    CVtEngStateManager* stateManager =
+                        CVtEngUtility::StateManager();
+                    CVtEngAudioHandler& audioHandler =
+                        static_cast< CVtEngAudioHandler& >(
+                            stateManager->Handlers().Audio() );
+                    audioHandler.SetRoutingEnablerL( EFalse );
+                    RequestAudioControllerL();
+                    }
+                else
+                    {
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.protoComC invalid" )
+                    Panic( EVtEngPanicMediaHandlerOpStateFailure );
+                    }
+                }
+			else
+				{
+				__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink FAILED");
+
+				if ( MatchResponseToPendingOps( protoCmdId, EAddVideoSink ) )
+					{
+					__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink FAILED, INCOMING VIDEO");
+
+					iVideoIncomingLogicalChannel.iSameTypeClosingPending = EFalse;
+					if( iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen )
+						{
+						iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding VIDEO, ADDing SINK" )
+						AddVideoSink( iVideoIncomingLogicalChannel.iLogicalChannelId );
+						}
+					}
+				else
+					{
+					__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSink FAILED, INCOMING AUDIO");
+
+					iAudioIncomingLogicalChannel.iSameTypeClosingPending = EFalse;
+					if( iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen )
+						{
+						iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding AUDIO, ADDing SINK" )
+						AddAudioSink( iAudioIncomingLogicalChannel.iLogicalChannelId );
+						}
+					}
+				}
+            RemoveOperation( protoCmdId );
+            }
+            break;
+        case EVtCommandAddDataSource:
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.data source added" )
+			__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource");
+            if ( protoResponse == KErrNone &&
+                 ( iProtoState == MVtProtocolCommand::EConnected || iProtoState == MVtProtocolCommand::EConnecting || iProtoState == MVtProtocolCommand::ESetup ) )
+                {
+                if ( MatchResponseToPendingOps( protoCmdId, EAddVideoSource ) )
+                    {
+                    SetFlag( EProtoVideoSourceAdded );
+
+                    // This flag was set if channel closed indication
+                    // EVtIndicationClosingTrack was received from Proto.
+                    ClearFlag( EOutVideoChannelClosed );
+
+                    iLocalVideo->VideoChannelOpenedL();
+
+                    CVtEngEventManager::NotifyEvent(
+                        KVtEngMediaOutgoingVideoChannelStatusChanged );
+
+					__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource for VIDEO OK.");
+
+					// Adjust to normal value after Connect has completed
+					// so MONA is over.
+					if( iProtoState == MVtProtocolCommand::EConnected )
+						{
+						__VTPRINT( DEBUG_MEDIA, "LCN: Adjusting I Frame Interval in " )
+						__VTPRINT( DEBUG_MEDIA, "LCN: ADD_DATA_SOURCE for Video, Connect has completed earlier." )
+						__VTPRINT( DEBUG_MEDIA, "LCN: Normal I-frame rate." )
+
+
+						// Setting I-Frame interval to normal since MONA connections are over.
+						AddOperation( ESetIFrameInterval,
+						    // I-Frame every 10 second.
+						    iH263Encoder->SetIntraFrameInterval( 100 ) );
+						}
+					else if( iProtoState == MVtProtocolCommand::EConnecting || iProtoState == MVtProtocolCommand::ESetup )
+						{
+						__VTPRINT( DEBUG_MEDIA, "LCN: Adjusting I Frame Interval in " )
+						__VTPRINT( DEBUG_MEDIA, "LCN: ADD_DATA_SOURCE for Video, Proto state Connecting." )
+						__VTPRINT( DEBUG_MEDIA, "LCN: High I-frame rate" )
+
+						// MONA negotiations ongoing, I-Frame invertal must be small
+						AddOperation( ESetIFrameInterval,
+						    // 10 I-Frames every 1 second.
+						    iH263Encoder->SetIntraFrameInterval( 10000 ) );
+						}
+
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                        "MH.data setting default videoquality" )
+
+                    // Set default frame rate and send indication to peer
+                    if ( !IsFlag( EVideoQualitySetByPeer ) )
+                        {
+                        SetVideoQualityL( EVideoQualityNormal, EFalse );
+                        }
+
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                        "MH.data source added check flag" )
+                    if ( IsFlag( EProtoPauseVideoRequested ) )
+                        {
+                        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                            "MH.data source added pausing video" )
+                        EnableVideoL( EFalse );
+                        }
+                    }
+                else if ( MatchResponseToPendingOps(
+                    protoCmdId, EAddAudioSource ) )
+                    {
+                    SetFlag( EProtoAudioSourceAdded );
+
+                    // This flag was set if channel closed indication
+                    // EVtIndicationClosingTrack was received from PV.
+                    ClearFlag( EOutAudioChannelClosed );
+
+                    CVtEngEventManager::NotifyEvent(
+                        KVtEngMediaOutgoingAudioChannelStatusChanged );
+
+					__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource for AUDIO OK.");
+                    }
+                }
+
+			else
+				{
+				__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource FAILED");
+
+				if ( MatchResponseToPendingOps( protoCmdId, EAddVideoSource ) )
+					{
+					__VTPRINT( DEBUG_MEDIA, "EVtCommandAddDataSource FAILED, OUTGOING VIDEO");
+
+					iVideoOutgoingLogicalChannel.iSameTypeClosingPending = EFalse;
+					if( iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen )
+						{
+						iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding VIDEO, ADDing SOURCE" )
+						AddVideoSource( iVideoOutgoingLogicalChannel.iLogicalChannelId );
+						}
+					}
+				else
+					{
+					__VTPRINT( DEBUG_MEDIA, "LCN: EVtCommandAddDataSource FAILED, OUTGOING AUDIO");
+
+					iAudioOutgoingLogicalChannel.iSameTypeClosingPending = EFalse;
+					if( iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen )
+						{
+						iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding AUDIO, ADDing SOURCE" )
+						AddAudioSource( iAudioOutgoingLogicalChannel.iLogicalChannelId );
+						}
+					}
+				}
+
+            if ( !RemoveOperation( protoCmdId ) )
+                {
+                __ASSERT_DEBUG( iRequestStatus != NULL,
+                // uninit ongoing, still possible to receive
+                // callback from protocol
+                Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+                }
+            states->Update();
+            break;
+            }
+
+        case EVtCommandConnect:
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.Connect complete" )
+            if ( protoResponse == KErrNone )
+                {
+                __ASSERT_DEBUG( IsPending( EConnectProto ) != KErrNotFound,
+                    Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+                RemoveOperation( EConnectProto );
+                iProtoState = MVtProtocolCommand::EConnected;
+                __VTPRINT( DEBUG_MEDIA, "MH.protoComC: EConnected" )
+                states->Update();
+
+				// Adjust only if VideoSource adding has compled
+				if( IsPending( EAddVideoSource ) == KErrNotFound )
+					{
+					__VTPRINT( DEBUG_MEDIA, "LCN: Adjusting I FrameInterval " )
+					__VTPRINT( DEBUG_MEDIA, "LCN: after Connect has completed" )
+					__VTPRINT( DEBUG_MEDIA, "LCN: Normal I-frame interval." )
+
+
+					// Setting I-Frame interval to normal since MONA connections are over.
+					AddOperation( ESetIFrameInterval,
+					    // I-Frame every 10 second.
+					    iH263Encoder->SetIntraFrameInterval( 100 ) );
+					}
+                }
+            else
+                {
+                if ( iProtoState == MVtProtocolCommand::EConnecting ) {
+                    // it is possible that we're here because call was hanged up
+                    iProtoState = MVtProtocolCommand::ESetup;
+                    }
+                RemoveOperation( EConnectProto );
+                // connect may have failed due to disconnect request (possible only in debug env?)
+                if ( iPendingOp &&
+                   ( iPendingOp->Command() == KVtEngTerminateSession ) )
+                    {
+                    __VTPRINT( DEBUG_MEDIA,
+                        "complete KVtEngTerminateSession on connect failure" )
+                    CompleteOp( KErrNone );                        
+                    }
+                else
+                    {
+                    __VTPRINT( DEBUG_MEDIA,
+                        "request fallback on connect failure" )
+                    // request fallback from telephony
+                    CVtEngUtility* utils = CVtEngUtility::EngineUtils();
+                    utils->MediatorCommands().VoiceFallback();                    
+                    }
+                states->Update();
+                }
+            }
+            break;
+        case EVtCommandRemoveDataSource:
+        case EVtCommandRemoveDataSink:
+            break;
+        case EVtCommandReset:
+            {
+            __ASSERT_DEBUG( IsPending( EDestructProtoPhaseReset ) != KErrNotFound,
+                Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+            __VTPRINT( DEBUG_MEDIA, "MH.protoComC:RESET complete" )
+            RemoveOperation( protoCmdId );
+            if ( protoResponse == KErrNone )
+                {
+                iProtoState = MVtProtocolCommand::EIdle;
+                __VTPRINT( DEBUG_MEDIA, "MH.protoComC: EIdle" )
+                }
+            if ( iRequestStatus )
+                {
+                // we're in uninitialization process
+                // do this even if reset failed!
+                iLocalVideo->StopViewFinder();
+                UninitializeNextStep();
+                }
+            states->Update();
+            }
+            break;
+		case EVtCommandDeleteProtocolInterface:
+			{
+
+			// Remove pending operation from list
+			RemoveOperation( protoCmdId );
+
+			// Proceed to disconnecting if inetrfaces are free'd
+			UninitializeNextStep();
+            states->Update();
+
+			break;
+			}
+        case EVtCommandDisconnect:
+            {
+            __ASSERT_DEBUG(
+                IsPending( EDestructProtoPhaseDisconnect ) != KErrNotFound ||
+                IsPending( ETerminateSession ) != KErrNotFound,
+                Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+            __VTPRINT( DEBUG_MEDIA, "MH.protoComC:DISCONNECT complete" )
+            if ( protoResponse == KErrNone )
+                {
+                iProtoState = MVtProtocolCommand::ESetup;
+                __VTPRINT( DEBUG_MEDIA, "MH.protoComC: ESetup_disconnect" )
+                }
+
+            delete iTimer;
+            iTimer = NULL;
+
+            RemoveOperation( protoCmdId );
+
+            // If disconnect was requested while connecting we
+            // have connect operation added.
+            RemoveOperation( EConnectProto );
+
+            if ( iRequestStatus )
+                {
+                // continue uninitialization
+                UninitializeNextStep();
+                }
+            else
+                {
+                // complete plain disconnect request from  UI
+                CompleteOp( protoResponse );
+                }
+            states->Update();
+            }
+            break;
+        case EVtCommandCancelAllCommands:
+            {
+            __ASSERT_DEBUG(
+                IsPending( EUninitializeCancelAllProto ) != KErrNotFound,
+                Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+            RemoveOperation( protoCmdId );
+
+            UninitializeNextStep();
+            }
+            break;
+        default:
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH.protoComC Unknown Proto reply" )
+            }
+            break;
+        }
+    if ( event != KVtEngEventNone )
+        {
+        CVtEngEventManager::NotifyEvent( event );
+        }
+    __VTPRINTEXIT( "MH.HandleSessionCommandEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSessionInformationalEventL
+// Handles event from protocol engine.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSessionInformationalEventL(
+    const TVtIndicationEvent& aEvent)
+    {
+    __VTPRINTENTER( "MH.InfoEvent" )
+    const TInt type( aEvent.iEventType );
+    __VTPRINT2( DEBUG_MEDIA, "MH.protoHIE type=%d", type )
+
+    TVtIndicationEvent& event =
+        const_cast<TVtIndicationEvent&>(aEvent);
+    const TUint8* buffer = event.iLocalBuffer;
+
+    if ( buffer || type == EVtIndicationDisconnect )
+        {
+        TBool video( EFalse );
+        TBool audio( EFalse );
+        __VTPRINT( DEBUG_MEDIA, "MH.protoHIE inbound")
+        if ( type != EVtIndicationDisconnect &&
+            type != EVtIndicationUserInputCapability )
+            {
+            switch ( buffer[0] )
+                {
+                case EVtAudio:
+                    audio = ETrue;
+                    break;
+                case EVtVideo:
+                    video = ETrue;
+                    break;
+                case EVtControl:
+                case EVtData:
+                case EVtMediaNone:
+                    __VTPRINTEXIT( "MH.InfoEvent" )
+                    return;
+
+                default:
+                    break;
+
+                }
+            }
+
+         __VTPRINT( DEBUG_MEDIA, "MH.protoHIE acting according" )
+        TInt event( KVtEngEventNone );
+        switch ( type )
+            {
+            case EVtIndicationIncomingTrack:
+                {
+                __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE EVtIndicationIncomingTrack" )
+                if ( video )
+                    {
+					TInt tempID = *((TInt*)(buffer+4));
+					__VTPRINT2( DEBUG_MEDIA, "LCN: MH.protoHIE INCOMING VIDEO:%d", tempID )
+
+					if( !iVideoIncomingLogicalChannel.iSameTypeClosingPending )
+						{
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE InTrack VIDEO, ADDing SINK" )
+						AddVideoSink( tempID );
+						}
+					else
+						{
+						// Store old value since ID will change when we get outgoing track indication
+						iVideoIncomingLogicalChannel.iLogicalChannelIdClosing = iVideoIncomingLogicalChannel.iLogicalChannelId;
+						iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen = ETrue;
+						}
+
+					// Store new LCN ID.
+					iVideoIncomingLogicalChannel.iLogicalChannelId = tempID;
+                    }
+                else if ( audio )
+                    {
+					TInt tempID = *((TInt*)(buffer+4));
+					__VTPRINT2( DEBUG_MEDIA, "LCN: MH.protoHIE INCOMING AUDIO:%d", tempID )
+
+					if( !iAudioIncomingLogicalChannel.iSameTypeClosingPending )
+						{
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE InTrack AUDIO, ADDing SINK" )
+						AddAudioSink( tempID );
+						}
+					else
+						{
+						// Store old value since ID will change when we get outgoing track indication
+						iAudioIncomingLogicalChannel.iLogicalChannelIdClosing = iAudioIncomingLogicalChannel.iLogicalChannelId;
+						iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen = ETrue;
+						}
+
+					// Store new LCN ID.
+					iAudioIncomingLogicalChannel.iLogicalChannelId = tempID;
+					}
+				}
+                break;
+
+			case EVtIndicationOutgoingTrack:
+                {
+                __VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE EVtIndicationOutgoingTrack" )
+                if ( video )
+                    {
+					TInt tempID = *((TInt*)(buffer+4));
+					__VTPRINT2( DEBUG_MEDIA, "LCN: MH.protoHIE OUTGOING VIDEO ID:%d", tempID )
+
+					if( !iVideoOutgoingLogicalChannel.iSameTypeClosingPending )
+						{
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE OutTrack VIDEO, ADDing SOURCE" )
+						AddVideoSource( tempID );
+						}
+					else
+						{
+						// Store old value since ID will change when we get outgoing track indication
+						iVideoOutgoingLogicalChannel.iLogicalChannelIdClosing = iVideoOutgoingLogicalChannel.iLogicalChannelId;
+						iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = ETrue;
+						}
+
+					// Store new LCN ID.
+					iVideoOutgoingLogicalChannel.iLogicalChannelId = tempID;
+					}
+                else if ( audio )
+                    {
+
+					TInt tempID = *((TInt*)(buffer+4));
+					__VTPRINT2( DEBUG_MEDIA, "LCN: MH.protoHIE OUTGOING AUDIO:%d", tempID )
+
+					if( !iAudioOutgoingLogicalChannel.iSameTypeClosingPending )
+						{
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE OutTrack AUDIO, ADDing SOURCE" )
+						AddAudioSource( tempID );
+						}
+					else
+						{
+						// Store old value since ID will change when we get outgoing track indication
+						iAudioOutgoingLogicalChannel.iLogicalChannelIdClosing = iAudioOutgoingLogicalChannel.iLogicalChannelId;
+						iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = ETrue;
+						}
+
+					// Store new LCN ID.
+					iAudioOutgoingLogicalChannel.iLogicalChannelId = tempID;
+                    }
+                }
+                break;
+
+			case EVtIndicationClosingTrack:
+				{
+			
+				TUint8 direction = buffer[0];
+				TInt tempID = *((TInt*)(buffer+4));
+
+				__VTPRINT3( DEBUG_MEDIA, "LCN: MH.protoHIE PEVtIndicationClosingTrack ID:%d, dir:%d", tempID, direction )
+
+				if( direction == EVtIncoming )
+					{
+					if( tempID == iVideoIncomingLogicalChannel.iLogicalChannelId )
+						{
+						iVideoIncomingLogicalChannel.iSameTypeClosingPending = ETrue;
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSING INCOMING VIDEO" )
+						}
+					else
+						{
+						iAudioIncomingLogicalChannel.iSameTypeClosingPending = ETrue;
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSING INCOMING AUDIO" )
+						}
+					}
+				else
+					{
+                    TInt uiEvent;
+					if( tempID == iVideoOutgoingLogicalChannel.iLogicalChannelId )
+						{
+						SetFlag( EOutVideoChannelClosed );
+						iVideoOutgoingLogicalChannel.iSameTypeClosingPending = ETrue;
+						uiEvent = KVtEngMediaOutgoingVideoChannelStatusChanged;
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSING OUTGOING VIDEO" )
+						}
+					else
+						{
+						SetFlag( EOutAudioChannelClosed );
+						iAudioOutgoingLogicalChannel.iSameTypeClosingPending = ETrue;
+						uiEvent = KVtEngMediaOutgoingAudioChannelStatusChanged;
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSING OUTGOING AUDIO" )
+						}
+                    CVtEngEventManager::NotifyEvent( uiEvent );
+					}
+				}
+				break;
+
+            case EVtIndicationCloseTrack:
+				{
+
+				TInt tempID = *((TInt*)(buffer+4));
+			
+				TUint8 direction = buffer[0];
+
+				__VTPRINT3( DEBUG_MEDIA, "LCN: MH.protoHIE EVtIndicationCloseTrack ID:%d, dir:%d", tempID, direction )
+
+				if( direction == EVtIncoming )
+					{
+					if( iVideoIncomingLogicalChannel.iLogicalChannelId == tempID ||
+						( iVideoIncomingLogicalChannel.iSameTypeClosingPending &&
+						  tempID == iVideoIncomingLogicalChannel.iLogicalChannelIdClosing )
+						)
+						{
+						iVideoIncomingLogicalChannel.iSameTypeClosingPending = EFalse;
+                        iRemoteMediaState &= ~EMediaVideo;
+
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSE INCOMING VIDEO" )
+
+						if( iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen )
+							{
+							iVideoIncomingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+							__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding VIDEO, ADDing SINK" )
+							AddVideoSink( iVideoIncomingLogicalChannel.iLogicalChannelId );
+							}
+						}
+					else
+						{
+						iAudioIncomingLogicalChannel.iSameTypeClosingPending = EFalse;
+
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSE INCOMING AUDIO" )
+
+						if( iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen )
+							{
+							iAudioIncomingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+							__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding AUDIO, ADDing SINK" )
+							AddAudioSink( iAudioIncomingLogicalChannel.iLogicalChannelId );
+							}
+						}
+					}
+				else
+					{
+					if( iVideoOutgoingLogicalChannel.iLogicalChannelId == tempID ||
+						( iVideoOutgoingLogicalChannel.iSameTypeClosingPending &&
+						  tempID == iVideoOutgoingLogicalChannel.iLogicalChannelIdClosing )
+						)
+						{
+						iVideoOutgoingLogicalChannel.iSameTypeClosingPending = EFalse;
+
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSE OUTGOING VIDEO" )
+
+						if( iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen )
+							{
+							iVideoOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+							__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding VIDEO, ADDing SOURCE" )
+							AddVideoSource( iVideoOutgoingLogicalChannel.iLogicalChannelId );
+							}
+						}
+					else
+						{
+						iAudioOutgoingLogicalChannel.iSameTypeClosingPending = EFalse;
+
+						__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE CLOSE OUTGOING AUDIO" )
+
+						if( iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen )
+							{
+							iAudioOutgoingLogicalChannel.iSameTypeChannelReadyToOpen = EFalse;
+
+							__VTPRINT( DEBUG_MEDIA, "LCN: MH.protoHIE delayed adding AUDIO, ADDing SOURCE" )
+							AddAudioSource( iAudioOutgoingLogicalChannel.iLogicalChannelId );
+							}
+						}
+					}
+				}
+                break;
+            case EVtIndicationResumeTrack:
+                __VTPRINT2( DEBUG_MEDIA, "MH.protoHIE X is resumed %d", buffer[1] )
+                if ( buffer[1] == EVtIncoming ) // Only for remote
+                    {
+                    if ( video )
+                        {
+                        __VTPRINT( DEBUG_MEDIA, "MH.protoHIE video resumed" )
+                        event = KVtEngRemoteVideoResumed;
+                        ClearFlag( EProtoVideoTrackPaused );
+                        }
+                    else if ( audio )
+                        {
+                        __VTPRINT( DEBUG_MEDIA, "MH.protoHIE audio resumed" )
+                        event = KVtEngRemoteAudioResumed;
+                        ClearFlag( EProtoAudioTrackPaused );
+                        }
+                    }
+                break;
+            case EVtIndicationPauseTrack:
+                __VTPRINT2( DEBUG_MEDIA, "MH.protoHIE X is paused %d", buffer[1] )
+                if ( buffer[1] == EVtIncoming ) // Only for remote
+                    {
+                    if ( audio )
+                        {
+                        __VTPRINT( DEBUG_MEDIA, "MH.protoHIE audio paused" )
+                        SetFlag( EProtoAudioTrackPaused );
+                        event = KVtEngRemoteAudioPaused;
+                        }
+                    else if ( video )
+                        {
+                        __VTPRINT( DEBUG_MEDIA, "MH.protoHIE video paused" )
+                        SetFlag( EProtoVideoTrackPaused );
+                        event = KVtEngRemoteVideoPaused;
+                        }
+                    }
+                break;
+            case EVtIndicationDisconnect:
+                {
+                __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "MH.protoHIE PID" )
+
+                // Fix for disconnecting remote (bearer). Engine
+                // needs to send KVtEngRemoteDisconnect event to UI to notify
+                // UI that call can not be hangup!
+                CVtEngEventManager::NotifyEvent( KVtEngRemoteDisconnect );
+
+                delete iTimer;
+                iTimer = NULL;
+                CVtEngStateManager* states = CVtEngUtility::StateManager();
+                iProtoState = MVtProtocolCommand::ESetup;
+                __VTPRINT( DEBUG_MEDIA, "MH.protoComC: ESetup_indi_disconnect" )
+                states->Update();
+                if ( iPendingOp &&
+                     ( iPendingOp->Command() == KVtEngTerminateSession  ||
+                       iPendingOp->Command() == KVtEngResetEngine ) )
+                    {
+                    __VTPRINT2( DEBUG_MEDIA, "MH.protoHIE PID PO", iPendingOp->Command() )
+                    // Complete only KVtEngTerminateSession, if KVtEngResetEngine
+                    // is pending complete it after uninitialisation is finalised.
+                    if ( iPendingOp->Command() == KVtEngTerminateSession )
+                        {
+                        CompleteOp( KErrNone );
+                        }
+                    }
+                else
+                    {
+                    __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "MH.protoHIE PID RO")
+                    UninitializeNextStep();
+                    }
+                }
+                break;
+            default:
+                break;
+            }
+        if ( KVtEngEventNone != event )
+            {
+            CVtEngEventManager::NotifyEvent( event );
+            }
+        }
+    __VTPRINTEXIT( "MH.InfoEvent" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSessionErrorEventL
+// Handles error event from protocol engine.
+// -----------------------------------------------------------------------------
+//
+#ifdef VTDEBUG
+void CVtEngMediaHandler::HandleSessionErrorEventL( const TVtErrorEvent& aEvent )
+#else
+void CVtEngMediaHandler::
+    HandleSessionErrorEventL( const TVtErrorEvent& /* aEvent */ )
+#endif // VTDEBUG
+    {
+    // Must have an implementation.
+    __VTPRINT2( DEBUG_MEDIA, "MH.protoHEE,%d", aEvent.iEventType )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSettingChangedL
+// Handles still image setting change.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSettingChangedL(
+    CVtEngSettings::TSettingId aId,
+    const TDesC& /*aValue*/ )
+    {
+    __VTPRINTENTER( "MH.HandleSettingChangedL" )
+    if ( aId == CVtEngSettings::ESelectVolume ||
+         aId == CVtEngSettings::EHandsetVolume ||
+         aId == CVtEngSettings::EHandsfreeVolume )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "MH.volChgd %d", aId )
+        UpdateVolume();
+
+        if ( aId == CVtEngSettings::EHandsetVolume ||
+             aId == CVtEngSettings::EHandsfreeVolume )
+            {
+            CVtEngEventManager::NotifyEvent(
+                KVtEngAudioOutputVolumeChanged );
+            }
+        }
+    else if ( aId == CVtEngSettings::EStillImage ||
+              aId == CVtEngSettings::EStillImagePath )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.stillChgd" )
+
+        TShareObjectState shareState;
+        GetObjectSharingState( shareState );
+        if ( shareState == EInitializingShareImage ||
+             shareState == ESharingImage )
+            {
+            iLocalVideo->SettingsChanged();
+            return;
+            }
+
+        CVtEngSettings& settings = CVtEngUtility::Settings();
+        const CVtEngSettings::TVtEngVideoCallConfig& config =
+            settings.Config();
+
+        const CVtEngLocalVideo::TVtEngProviderType
+            activeProvider( iLocalVideo->ActiveProvider() );
+        if ( config.iVideo.iImageIsValid )
+            {
+            __VTPRINT( DEBUG_GEN, "MH.HSC valid" )
+            EnableVideoL( ETrue );
+            // if still image is not active we should only
+            // initialize it, not start after initialization.
+            const TBool initOnly( activeProvider ==
+                CVtEngLocalVideo::KVtEngProviderCam1 ||
+                activeProvider == CVtEngLocalVideo::KVtEngProviderCam2 ||
+                activeProvider ==
+                CVtEngLocalVideo::KVtEngProviderShareImage );
+            iLocalVideo->InitializeOnlyEx( initOnly );
+            TRAPD( err,iLocalVideo->SetStillImageL( !initOnly ) );
+            if ( err == KErrNotReady )
+                {
+                __VTPRINT( DEBUG_GEN, "MH.HSC waiting...")
+                // Another switch ongoing, wait until it is done.
+                }
+            }
+        else
+            {
+            __VTPRINT( DEBUG_GEN, "MH.HSC invalid" )
+			__VTPRINT2( DEBUG_MEDIA, "MH.HSC provider=", activeProvider )
+		    if ( CVtEngUtility::Settings().IsDefaultStillImageDefined() )
+                {
+                __VTPRINT( DEBUG_MEDIA, "MH.SetDefaultStillImageL" )
+                if ( activeProvider == CVtEngLocalVideo::KVtEngProviderImage )
+                    {
+                    iLocalVideo->SetDefaultStillImageL();
+                    }
+                }
+            else
+                {
+                if( activeProvider !=
+                    CVtEngLocalVideo::KVtEngProviderCam1 &&
+                    activeProvider != CVtEngLocalVideo::KVtEngProviderCam2 )
+				    {
+				    EnableVideoL( EFalse );
+				    }
+                    __VTPRINT( DEBUG_MEDIA, "MH.tStillImageL" )
+                iLocalVideo->SetStillImageL( ETrue );
+                }
+
+            }
+        }
+    else
+        {
+        // Do nothing, but satisfy lint.
+        __VTPRINT2( DEBUG_MEDIA, "MH.HSC not handled=%d", aId )
+        }
+    __VTPRINTEXIT( "MH.HSC" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::InitializeL
+// Initializes settings listeners.
+// Sets still image and initializes default provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::InitializeL( TRequestStatus& aStatus )
+    {
+    __VTPRINTENTER( "MH.InitializeL" )
+    // configure still image
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+    settings.NotifyChangeL( CVtEngSettings::EStillImage, *this );
+    settings.NotifyChangeL( CVtEngSettings::EStillImagePath, *this );
+    settings.NotifyChangeL( CVtEngSettings::ESelectVolume, *this );
+    settings.NotifyChangeL( CVtEngSettings::EHandsetVolume, *this );
+    settings.NotifyChangeL( CVtEngSettings::EHandsfreeVolume, *this );
+
+    const CVtEngSettings::TVtEngVideoCallConfig& config = settings.Config();
+    TInt err( KErrNotFound );
+    if ( config.iVideo.iImageIsValid )
+        {
+        // first step initialize still, when that is complete, initialize blank
+        TRAP( err, iLocalVideo->SetStillImageL( ETrue ) );
+        if ( err == KErrNone )
+            {
+            iVSInitState = EStateInitStillImage;
+            iRequestStatus = &aStatus;
+            }
+        }
+    if ( err != KErrNone )
+        {
+        // Still provider init failed -> initialize blank
+        InitializeProviderL( aStatus );
+        }
+    __VTPRINTEXIT( "MH.InitializeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CancelInitialize
+// Sets initialization state as cancelled.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::CancelInitialize()
+    {
+    __VTPRINTENTER( "MH.CancelInitialize" )
+    iVSInitState = EStateInitCanceled;
+    __VTPRINTEXIT( "MH.CancelInitialize" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::InitializeProviderL
+// Initializes default blank provider.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::InitializeProviderL( TRequestStatus& aStatus )
+    {
+    __VTPRINTENTER( "MH.InitializeProviderL" )
+    iLocalVideo->InitializeL();
+    iVSInitState = EStateInitProvider;
+    iRequestStatus = &aStatus;
+    __VTPRINTEXIT( "MH.InitializeProviderL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::Uninitialize
+// Frees all resources.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::Uninitialize( TRequestStatus& aStatus )
+    {
+    __VTPRINTENTER( "MH.Uninitialize" )
+    ClearFlag( ETwoStageOperation );
+    ClearFlag( ESourceUpdateNeeded );
+    iRequestStatus = &aStatus;
+    if ( iProtoState == MVtProtocolCommand::EDisconnecting )
+        {
+        // Protocol is disconnecting if
+        // 1) bearer was lost (and videoteleng issued disconnect on protocol), or
+        // 2) protocol issued disconnect due unrecoverable error or disconnect
+        //    request from remote terminal.
+        // And now UI requested 'reset engine' while performing disconnect.
+        // When disconnecting is complete check if iRequestStatus
+        // is not null AND iInitialized is ETrue.
+        // If so, Uninitialize has been called (UI requested reset).
+
+        StopRendering();
+        __VTPRINT( DEBUG_MEDIA, "MH.UnInit wait for disconnect to complete" )
+        __VTPRINTEXIT( "MH.Uninitialize" )
+        return;
+        }
+    iInitialized = EFalse;
+    UninitializeNextStep();
+    __VTPRINTEXIT( "MH.Uninitialize" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::UninitializeNextStep
+// Goes to next step in uninitialization
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::UninitializeNextStep( )
+    {
+     __VTPRINTENTER( "MH.UninitializeNextStep" )
+    StopRendering();
+
+    TOperation op( ENone );
+
+    // CancelAllProtoCommands is no op if nothing to cancel or already pending.
+    // However, then op is still assigned with EUninitializeCancelAllProto to
+    // indicate it is pending and we must wait for it to complete.
+    CancelAllProtoCommands( op );
+
+    if ( op == ENone ) // Cancellation is not pending
+        {
+        __VTPRINT2( DEBUG_MEDIA, "next step protostate=%d", iProtoState )
+        switch ( iProtoState )
+            {
+            case MVtProtocolCommand::EConnected:
+            case MVtProtocolCommand::EConnecting:
+                op = EDestructProtoPhaseDisconnect;
+                break;
+            case MVtProtocolCommand::ESetup:
+            // In EInitializing state operation is waited to complete. See
+            // CVtEngInitializer::ContinueOrRetry op==EReset and iStep==EInitProto
+
+                if( iH324Config || iH263Encoder )
+                    {
+                    // First remove interfaces, after completion perform reset
+                    op = ERemove324CtrlInterface;
+                    break;
+                    }
+
+                // If interfaces are already released or not even reserved, go to Reset.
+                op = EDestructProtoPhaseReset;
+                break;
+            case MVtProtocolCommand::EResetting:
+                // Reset ongoing, wait for it to complete
+                __VTPRINT( DEBUG_MEDIA, "MH.UnInit resetting" )
+                break;
+            case MVtProtocolCommand::EIdle:
+                op = ERemove324CtrlInterface;
+                __VTPRINT( DEBUG_MEDIA, "MH.UnInit idling" )
+                break;
+            default:
+                __VTPRINT( DEBUG_MEDIA, "MH.UnInit invalid state" )
+                break;
+            }
+        if ( op != ENone )
+            {
+            TRAPD( err, ContinueUninitializeL( op ) );
+            if ( err != KErrNone )
+                {
+                if ( iRequestStatus )
+                    {
+                    User::RequestComplete( iRequestStatus, err );
+                    iRequestStatus = NULL;
+                    }
+                else
+                    {
+                    // Infinite waiting for end state!
+                    __VTPRINT( DEBUG_MEDIA, "MH. dead end!" )
+                    Panic( EVtEngPanicDisconnectTimerExpired );
+                    }
+                __VTPRINT2( DEBUG_MEDIA, "next step err=%d", err )
+                }
+            }
+        }
+    __VTPRINTEXIT( "MH.UninitializeNextStep" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ContinueUninitializeL
+// Completes uninitialization:
+//   does disconnecting, deletes members.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ContinueUninitializeL(
+    const TOperation aOp )
+    {
+    __VTPRINTENTER( "MH.ContinueUninitializeL" )
+    __VTPRINT2( DEBUG_MEDIA, "MH.ContUn op=%d", aOp)
+    switch ( aOp )
+        {
+        case EDestructProtoPhaseDisconnect: // causes DisconnectL on protocol
+			__VTPRINT2( DEBUG_MEDIA, "MH.ContUn EDestructProtoPhaseDisconnect iProtoState=%d", iProtoState )
+
+			// Disconnecting only allowed in Connecting and Connected state.
+			if( iProtoState == MVtProtocolCommand::EConnecting || iProtoState == MVtProtocolCommand::EConnected )
+				{
+				DisconnectProtoL();
+				if ( iProtoState == MVtProtocolCommand::EDisconnecting ) {
+					// started succefully disconnecting
+					break;
+					}
+				}
+         // fall through if state was not proper was disconnect
+        case EDestructProtoPhaseReset:      // causes ResetL on protocol
+
+            ResetProto2WayL();
+            if ( iProtoState == MVtProtocolCommand::EResetting )
+                {
+                break;
+                }
+        // fall through if state was not proper for reset
+        case ERemove324CtrlInterface:
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH.ContUn ERemove324CtrlInterface" )
+            const TBool extCmdPending( ExtensionCommandsPending() );
+            if ( !extCmdPending && ( iH324Config || iH263Encoder ) )
+                { // no pending extension commands, interfaces can be released
+                  // this is no-op if already released
+			    ReleaseProtoInterfacesL();
+                break;
+			    }
+			if( extCmdPending ||
+			    IsPending( ERemove324CtrlInterface ) != KErrNotFound ||
+				IsPending( ERemoveH263EncInterface ) != KErrNotFound )
+				{
+				// Interface releasing has not completed yet, need to wait
+				// until proceeding ahead.
+				break;
+				}
+            }
+        // fall through if interfaces are released
+        case EDestructSwitchBlank:
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH.ContUn EDestructSwitchBlank" )
+            // provider must be selected to something else that
+            // is not deleted
+            const CVtEngLocalVideo::TVtEngProviderType
+                activeProvider( iLocalVideo->ActiveProvider() );
+            if ( activeProvider != CVtEngLocalVideo::KVtEngProviderNone )
+                {
+                iLocalVideo->SelectSourceL( CVtEngLocalVideo::KVtEngProviderNone );
+                iVSInitState = EStateWaitingProviderChangeForUninit;
+                break;
+                }
+            // blank provider already active so continue
+            iVSInitState = EInitStateNone;
+            }
+            // fall thru
+        case EDestructInternals:
+            __VTPRINT( DEBUG_MEDIA, "MH.ContUn EDestructInternals" )
+            iLocalVideo->Reset();
+            delete iRemoteVideo;
+            iRemoteVideo = NULL;
+            if ( iRequestStatus )
+                {
+                User::RequestComplete( iRequestStatus, KErrNone );
+                iRequestStatus = NULL;
+                }
+            break;
+        default:
+            // Should not happen
+            Panic( EVtEngPanicUnInitIncorrectOperation );
+            break;
+        }
+
+    __VTPRINTEXIT( "MH.ContinueUninitializeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::StopRendering
+// Stops all rendering.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::StopRendering()
+    {
+    __VTPRINTENTER( "MH.StopRendering" )
+    if ( iLocalVideo )
+        {
+        iLocalVideo->StopViewFinder();
+        }
+    if ( iRemoteVideo )
+        {
+        iRemoteVideo->StopVideoRendering();
+        }
+    __VTPRINTEXIT( "MH.StopRendering" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::UpdateVolume
+// Updates volume values.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::UpdateVolume()
+    {
+    __VTPRINTENTER( "MH.UpdateVolume" )
+    if ( iUpdateVolumeAllowed && IsPending( ESetAudioVolume ) == KErrNotFound )
+        {
+        CVtEngSettings& settings = CVtEngUtility::Settings();
+
+        TInt volume( 0 );
+        TInt err( settings.GetVolume( volume,
+            settings.CurrentVolume(), ETrue ) );
+        if ( err != KErrNone )
+            {
+            volume = settings.MinVolume();
+            }
+
+        SetVolume( volume );
+        }
+    else
+        {
+        iUpdateVolumeRequired = ETrue;
+        }
+    __VTPRINTEXIT( "MH.UpdateVolume" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AutoEnableVideo
+// Enables video when primary camera becomes available while blank provider
+// is active (i.e. video is disabled). This should not be called in other
+// occations. Difference to EnableVideoL is that callback doesn't try to
+// complete pending request to UI (that usually is different request than this).
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AutoEnableVideo( TBool aEnable )
+    {
+    __VTPRINTENTER( "MH.AutoEnableVideo" )
+    __VTPRINT( DEBUG_MEDIA, "MH.AutoEnableVideo" )
+    TOperation op( EDisableVideoInternal );
+    if ( aEnable )
+        {
+        op = EEnableVideoInternal;
+        }
+    TRAPD( err, EnableVideoL( aEnable, op ) );
+    __VTPRINTEXITR( "MH.AutoEnableVideo %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::FinalizeUninitialization
+// Deletes protocol.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::FinalizeUninitialization()
+    {
+    __VTPRINTENTER( "MH.FinalUninit" )
+    if ( iSessionCommand )
+        {
+        iAudioCtrl = NULL;
+        TInt err( KErrNone );
+
+        // Delete the config interface
+        TRAP( err,
+            {
+			if ( iSessionCommand )
+				{
+				VTProtocolFactory::DeleteSessionCommand( iSessionCommand );
+				iSessionCommand = NULL;
+				}
+
+			// Trapped to log the possible error
+            __VTPRINT( DEBUG_MEDIA, "MH.Deleted Terminal" )
+            } );
+        __VTPRINT2( DEBUG_MEDIA, "MH.Deletion complete=%d", err )
+        iSessionCommand = NULL;
+        iProtoStateFlags = 0;
+        iProtoState = MVtProtocolCommand::EIdle;
+        __VTPRINT( DEBUG_MEDIA, "MH.protoComC: EIdle uninit" )
+        if ( iPendingOp &&
+             iPendingOp->Command() == KVtEngTerminateSession )
+            {
+            __VTPRINT2( DEBUG_MEDIA, "MH.FinalUninit comp TerminateSession=%d",
+                iPendingOp->Command())
+            CompleteOp( KErrNone );
+            }
+        else if ( iPendingOp ) {
+            __VTPRINT2( DEBUG_MEDIA, "MH.FinalUninit comp =%d",
+                iPendingOp->Command() )
+            delete iPendingOp;
+            }
+        iPendingOp = NULL;
+        }
+    iPendingOps->Reset();
+    __VTPRINTEXIT( "MH.FinalUninit" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ResetProto2WayL
+// Resets protocol engine.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ResetProto2WayL()
+    {
+    __VTPRINTENTER( "MH.ResetProto2WayL" )
+    __ASSERT_ALWAYS( iProtoState == MVtProtocolCommand::ESetup,
+                      Panic( EVtEngPanicMediaHandlerOpStateFailure ) );
+
+    __VTPRINT( DEBUG_MEDIA, "MH. Calling ResetL on Proto" )
+    iUpdateVolumeAllowed = EFalse;
+    TInt cmdId = iSessionCommand->ResetProtocolL();
+    if ( cmdId > 0 )
+        {
+        // Add the operation if ok
+        AddOperation( EDestructProtoPhaseReset, cmdId, EFalse );
+        iProtoState = MVtProtocolCommand::EResetting;
+        }
+    else
+        {
+        __VTPRINT( DEBUG_MEDIA,
+            "MH.ResetProto2WayL waiting for cancel to complete" )
+        }
+    __VTPRINTEXIT( "MH.ResetProto2WayL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetSelectedCameraId
+// Called from Local video when camera has been selected.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetSelectedCameraId(
+    const TCameraId aId,
+    TBool aUpdateRequired )
+    {
+    __VTPRINTENTER( "MH.SetSelectedCameraId" )
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "MH.SetSelectedCameraId id=%d", aId )
+    iSelectedCameraId = aId;
+    // Set flag that switch should be done later if
+    // engine has not reached proper state
+    // - but only if active provider is a camera.
+    if ( aUpdateRequired && iLocalVideo )
+        // NULL if called inside CVtEngLocalVideo::ConstructL
+        {
+        const CVtEngLocalVideo::TVtEngProviderType
+            activeProvider( iLocalVideo->ActiveProvider() );
+
+        if ( activeProvider == CVtEngLocalVideo::KVtEngProviderCam1 ||
+            activeProvider == CVtEngLocalVideo::KVtEngProviderCam2 )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                "MH. ESourceUpdateNeeded flag set" )
+            SetFlag( ESourceUpdateNeeded );
+            }
+        }
+    __VTPRINTEXIT( "MH.SetSelectedCameraId" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleLocalVideoOperationCompleteL
+// Asynchronous local video operation is completed in here.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleLocalVideoOperationCompleteL(
+    const TInt aResult )
+    {
+    __VTPRINTENTER( "MH.LocVidOpComp" )
+    __VTPRINT3( DEBUG_MEDIA, "MH.LocVidOpComp res=%d,intOps=%d",
+        aResult, iPendingOps->Count() )
+    __VTPRINT2( DEBUG_MEDIA, "MH.LocVidOpComp state flags=%d", iProtoStateFlags )
+
+    // Check if video should be paused
+    if ( IsFlag( EProtoPauseVideoBlankProv ) )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.LocVidOpComp pause flagged" )
+        if ( aResult == KErrNone )
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH.LocVidOpComp pausing" )
+            EnableVideoL( EFalse );
+            // Not ready yet, clear the two stages and complete in the end
+            if ( IsFlag( ETwoStageOperation ) &&
+                IsFlag( EProtoContVideoBlankInit ) )
+                {
+                __VTPRINT( DEBUG_MEDIA, "MH.LocVidOpComp 1 stage complete" )
+                ClearFlag( ETwoStageOperation );
+                ClearFlag( EProtoContVideoBlankInit );
+                }
+            ClearFlag( EProtoPauseVideoBlankProv );
+            }
+        }
+
+    if ( iRequestStatus )
+        {
+        if ( iVSInitState == EStateInitStillImage )
+
+            { // still image initialized, proceed to initializing blank provider
+            InitializeProviderL( *iRequestStatus );
+            __VTPRINTEXIT( "MH.LocVidOpComp" )
+            return;
+            }
+        else if ( iVSInitState == EStateInitProvider  )
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH.LocVidOpComp reqComplete" )
+            // Part of media handler initialization
+            User::RequestComplete( iRequestStatus, aResult );
+            iRequestStatus = NULL;
+            iVSInitState = EInitStateNone;
+            __VTPRINTEXIT( "MH.LocVidOpComp" )
+            return;
+            }
+        else if ( iVSInitState == EStateWaitingProviderChangeForUninit )
+            {
+            iVSInitState = EInitStateNone;
+            iLocalVideo->StopViewFinder(); // ensure view finder is stopped
+            ContinueUninitializeL( EDestructInternals );
+            __VTPRINTEXIT( "MH.LocVidOpComp" )
+            return;
+            }
+        else if ( iVSInitState == EStateInitCanceled )
+            {
+            // If the request status has been cancelled
+            // uninitialize VT
+            ContinueUninitializeL( EDestructSwitchBlank );
+            }
+        }
+
+    // Either complete the operation or remove 2 stage flag.
+    // If flag removed, the operation will be completed when
+    // the second stage finalizes.
+    if ( IsFlag( ETwoStageOperation ) )
+        {
+        SetFlag( EProtoSendIntraFrame );
+        ClearFlag( ETwoStageOperation );
+        }
+    else
+        {
+        // Send a sync message, if video enabled.
+        if ( !IsFlag( EProtoVideoTrackPaused ) &&
+            // and
+            iInitialized &&
+            iProtoState == MVtProtocolCommand::EConnected &&
+            iPendingOp &&
+            iPendingOp->Command() == KVtEngSetSource )
+            {
+            RequestFrame();
+            }
+        // Complete operation only if it is related. We may have received
+        // KVtEngTerminateSession while prepare/set source is pending and
+        // cannot complete it!
+        if ( iPendingOp )
+            {
+            switch( iPendingOp->Command() )
+                {
+                case KVtEngHandleLayoutChange:
+                case KVtEngPrepareCamera:
+                case KVtEngSetSource:
+                case KVtEngUnfreeze:
+                    CompleteOp( aResult );
+                    break;
+
+                // Image sharing
+                case KVtEngInitializeShareImage:
+                    __VTPRINT( DEBUG_MEDIA,
+                        "MH.LocVidOpComp KVtEngInitializeShareImage" )
+                    if ( aResult != KErrNone )
+                        {
+                        iLocalVideo->ShareError( aResult );
+                        }
+                    CompleteOp( aResult );
+                    break;
+
+                case KVtEngStartShareImage:
+                    __VTPRINT( DEBUG_MEDIA,
+                        "MH.LocVidOpComp KVtEngStartShareImage" )
+                    if ( aResult != KErrNone )
+                        {
+                        iLocalVideo->ShareError( aResult );
+                        }
+                    CompleteOp( aResult );
+                    if ( iVideoAction == EVideoActionEnable )
+                    	{
+                    	if ( aResult == KErrNone )
+                    		{
+                    		EnableVideoL( ETrue );
+                        	iVideoAction = EVideoActionDisable;
+                    		}
+                    	else
+                    		{
+                        	iVideoAction = EVideoActionNone;
+                    		}
+                        }
+
+                    break;
+
+                case KVtEngStopShareImage:
+                    __VTPRINT( DEBUG_MEDIA,
+                        "MH.LocVidOpComp KVtEngStopShareImage" )
+                    if ( aResult != KErrNone )
+                        {
+                        iLocalVideo->ShareError( aResult );
+                        }
+                    CompleteOp( aResult );
+                    break;
+
+                default:
+                    break;
+                }
+            }
+        }
+    __VTPRINTEXIT( "MH.LocVidOpComp" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::Disconnect
+// Starts Protocol disconnecting procedure.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::Disconnect()
+    {
+    UninitializeNextStep();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SdkInitInfo
+// Returns Protocol sdk initialization information.
+// -----------------------------------------------------------------------------
+//
+TVtInitInfo& CVtEngMediaHandler::SdkInitInfo()
+    {
+    return iSdkInitInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ProtoState
+// Returns protocol state, maintained by VTEngine.
+// Might be out of sync with actual Proto state.
+// -----------------------------------------------------------------------------
+//
+MVtProtocolCommand::TVtProtocolState CVtEngMediaHandler::ProtoState()
+    {
+    return iProtoState;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::Connect
+// Sets up connection with remote end.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::Connect()
+    {
+    __VTPRINTENTER( "MH.Connect" )
+    __VTPRINT( DEBUG_MEDIA, "MH.Connect" )
+    TInt err( KErrNotReady );
+    if ( ProtoState() == MVtProtocolCommand::ESetup && IsFlag( EProto324IFAcquired ) )
+        {
+        TInt cmdId( 0 );
+        __VTPRINT( DEBUG_MEDIA, "MH. Calling ConnectToProtocolL on Proto" )
+        TRAP( err, cmdId = iSessionCommand->ConnectToProtocolL( ( ( CVtEngUtility::EngineUtils() )->Initializer() ).GetVtComms() ) );
+        if ( err == KErrNone )
+            {
+            const TInt res( AddOperation( EConnectProto, cmdId) );
+            if ( res < KErrNone )
+                {
+                err = res;
+                }
+            iProtoState = MVtProtocolCommand::EConnecting;
+            __VTPRINT( DEBUG_MEDIA, "MH.protoComC: EConnecting Connecting" )
+            }
+        }
+    __VTPRINTEXITR( "MH.Connect err=%d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddVideoSource
+// Adds video source.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddVideoSource( TUint aChannelId )
+    {
+    __VTPRINTENTER( "MH.AddVideoSource" )
+
+    if( !MediaAddingValidity() )
+        return KErrCancel;
+
+    TInt cmdId( 0 );
+    TRAPD( err, cmdId = iSessionCommand->AddVideoSourceL(
+        aChannelId, *iLocalVideo->Source() ) );
+    if ( err == KErrNone )
+        {
+        const TInt res( AddOperation( EAddVideoSource, cmdId ) );
+        if ( res >= KErrNone )
+            {
+            iRemoteMediaState |= EMediaVideoPreparing;
+            }
+        else
+            {
+            err = res;
+            }
+        }
+    if ( err != KErrNone )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+        }
+    __VTPRINTEXITR( "MH.AddVideoSource %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddAudioSource
+// Adds audio source.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddAudioSource( TUint aChannelId )
+    {
+    __VTPRINTENTER( "MH.AddAudioSource" )
+
+    if( !MediaAddingValidity() )
+        return KErrCancel;
+
+    TInt cmdId( 0 );
+    TInt err( KErrNone );
+    // Only for target compilations.
+#if !defined( __WINS__ )
+    err = iLocalVideo->CreateAudioSource();
+    if ( err == KErrNone )
+        {
+        TRAP( err, cmdId = iSessionCommand->AddAudioSourceL(
+            aChannelId, *iLocalVideo->AudioSource() ) );
+        }
+#endif // !__WINS__
+#if defined (__WINS__)
+		aChannelId = aChannelId; // Remove compilation warnings with CW.
+#endif // __WINS__
+
+    if ( err == KErrNone )
+        {
+        const TInt res( AddOperation( EAddAudioSource, cmdId ) );
+        if ( res < KErrNone )
+            {
+            err = res;
+            }
+        }
+    if ( err != KErrNone )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+        }
+    if ( IsFlag( ESourceUpdateNeeded ) )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.AddASource updateProvider" )
+        ClearFlag( ESourceUpdateNeeded );
+        // Generate event
+        iLocalVideo->vsProvidersChanged(
+            iSelectedCameraId == MVtEngMedia::EPrimaryCamera );
+        }
+    __VTPRINTEXITR( "MH.AddAudioSource %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddVideoSinkL
+// Adds video sink.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddVideoSink( TUint aChannelId )
+    {
+    __VTPRINTENTER( "MH.AddVideoSink" )
+
+    if( !MediaAddingValidity() )
+        return KErrCancel;
+
+    TInt cmdId( 0 );
+    TRAPD( err, cmdId = iRemoteVideo->AddVideoSinkL( aChannelId ) );
+    if ( err == KErrNone )
+        {
+        const TInt res( AddOperation( EAddVideoSink, cmdId ) );
+        if ( res >= KErrNone )
+            {
+            iRemoteMediaState |= EMediaVideoPreparing;
+            }
+        else
+            {
+            err = res;
+            }
+        }
+    if ( err != KErrNone )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+        }
+    __VTPRINTEXITR( "MH.AddVideoSink %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddAudioSink
+// Adds audio sink.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddAudioSink( TUint aChannelId )
+    {
+    __VTPRINTENTER( "MH.AddAudioSink" )
+
+    if( !MediaAddingValidity() )
+        return KErrCancel;
+
+    TInt cmdId( 0 );
+    TRAPD( err, cmdId = iRemoteVideo->AddAudioSinkL( aChannelId ) );
+    if ( err == KErrNone )
+        {
+        const TInt res( AddOperation( EAddAudioSink, cmdId ) );
+        if ( res >= KErrNone )
+            {
+            iRemoteMediaState |= EMediaAudioPreparing;
+            }
+        else
+            {
+            err = res;
+            }
+        }
+    if ( err != KErrNone )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+        }
+    __VTPRINTEXITR( "MH.AddAudioSink %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RemoveOperation
+// Removes an operation from stored operations.
+// -----------------------------------------------------------------------------
+//
+template<class T>
+TBool CVtEngMediaHandler::RemoveOperation( const T& aOp )
+    {
+    TBool removed( EFalse );
+    const TInt pos( IsPending( aOp ) );
+    if ( pos != KErrNotFound )
+        {
+        __VTPRINT3( DEBUG_MEDIA, "MH.RemoveOp removed index=%d TOperation=%d",
+            pos, ( *iPendingOps )[ pos ].iOp )
+        iPendingOps->Delete( pos );
+        removed = ETrue;
+        }
+    return removed;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AddOperation
+// Adds operation to operations pending completion.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AddOperation(
+    const TOperation aOp,
+    TInt aCmdId,
+    const TBool aResetExisting )
+    {
+    if ( aResetExisting )
+        {
+        iPendingOps->Reset();
+        }
+    TCmdOpPair opPair;
+    opPair.iOp = aOp;
+    opPair.iProtoCmdId = aCmdId;
+    // this should never leave because SetReserveL called in ConstructL
+    TRAPD( err, iPendingOps->AppendL( opPair ) );
+    if ( err != KErrNone )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngResourceMemAllocFailure );
+        return err;
+        }
+    const TInt count( iPendingOps->Count() );
+    __VTPRINT3( DEBUG_MEDIA, " MH.op added. op=%d,cmdId=%d", aOp, aCmdId )
+    __VTPRINT2( DEBUG_MEDIA, "              count=%d", count )
+    return ( count - 1 );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::IsPending
+// Checks if a command is set to be completed.
+// Checking is done based on operation.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::IsPending( const TOperation aOp ) const
+    {
+    const TInt count( iPendingOps->Count() );
+    for ( TInt i = 0; i < count ; i++ )
+        {
+        if ( aOp == ( *iPendingOps )[ i ].iOp )
+            {
+            __VTPRINT2( DEBUG_MEDIA, "MH.IsPending VT Op index=%d", i )
+            return i;
+            }
+        }
+    __VTPRINT( DEBUG_MEDIA, "MH.IsPending VT Op NOT FOUND" )
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::IsPending
+// Checks if a command is set to be completed.
+// Checking is done based on command id.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::IsPending( const TInt aCmdId ) const
+    {
+    const TInt count( iPendingOps->Count() );
+    for ( TInt i = 0; i < count ; i++ )
+        {
+        if ( aCmdId == ( *iPendingOps )[ i ].iProtoCmdId )
+            {
+            __VTPRINT3( DEBUG_MEDIA, "MH.IsPending ProtoCmdId=%d index=%d",
+                aCmdId, i )
+            return i;
+            }
+        }
+    __VTPRINT( DEBUG_MEDIA, "MH.IsPending ProtoCmdId NOT FOUND" )
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CompleteOp
+// Asynchronous command completion.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::CompleteOp( const TInt aResult )
+    {
+    CVtEngOperation* opToComplete = iPendingOp;
+    TInt err( KErrNotFound );
+    if ( opToComplete )
+        {
+        iPendingOp = NULL;
+        opToComplete->HandleOpComplete( aResult );
+        err = KErrNone;
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AsyncCompleteOp
+// Asynchronous command completion.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::AsyncCompleteOp( const TInt aResult )
+    {
+    iAsyncCallback->Cancel();
+    iAsyncCompleteOpResult = aResult;
+    iAsyncCallback->Start( TCallBack( DoCompleteOp, this ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::MatchResponseToPendingOps
+// Checks if a response matches corresponding operation.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::MatchResponseToPendingOps(
+    const TInt aProtoCmdId,
+    const TOperation aOperation,
+    TInt* aIndex )
+    {
+    const TInt index( IsPending( aOperation ) );
+    TBool entryFound( EFalse );
+    if ( index != KErrNotFound )
+        {
+        const TCmdOpPair opPair = ( *iPendingOps )[index];
+        if ( opPair.iProtoCmdId == aProtoCmdId )
+            {
+            entryFound = ETrue;
+            if ( aIndex )
+                {
+                *aIndex = index;
+                }
+            }
+        }
+    __VTPRINT2( DEBUG_MEDIA, "MH.MatchRespToOp was found=%d", entryFound )
+    return entryFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::StartDisconnectTimerL
+// Starts the disconnect timer.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::StartDisconnectTimerL()
+    {
+    __VTPRINT( DEBUG_MEDIA, "MH. start disc.timer" )
+    if ( iTimer == NULL )
+        {
+        TCallBack cb( CVtEngMediaHandler::TimerCallback, NULL );
+        iTimer = CPeriodic::NewL( 0 );
+        iTimer->Start( KVtEngDisconnectionTimer,
+                   KVtEngDisconnectionTimer,
+                   cb );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::NextUninitStepCallbackL
+// Proceeds to next uninitializatioin step asynchronously.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::NextUninitStepCallbackL()
+    {
+    __VTPRINTENTER( "MH.NextUninitStepCallbackL" )
+    if ( !iNextStepCallback )
+        {
+        // perform asap => high priority
+        TCallBack cb( CVtEngMediaHandler::UninitCallback, this );
+        iNextStepCallback = new ( ELeave ) CAsyncCallBack(
+            cb, CActive::EPriorityHigh );
+        iNextStepCallback->CallBack();
+        }
+    __VTPRINTEXIT( "MH.NextUninitStepCallbackL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::UninitCallback
+// Asynch callback method for uninitialization.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::UninitCallback( TAny* aAny )
+    {
+    __VTPRINTENTER( "MH.UninitCallback" )
+    CVtEngMediaHandler* handler = static_cast<CVtEngMediaHandler*>( aAny );
+    delete handler->iNextStepCallback;
+    handler->iNextStepCallback = NULL;
+    handler->UninitializeNextStep();
+    __VTPRINTEXIT( "MH.UninitCallback" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AssignPendingOp
+// Assigns operation and completes pending if necessary.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::AssignPendingOp(
+            CVtEngOperation& aOperation,
+            TInt aReplaceError )
+    {
+    TInt result = KErrNone;
+    if ( iPendingOp )
+        {
+        if ( aReplaceError != KErrNone &&
+            // if terminating don't allow other commands
+             iPendingOp->Command() != KVtEngTerminateSession )
+            {
+            __VTPRINT2( DEBUG_MEDIA, "MH.Assign op replace err=", aReplaceError )
+            CompleteOp( aReplaceError );
+            // indicate previous operation was "cancelled" (even though it is
+            // not really cancelled, we still get callback!)
+            result = KErrCancel;
+            }
+        else
+            {
+            // not allowed to assign new operation
+            result = KErrGeneral;
+            }
+        }
+    if ( result != KErrGeneral )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "MH.AssignPendingOp=%d", aOperation.Command() )
+        iPendingOp = &aOperation;
+        }
+    __VTPRINT2( DEBUG_MEDIA, "MH.AssignPendingOp.res=%d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::DoCompleteOp
+// Implementation of command completion.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::DoCompleteOp( TAny* aAny )
+    {
+    CVtEngMediaHandler* self = static_cast< CVtEngMediaHandler* >( aAny );
+    self->CompleteOp( self->iAsyncCompleteOpResult );
+    self->iAsyncCompleteOpResult = KErrNone;
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::GetPendingCommand
+//
+// -----------------------------------------------------------------------------
+//
+TVtEngCommandId CVtEngMediaHandler::GetPendingCommand()
+    {
+    if ( iPendingOp )
+        {
+        return iPendingOp->Command();
+        }
+    return KVtEngCommandNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::AssertFlag
+// Checks flag's validity.
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CVtEngMediaHandler::AssertFlag( const TInt aFlag ) const
+#else
+void CVtEngMediaHandler::AssertFlag( const TInt /* aFlag */ ) const
+#endif // _DEBUG
+    {
+    __ASSERT_DEBUG(
+        aFlag == EProtoAudioSourceAdded ||
+        aFlag == EProtoVideoSourceAdded ||
+        aFlag == EProtoAudioSinkAdded ||
+        aFlag == EProtoVideoSinkAdded ||
+        aFlag == EProtoAudioTrackPaused ||
+        aFlag == EProtoVideoTrackPaused ||
+        aFlag == ETwoStageOperation ||
+        aFlag == EProtoPauseVideoRequested ||
+        aFlag == EProtoPauseVideoBlankProv ||
+        aFlag == EProtoContVideoBlankProv ||
+        aFlag == EProtoContVideoBlankInit ||
+        aFlag == ESourceUpdateNeeded ||
+        aFlag == EProtoSendIntraFrame ||
+        aFlag == EProto324IFAcquired ||
+        aFlag == EProtoCancelProtoCmdsOk ||
+        aFlag == EVideoQualitySetByPeer ||
+        aFlag == EOutVideoChannelClosed ||
+        aFlag == EOutAudioChannelClosed,
+        Panic( EVtEngPanicInvalidFlag ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::IsFlag
+// Checks if a certain flag is set.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::IsFlag( const TInt aFlag ) const
+    {
+    AssertFlag( aFlag );
+    if ( iProtoStateFlags & aFlag )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetFlag
+// Sets flag on.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetFlag( const TInt aFlag )
+    {
+    AssertFlag( aFlag );
+    iProtoStateFlags |= aFlag;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ClearFlag
+// Removes a flag.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ClearFlag( const TInt aFlag )
+    {
+    AssertFlag( aFlag );
+    iProtoStateFlags &= ~aFlag;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetVolume
+// Sets volume values to Protocol.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::SetVolume(
+    const TInt aVolume,
+    CVtEngOperation* aOperation )
+    {
+    __VTPRINTENTER( "MH.SetVolume" )
+    TInt res( KErrNotFound );
+    __VTPRINT2( DEBUG_MEDIA, " vol=%d", aVolume )
+    if ( iAudioCtrl )
+        {
+        TInt id( 0 );
+        // Max volume cannot be zero.
+        TInt vol( ( CVtEngUtility::Settings().ValidVolume( aVolume ) ) *
+            ( iProtoMaxVolume / CVtEngUtility::Settings().MaxVolume() ) );
+        __VTPRINT2( DEBUG_MEDIA, "CVtEngMediaHandler::SetVolumeL, vol=%d", vol )
+        TRAP( res, id = iAudioCtrl->SetAudioVolumeL( vol ) );
+        if ( res == KErrNone )
+            {
+            AddOperation( ESetAudioVolume, id );
+            if( aOperation )
+                {
+                AssignPendingOp( *aOperation );
+                }
+            }
+        }
+    __VTPRINTEXITR( "MH.SetVolume %d", res )
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RequestAudioControllerL
+// Requests controllers for audio output and input
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::RequestAudioControllerL()
+    {
+    __VTPRINTENTER( "MH.RequestAudioControllerL" )
+    __VTPRINT( DEBUG_MEDIA, "MH.RequestAudioControllerL" )
+    __ASSERT_ALWAYS(iSessionCommand, Panic( EVtEngPanicInvalidAudioPointer ) );
+
+    TInt id( 0 );
+    iAudioCtrl = VTProtocolFactory::GetAudioConfigCommandL(iRemoteVideo->AudioSink());
+
+    if ( !iAudioCtrl )
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+        __VTPRINTEXIT( "MH.RequestAudioControllerL Failed" )
+        return EFalse;
+        }
+    iAudioCtrl->SetObserverL( this );
+
+    // Get the max value for Protocol volume
+    TRAPD ( res, id = iAudioCtrl->GetMaxAudioVolumeL( iProtoMaxVolume ) ) ;
+    __VTPRINT2( DEBUG_MEDIA, "MH.RequestAudioControllerL: err=%d",res )
+    if ( res != KErrNone)
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+        __VTPRINTEXIT( "MH.RequestAudioControllerL" )
+        return EFalse;
+        }
+
+    res = AddOperation( EGetAudioGetMaxVolume, id );
+    if ( res < KErrNone ) // res is index
+        {
+        CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+        __VTPRINT2( DEBUG_MEDIA, "MH.RequestAudioControllerL::res=%d", res )
+        }
+    __VTPRINTEXIT( "MH.RequestAudioControllerL" )
+    return ETrue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSpatialTradeoffIndication
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSpatialTradeoffIndication(
+    const TUint16 aLogicalChannelId, const TUint8 aTradeOff )
+    {
+    __VTPRINTENTER( "MH.HandleSpatialTradeoffIndication" )
+    __VTPRINT3( DEBUG_MEDIA,
+        "MH.HandleSpatialTradeoffIndication id=%d tradeOff=%d",
+        aLogicalChannelId, aTradeOff )
+    ( void ) aLogicalChannelId;
+    iVideoQuality.UpdateVideoQuality( iVideoQuality.FromTradeOff( aTradeOff ) );
+    __VTPRINTEXIT( "MH.HandleSpatialTradeoffIndication" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleSpatialTradeoffCommandL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleSpatialTradeoffCommandL(
+    const TUint16, const TUint8 aTradeOff )
+    {
+    __VTPRINTENTER( "MH.HandleSpatialTradeoffCommandL" )
+    SetVideoQualityL( iVideoQuality.FromTradeOff( aTradeOff ), EFalse );
+    __VTPRINTEXIT( "MH.HandleSpatialTradeoffCommandL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::EnableVideoL
+// Enables/Disables video sending.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TOperation CVtEngMediaHandler::EnableVideoL(
+    const TBool aEnable, const TOperation aOp )
+    {
+    __VTPRINTENTER( "MH.EnableVideoL" )
+    __VTPRINT3( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV en=%d state=%d",
+        aEnable, iProtoState )
+    TInt cmdId( 0 );
+    TInt err( KErrNone );
+    TOperation op( ENone );
+    MVtEngMedia::TMediaSource currentSource;
+    GetSource( currentSource );
+
+    // Videosource is added and Protocol is in connected state.
+    if ( IsFlag( EProtoVideoSourceAdded ) && iSessionCommand )
+        {
+        __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV source=%d",
+            currentSource )
+        // Has an actual source been selected.
+        if ( ( currentSource == EMediaNone ) || ( currentSource == EMediaShare ) )
+            {
+                __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnaLocVideo blank" )
+            if ( aEnable && IsPending( EEnableVideo) == KErrNotFound )
+                {
+                ClearFlag( EProtoPauseVideoRequested );
+                __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH. Calling ResumeL on Protocol" )
+                TRAP( err, cmdId = iSessionCommand->ResumeVideoL( *iLocalVideo->Source() ) );
+                if ( err != KErrNone )
+                    {
+                    // Log the error and leave, UI handles the rest
+                    __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+                        "MH.EnaLocVideo PauseL left=%d", err )
+                    __VTPRINTEXIT( "MH.EnableVideoL" )
+                    User::Leave( err );
+                    }
+                else
+                    {
+                    op = aOp;
+                    AddOperation( aOp, cmdId );
+                    }
+                }
+            // Video to be paused.
+            else if( !aEnable && IsPending( EDisableVideo ) )
+                {
+                op = DoPauseVideo();
+                }
+            }
+        else // camera or still image
+            {
+            if ( !aEnable && IsPending( EDisableVideo ) )
+                {
+                // Pause video
+                op = DoPauseVideo();
+                }
+            }
+        }
+    else // Not connected and sources not added yet
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.enavideo not conn" )
+        // If we are initializing, then this has to be executed
+        if ( IsFlag( EProtoContVideoBlankProv ) )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.enavideo blank cont" )
+            ClearFlag( EProtoContVideoBlankProv );
+            SetFlag( EProtoContVideoBlankInit );
+            }
+
+        if ( aEnable )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV clear pending" )
+            // Ensure that video sending is enabled in data source.
+            iLocalVideo->ResumeVideoSending();
+            ClearFlag( EProtoPauseVideoRequested );
+            }
+        else
+            {
+            iLocalVideo->PauseVideoSending();
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV set pending" )
+            SetFlag( EProtoPauseVideoRequested );
+            }
+        }
+
+    __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL, "MH.EnableV=%d", err )
+    __VTPRINTEXITR( "MH.EnableVideoL %d", op )
+    return op;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::DoPauseVideo
+// Does video pausing.
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TOperation CVtEngMediaHandler::DoPauseVideo()
+    {
+    __VTPRINTENTER( "MH.DoPauseVideo" )
+    TInt cmdId( 0 );
+    TOperation op( ENone );
+    __VTPRINT( DEBUG_MEDIA, "MH. Calling PauseL on Protocol" )
+    TRAPD( err, cmdId = iSessionCommand->PauseVideoL( *iLocalVideo->Source() ) );
+    if ( err != KErrNone )
+        {
+        __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+            "MH.DoPauseVideo PauseL left=%d", err )
+        // Remove the 2 stage flag, since PauseL failed.
+        // Command should be completed.
+        if( IsFlag( ETwoStageOperation ) )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+                "   Disable 2 stage clearance" )
+            ClearFlag( ETwoStageOperation );
+            }
+        }
+    else
+        {
+        AddOperation( EDisableVideo, cmdId );
+        op = EDisableVideo;
+        __VTPRINT( DEBUG_MEDIA | DEBUG_DETAIL,
+            "MH.DisaLocVideo PauseL issued" )
+        }
+    ClearFlag( EProtoPauseVideoRequested );
+    __VTPRINTEXITR( "MH.DoPauseVideo %d", op )
+    return op;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleAudioOutputControlCommandComplete
+// Callback function for audio controller commands.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleAudioOutputControlCommandComplete(TInt aId,
+    TVtAudioOutputControlCommand aCmd,
+    TAny* /*aContextData*/,
+    TInt aStatus)
+    {
+    __VTPRINTENTER( "MH.HandleAudioOutputControlCommandComplete" )
+    __VTPRINT2( DEBUG_MEDIA, "MH.AudioComC CMD=%d", aCmd )
+    __VTPRINT2( DEBUG_MEDIA, "MH.AudioComC cmdId=%d", aId )
+    __VTPRINT2( DEBUG_MEDIA, "MH.AudioComC stat=%d", aStatus )
+
+    switch ( aCmd )
+        {
+        case EVtAudioOutputControlGetMaxVolume:
+            RemoveOperation( aId );
+            InitializeVolume();
+            break;
+        case EVtAudioOutputControlSetVolume:
+            __VTPRINT2( DEBUG_MEDIA, "MH.protoComC SetVolume=%d",
+                iUpdateVolumeRequired )
+
+            RemoveOperation( aId );
+
+            if ( iUpdateVolumeRequired )
+                {
+                iUpdateVolumeRequired = EFalse;
+                UpdateVolume();
+                }
+
+            if ( IsPending( ESetAudioVolume ) == KErrNotFound &&
+                 iPendingOp == iPendingVolumeOp )
+                {
+                iPendingVolumeOp = NULL;
+                CompleteOp( aStatus );
+                }
+            break;
+        case EVtAudioOutputControlGetBalance:
+        case EVtAudioOutputControlSetBalance:
+        case EVtAudioOutputControlGetVolume:
+        default:
+            break;
+        }
+    __VTPRINTEXIT( "MH.HandleAudioOutputControlCommandComplete" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::InitializeVolume
+// Sets the 'beginning' values for volume.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::InitializeVolume()
+    {
+    __VTPRINT2( DEBUG_MEDIA, "MH.InitializeVolume: max vol=%d", iProtoMaxVolume )
+    iUpdateVolumeAllowed = ETrue;
+    UpdateVolume();
+    if ( iLocalVideo )
+        {
+        iLocalVideo->UnMute();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::DisconnectProtoL
+// Does the disconnecting of Protocol.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::DisconnectProtoL()
+    {
+    __VTPRINTENTER( "MH.DisconnectProtoL" )
+    __VTPRINT2( DEBUG_MEDIA, "MH.DisconnectProto with Protocol state=%d",
+        iProtoState )
+    TInt cmdId( 0 );
+    // The two states that require disconnecting
+    if ( iProtoState == MVtProtocolCommand::EConnected ||
+         iProtoState == MVtProtocolCommand::EConnecting )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH. Calling DisconnectFromProtocolL on Protocol" )
+        TRAPD( err, cmdId = iSessionCommand->DisconnectFromProtocolL() );
+        if ( err == KErrNone )
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH.protoCom: Disconnecting" )
+            AddOperation( EDestructProtoPhaseDisconnect, cmdId );
+            iProtoState = MVtProtocolCommand::EDisconnecting;
+            StartDisconnectTimerL();
+            }
+        else
+            {
+            // Canceling the disconnect to notify that it has failed
+            __VTPRINT2( DEBUG_MEDIA, "MH.DisconnectProto erronous=%d", err )
+            cmdId = err;
+            }
+        }
+    else {
+        cmdId = KErrNotSupported;
+        }
+    __VTPRINTEXITR( "MH.DisconnectProtoL cmdId=%d", cmdId )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CancelAllProtoCommands
+// Cancels all commands pending for execution in Proto.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::CancelAllProtoCommands( TOperation &aOp )
+    {
+    __VTPRINTENTER( "MH.CancelAllProtoCommands" )
+    TInt err( KErrNotReady );
+    aOp = ENone;
+    if ( IsPending( EUninitializeCancelAllProto ) != KErrNotFound )
+        {
+        aOp = EUninitializeCancelAllProto;
+        // Indicate difference from started cancellation with error code.
+        err = KErrAlreadyExists;
+        }
+    else if ( iSessionCommand && iPendingOps && !IsFlag( EProtoCancelProtoCmdsOk ) )
+        {
+        if ( iPendingOps->Count() )
+            {
+            __VTPRINT( DEBUG_MEDIA, "MH. Calling CancelAllCommandsL on Proto" )
+            TInt cmdId( 0 );
+            TRAP( err, ( cmdId = iSessionCommand->CancelAllCommandsL() ) );
+            __VTPRINT2( DEBUG_MEDIA | DEBUG_DETAIL,
+                    "MH.CancelAllProtoCommands cmdId=%d", cmdId )
+            if ( cmdId && err == KErrNone )
+                {
+                aOp =  EUninitializeCancelAllProto;
+                SetFlag( EProtoCancelProtoCmdsOk );
+                AddOperation( aOp, cmdId );
+                }
+            // completes in CommandCompletedL
+            }
+        else {
+            // mark there's nothing to cancel
+            SetFlag( EProtoCancelProtoCmdsOk );
+            }
+        }
+    __VTPRINTEXITR( "MH.CancelAllProtoCommands err=%d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ProtoInitialized
+// Proto init completed.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::ProtoInitialized() const
+    {
+    return iSessionCommand ? ETrue : EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TimerCallback
+// Callback method for timer expiration.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::TimerCallback( TAny* /*aAny*/ )
+    {
+    __VTPRINT( DEBUG_MEDIA, "MH.TimerCallback -> PANIC " )
+    Panic( EVtEngPanicDisconnectTimerExpired );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetVersionInfoL
+// Sets version information to Proto.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetVersionInfoL( )
+    {
+    __VTPRINTENTER( "MH.SetVersionInfoL" )
+
+    if ( !iH324Config )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.SetVersion not ready" )
+        User::Leave( KErrNotReady );
+        }
+
+    // Current new line character index
+    TInt index( 0 );
+
+    // Version information from SysUtil
+    HBufC* versionInfo16 = HBufC::NewLC( KVtEngSwVersionTextLength );
+
+    // Pointer to SysUtil versionInfo descriptor. Temporary pointer to
+    // handle data.
+    TPtr versionInfoptr16( versionInfo16->Des() );
+
+    // SW Version and product information buffers to be send to peer.
+    HBufC8* version = HBufC8::NewLC( KVtEngSwVersionTextLength );
+    HBufC8* product = HBufC8::NewLC( KVtEngSwVersionTextLength );
+    TPtr8 versionPtr8( version->Des() );
+    TPtr8 productPtr8( product->Des() );
+
+    // Marker for line ending '\n'
+    const TChar endLine( KVtEngCharacterEndLine );
+
+    TInt err = ( SysUtil::GetSWVersion( versionInfoptr16 ) );
+    if ( err != KErrNone || !versionInfoptr16.Length() )
+        {
+        __VTPRINT2( DEBUG_MEDIA, "MH.SetVersion SU: %d", err )
+        __VTPRINTEXIT( "MH.SetVersionInfoL" )
+        return;
+        }
+#ifdef VTDEBUG
+    RDebug::Print( _L("SysUtil::GetSWVersion: %s"), versionInfoptr16.Ptr() );
+#endif
+    // Construct similar buffer than for version information and get po
+    HBufC* productInfo16 = versionInfo16->AllocLC();
+    TPtr productInfoptr16( productInfo16->Des() );
+
+    // We assume that format from file is:
+    // SW version\ndate\nproduct\nmanufacturer
+    // \n is new line character
+
+    // Find first new line character
+    index = versionInfo16->Locate( endLine );
+    if ( index >= 0 )
+        {
+        // Replace new line character using space.
+        versionInfoptr16[ index ] = KVtEngCharacterSpace ;
+
+        // Find second new line character, this ends the version information
+        index = versionInfo16->Locate( endLine );
+        if ( index >= 0 )
+            {
+            // Take version information and ignore product info.
+            versionInfoptr16 = versionInfo16->Left( index );
+
+            // Take product information and ignore version information.
+            productInfoptr16 = productInfo16->Mid( index + 1 );
+
+            // Find the only remaining new line character.
+            index = productInfoptr16.Locate( endLine );
+
+            // Replace new line character using space.
+            productInfoptr16[ index ] = KVtEngCharacterSpace;
+
+            // Copy 16 bit descriptors to 8 bit descriptors and append
+            // zero terminators.
+            versionPtr8.Copy( versionInfoptr16 );
+            versionPtr8.ZeroTerminate();
+            productPtr8.Copy( productInfoptr16 );
+            productPtr8.ZeroTerminate();
+
+            // Set the info to Protocol
+#ifdef VTDEBUG
+            RDebug::Print(_L("MH.Product: %s" ), productPtr8.Ptr() );
+            RDebug::Print(_L("MH.Version: %s" ), versionPtr8.Ptr() );
+#endif //VTDEBUG
+
+            AddOperation( ESetVendorId,
+                iH324Config->SetVendorId( KVtEngCountryCodeForProto,
+                KVtEngExtensionForProto,
+                KVtEngManufacturerForProto, &productPtr8, &versionPtr8 ) );
+            }
+        }
+    CleanupStack::PopAndDestroy( 4 ); // HBufC's
+    __VTPRINTEXIT( "MH.SetVersionInfoL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::RequestFrame
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::RequestFrame( )
+    {
+    __VTPRINTENTER( "MH.RequestFrame" )
+    if ( !iH263Encoder )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.RequestFrame FAILED")
+        return;
+        }
+    AddOperation( ESendIntraframe,iH263Encoder->RequestNextIntraFrame() );
+    ClearFlag( EProtoSendIntraFrame );
+
+    __VTPRINTEXIT( "MH.RequestFrame" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetVideoQualityL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetVideoQualityL(
+    const TVideoQuality aVideoQuality, const TBool aSetPeerVideoQuality )
+    {
+    __VTPRINTENTER( "MH.SetVideoQualityL" )
+    if ( !iH263Encoder )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.SetVideoQualityL FAILED")
+        return;
+        }
+    SetFlag( EVideoQualitySetByPeer );
+    TInt protoOperId( iH263Encoder->SetVideoFrameRate(
+        iVideoQuality.ToFrameRate( aVideoQuality ) ) );
+    AddOperation( ESetVideoQuality, protoOperId );
+    iVideoQuality.SettingVideoQuality( protoOperId,
+        aVideoQuality, aSetPeerVideoQuality );
+    __VTPRINTEXIT( "MH.SetVideoQualityL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetPeerVideoQuality
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetPeerVideoQuality( const TVideoQuality aVideoQuality )
+    {
+    __VTPRINTENTER( "MH.SetPeerVideoQuality" )
+    AddOperation( ESendVTSTO, iH324Config->SendVideoTemporalSpatialTradeoffCommand(
+        iVideoIncomingLogicalChannel.iLogicalChannelId,
+        iVideoQuality.ToTradeOff( aVideoQuality ) ) );
+    __VTPRINTEXIT( "MH.SetPeerVideoQuality" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleVideoEncoderCommandCompletedL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleVideoEncoderCommandCompletedL(
+    const TVtCommandResponse& aResponse )
+    {
+    __VTPRINTENTER( "MH.EncExtCommandCompleted" )
+    const TInt type( aResponse.iCmdType );
+    const TInt protoCmdId( aResponse.iCmdId );
+    const TInt protoResponse( aResponse.iCmdStatus );
+    __VTPRINT2( DEBUG_MEDIA, "MH.263 ComC type=%d", type )
+    __VTPRINT3( DEBUG_MEDIA, "MH.263 ComC cmdId=%d,response=%d",
+      protoCmdId, protoResponse )
+
+    // Find correct entry in iPendingOps based on TOperation because there can
+    // be several entries with same Protocol cmd id since each Protocol interface has their
+    // own id allocation and ids may overlap.
+    TInt index( KErrNotFound );
+    TOperation completedOp = ENone;
+    if ( MatchResponseToPendingOps( protoCmdId, ESendIntraframe, &index ) ||
+         MatchResponseToPendingOps( protoCmdId, ESetIFrameInterval, &index ) ||
+         MatchResponseToPendingOps( protoCmdId, ESetVideoQuality, &index ) )
+        {
+        // TOperation entries in are unique in the array...
+        const TCmdOpPair pair = (*iPendingOps)[ index ];
+        completedOp = pair.iOp;
+        // ...so remove based on that instead of protoCmdId
+        RemoveOperation( completedOp );
+        }
+    else
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.EECC ERROR (response to unknown command)" )
+        }
+    if ( completedOp == ESetVideoQuality )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.EECC ESetVideoQuality" )
+        if( iPendingOp && ( iPendingOp->Command() == KVtEngSetVideoQuality ) )
+            {
+            CompleteOp( protoResponse );
+            }
+        if( protoResponse == KErrNone )
+            {
+            TVtEngVideoQuality::TVQSParams vqp;
+
+            if ( iVideoQuality.SettingSucceeded( protoCmdId, vqp ) )
+                {
+                __VTPRINT( DEBUG_MEDIA, "MH.EECC sending vq indication" )
+                AddOperation( ESendVTSTO,
+                    iH324Config->SendVideoTemporalSpatialTradeoffIndication(
+                    iVideoOutgoingLogicalChannel.iLogicalChannelId,
+                    iVideoQuality.ToTradeOff( vqp.iValue ) ) );
+                if ( vqp.iSetPeer )
+                    {
+                    __VTPRINT( DEBUG_MEDIA, "MH.EECC setting peer vq" )
+                    SetPeerVideoQuality( vqp.iValue );
+                    }
+                }
+            }
+        else
+            {
+            iVideoQuality.SettingFailed( protoCmdId );
+            }
+        }
+    if ( iProtoState == MVtProtocolCommand::EIdle )
+        { // Command was complete during uninitialization.
+        NextUninitStepCallbackL();
+        }
+    __VTPRINTEXIT( "MH.EncExtCommandCompleted" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleVideoEncoderInformationalEventL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleVideoEncoderInformationalEventL(
+    const TVtIndicationEvent& aEvent)
+    {
+    const TInt type( aEvent.iEventType );
+    __VTPRINT2( DEBUG_MEDIA, "MH.263 infoevent=%d", type )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleH324MConfigCommandCompletedL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleH324MConfigCommandCompletedL(
+    const TVtCommandResponse& aResponse )
+    {
+	__VTPRINTENTER( "MH.HandleH324MConfigCommandCompletedL" )
+	const TInt protoCmdId( aResponse.iCmdId );
+	const TInt protoResponse( aResponse.iCmdStatus );
+	const TInt type( aResponse.iCmdType );
+
+	__VTPRINT2( DEBUG_MEDIA, "MH.HandleH324MConfigCommandCompletedL type=%d", type )
+    __VTPRINT3( DEBUG_MEDIA, "MH.HandleH324MConfigCommandCompletedL cmdId=%d,response=%d", protoCmdId, protoResponse )
+    TInt index( KErrNotFound );
+    // Find correct entry in iPendingOps based on TOperation because there can
+    // be several entries with same Protocol cmd id since each Protocol interface has their
+    // own id allocation and ids may overlap.
+    if ( MatchResponseToPendingOps( protoCmdId, ESetVendorId, &index ) ||
+         MatchResponseToPendingOps( protoCmdId, ESendVTSTO, &index ) ||
+         MatchResponseToPendingOps( protoCmdId, ESetSupportedResolutions, &index ) ||
+         MatchResponseToPendingOps( protoCmdId, ESetFastCsupOptions, &index ) )
+        {
+        // TOperation entries in are unique in the array...
+        const TCmdOpPair pair = (*iPendingOps)[ index ];
+        // ...so remove based on that instead of protoCmdId
+        RemoveOperation( pair.iOp );
+        }
+    switch( iProtoState )
+        {
+        case MVtProtocolCommand::EConnected:
+            {
+        	CVtEngStateManager* stateManager = CVtEngUtility::StateManager();
+
+        	// Check does the received command ID match to command ID that was received
+        	// from Protocol when DTMF was send.
+        	if( stateManager->Handlers().Dtmf().CheckCommandId( protoCmdId ) )
+        		{
+        		__VTPRINT( DEBUG_MEDIA, "MH.Complete DTMF" )
+        		stateManager->Handlers().Dtmf().SendComplete( protoResponse );
+        		}
+        	}
+            break;
+        case MVtProtocolCommand::EIdle: // extension command complete
+            NextUninitStepCallbackL();
+        default:
+            break;
+        }
+
+	__VTPRINTEXITR( "MH.HandleH324MConfigCommandCompletedL.CommandID %d", aResponse.iCmdId )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::HandleH324MConfigInformationalEventL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::HandleH324MConfigInformationalEventL(
+    const TVtIndicationEvent& aEvent )
+    {
+	__VTPRINTENTER( "MH.HandleH324MConfigInformationalEventL" )
+
+	const TInt type( aEvent.iEventType );
+	const TUint8* buffer = (const_cast<TVtIndicationEvent&>(aEvent)).iLocalBuffer;
+
+	switch(type)
+		{
+		 case EVtIndicationVideoSpatialTamporalTradeOffIndication:
+		 case EVtIndicationVideoSpatialTamporalTradeOffCommand:
+			{
+			TUint16 logicalChannelId = BigEndian::Get16( buffer );
+			TUint8 tradeOffValue = buffer[ 2 ];
+			__VTPRINT3( DEBUG_MEDIA, "MH.protoHIE.H324 channelId=%d, tradeOff=%d",
+				logicalChannelId, tradeOffValue )
+			if( type ==
+				EVtIndicationVideoSpatialTamporalTradeOffIndication )
+				{
+				HandleSpatialTradeoffIndication( logicalChannelId,
+					tradeOffValue );
+				}
+			else
+				{
+				HandleSpatialTradeoffCommandL( logicalChannelId,
+					tradeOffValue );
+				}
+			}
+			break;
+
+		// When remote terminal sends its UII capabilities in TCS we get
+		// indication from Protocol. If remote does not send UII capas in TCS
+		// we are obliged to use alphanumeric UIIs as specified by 245
+		// spec. Default is IA5String.We get bit pattern from Protocol but
+		// they are listed below in preferred order of usage.
+		// The order can be freely chosen.
+		case EVtIndicationUserInputCapability:
+			{
+#ifdef VTDEBUG
+			RDebug::Print(_L("Buffer[0]:%d"), buffer[0] );
+#endif // VTDEBUG
+			__VTPRINT( DEBUG_MEDIA,
+				"MH.protoHIE UserInput Capability Indication" )
+
+			CVtEngStateManager* stateManager =
+				CVtEngUtility::StateManager();
+
+			// IA5String preferred, it's the simplest and most used in TCSs.
+			if ( buffer[0] & CVtEngDtmfHandler::EIA5String )
+				{
+				stateManager->Handlers().Dtmf().SetUIISupport(
+					CVtEngDtmfHandler::EIA5String );
+				CVtEngEventManager::NotifyEvent(
+					KVtEngRemoteUIIIA5StringSupport );
+				__VTPRINT( DEBUG_MEDIA,
+					"KVtEngRemoteUIIIA5StringSupport Support signalled" )
+				}
+			// Basic string is also simple and easy to use, second position.
+			else if ( buffer[0] & CVtEngDtmfHandler::EBasicString )
+				{
+				stateManager->Handlers().Dtmf().SetUIISupport(
+					CVtEngDtmfHandler::EBasicString );
+				CVtEngEventManager::NotifyEvent(
+					KVtEngRemoteUIIBasicStringSupport );
+				__VTPRINT( DEBUG_MEDIA,
+					"KVtEngRemoteUIIBasicStringSupport Support signalled" )
+				}
+			// DTMFs are more limited but more interoperable than
+			// General string.
+			else if ( buffer[0] & CVtEngDtmfHandler::EDTMFString )
+				{
+				stateManager->Handlers().Dtmf().SetUIISupport(
+					CVtEngDtmfHandler::EDTMFString );
+				CVtEngEventManager::NotifyEvent( KVtEngRemoteUIIDtmfSupport );
+				__VTPRINT( DEBUG_MEDIA,
+					"KVtEngRemoteUIIDtmfSupport Support signalled" )
+				}
+			// General string is the complicated one, priority is
+			// lowest because of possible diffuculties in remote
+			// end decoding of string (various number of letter
+			// combinations).
+			else if ( buffer[0] & CVtEngDtmfHandler::EGeneralString )
+				{
+				stateManager->Handlers().Dtmf().SetUIISupport(
+					CVtEngDtmfHandler::EGeneralString );
+				CVtEngEventManager::NotifyEvent(
+					KVtEngRemoteUIIGeneralStringSupport );
+				__VTPRINT( DEBUG_MEDIA,
+					"KVtEngRemoteUIIGeneralStringSupport Support signalled" )
+				}
+			else
+				{
+				__VTPRINT( DEBUG_MEDIA, "MH.HIE invalid DTMF" )
+				Panic( EVtEngPanicInvalidDtmfState );
+				}
+			}
+			break;
+		}
+	__VTPRINTEXIT( "MH.HandleH324MConfigInformationalEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetSupportedResolutionsL
+// Sets supported resolutions to protocol.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetSupportedResolutions()
+    {
+    __VTPRINTENTER( "MH.SetSupportedResolutions" )
+    __ASSERT_ALWAYS( iH324Config != NULL, Panic( EVtEngPanicInvalidPointer ) );
+
+     AddOperation( ESetSupportedResolutions,
+            iH324Config->SetSupportedResolutions( ) );
+    __VTPRINTEXIT( "MH.SetSupportedResolutions " )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::SetFastCsupOptions
+// Sets supported resolutions to Protocol.
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::SetFastCsupOptions()
+	{
+	__VTPRINTENTER( "MH.SetFastCsupOptions" )
+	
+    AddOperation(
+        ESetFastCsupOptions,
+        iH324Config->SetFastCsupOptions( ) );
+    __VTPRINTEXIT( "MH.SetFastCsupOptions" )
+	}
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CreateExtensionsL
+// Creates extension according to API Uid.
+// -----------------------------------------------------------------------------
+//
+CVtEngExtensionBase* CVtEngMediaHandler::CreateExtensionsL( const TUid& aUid )
+    {
+    __VTPRINTENTER( "MH.CreateExtensionsL" )
+
+    // if UID is supported camera pref
+    if ( aUid == KVtEngExtensionCameraPreferences )
+    	{
+    	__VTPRINT2( DEBUG_GEN, "MH.CreateExtensionsL extension UID=%d",
+    		aUid.iUid )
+
+    	CVtEngExtensionBase* base = reinterpret_cast< CVtEngExtensionBase* >
+    		( iLocalVideo->CreateCameraPreferencesL() );
+    	__VTPRINTEXITR( "MH.CreateExtensionsL base [%d]", ( TInt )base )
+        return base;
+    	}
+
+#if defined ( RD_VT_RTF )
+
+    // if UID is supported R2F
+    else if ( aUid == KVtEngExtensionRecord2File )
+    	{
+    	 CVtEngExtensionBase* base = reinterpret_cast< CVtEngExtensionBase* >
+    		( CVtEngRecord2File::NewL() );
+    	__VTPRINTEXITR( "MH.CreateExtensionsL base [%d]", ( TInt )base )
+        return base;
+    	}
+    // not supported UID
+
+#endif //RD_VT_RTF
+
+    else
+    	{
+    	__VTPRINTEXITR( "MH.CreateExtensionsL error [%d]", KErrNotSupported )
+    	User::Leave( KErrNotSupported);
+    	return NULL;
+    	}
+    }
+
+// Implementation for TVtEngVideoQuality
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::TVtEngVideoQuality
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TVtEngVideoQuality::TVtEngVideoQuality()
+    : iCurrent( EVideoQualityNormal ), iParamList( 1 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::~TVtEngVideoQuality
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TVtEngVideoQuality::~TVtEngVideoQuality()
+    {
+    iParamList.Reset();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::SettingVideoQuality
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::TVtEngVideoQuality::SettingVideoQuality(
+    TInt aId, const TVideoQuality aValue, TBool aSetPeer )
+    {
+    __VTPRINTENTER( "MH.VQ.SettingVideoQuality" )
+    iParamList.Append( TVQSParams( aId, aValue, aSetPeer ) );
+    __VTPRINTEXIT( "MH.VQ.SettingVideoQuality" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::VideoQuality
+// -----------------------------------------------------------------------------
+//
+MVtEngMedia::TVideoQuality
+    CVtEngMediaHandler::TVtEngVideoQuality::VideoQuality() const
+    {
+    __VTPRINTENTER( "MH.VQ.VideoQuality" )
+    __VTPRINTEXITR( "MH.VQ.VideoQuality %d", iCurrent )
+    return iCurrent;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::IsSetPeer
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::TVtEngVideoQuality::SettingSucceeded( TInt aId,
+    TVQSParams& aParams )
+    {
+    __VTPRINTENTER( "MH.VQ.SettingSucceeded" )
+    TInt index( FindVQSParam( aId ) );
+    TBool foundRecord( index != KErrNotFound );
+    if ( foundRecord )
+        {
+        aParams = iParamList[ index ];
+        iParamList.Remove( index );
+        iParamList.Compress();
+        }
+    __VTPRINTEXITR( "MH.VQ.SettingSucceeded %d", foundRecord )
+    return foundRecord;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::IsSetPeer
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::TVtEngVideoQuality::UpdateVideoQuality(
+    const TVideoQuality aVideoQuality )
+    {
+    __VTPRINTENTER( "MH.VQ.UpdateVideoQuality" )
+    iCurrent = aVideoQuality;
+    __VTPRINTEXIT( "MH.VQ.UpdateVideoQuality" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::SettingFailed
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::TVtEngVideoQuality::SettingFailed( TInt aId )
+    {
+    __VTPRINTENTER( "MH.VQ.SettingFailed" )
+    TInt index( FindVQSParam( aId ) );
+    if ( index != KErrNotFound )
+        {
+        iParamList.Remove( index );
+        iParamList.Compress();
+        }
+    __VTPRINTEXITR( "MH.VQ.SettingFailed %d", index )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::FromTradeOff
+// -----------------------------------------------------------------------------
+//
+MVtEngMedia::TVideoQuality
+    CVtEngMediaHandler::TVtEngVideoQuality::FromTradeOff(
+    const TInt aTradeOff ) const
+    {
+    __VTPRINTENTER( "MH.VQ.FromTradeOff" )
+    TVideoQuality videoQuality;
+
+    // [0 .. KVtEngTradeOffDetailMax]
+    if( aTradeOff <= KVtEngTradeOffDetailMax )
+        {
+        videoQuality = EVideoQualityDetail;
+        }
+    // ]KVtEngTradeOffDetailMax .. KVtEngTradeOffNormalMax]
+    else if( aTradeOff <= KVtEngTradeOffNormalMax )
+        {
+        videoQuality = EVideoQualityNormal;
+        }
+    // ]KVtEngTradeOffNormalMax .. 31]
+    else
+        {
+        videoQuality = EVideoQualityMotion;
+        }
+    __VTPRINTEXITR( "MH.VQ.FromTradeOff %d", videoQuality )
+    return videoQuality;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::ToFrameRate
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::TVtEngVideoQuality::ToFrameRate(
+    const TVideoQuality aVideoQuality ) const
+    {
+    __VTPRINTENTER( "MH.VQ.ToFrameRate" )
+    TInt frameRate( 0 );
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+    switch( aVideoQuality )
+        {
+        case EVideoQualityDetail:
+            frameRate = settings.VideoQualityFrameRateConfig().iDetail;
+            break;
+
+        case EVideoQualityNormal:
+            frameRate = settings.VideoQualityFrameRateConfig().iNormal;
+            break;
+
+        case EVideoQualityMotion:
+            frameRate = settings.VideoQualityFrameRateConfig().iMotion;
+            break;
+
+        default:
+            Panic( EVtEngPanicInvalidVideoQualityValue );
+            break;
+        }
+    __VTPRINTEXITR( "MH.VQ.ToFrameRate %d", frameRate )
+    return frameRate;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::ToTradeOff
+// -----------------------------------------------------------------------------
+//
+TUint8 CVtEngMediaHandler::TVtEngVideoQuality::ToTradeOff(
+    const TVideoQuality aVideoQuality ) const
+    {
+    __VTPRINTENTER( "MH.VQ.ToTradeOff" )
+    TUint8 tradeOff( 0 );
+    switch( aVideoQuality )
+        {
+        case EVideoQualityDetail:
+            tradeOff = KVtEngTradeOffDetailMax;
+            break;
+
+        case EVideoQualityNormal:
+            tradeOff = KVtEngTradeOffNormalMax;
+            break;
+
+        case EVideoQualityMotion:
+            tradeOff = KVtEngTradeOffMotionMax;
+            break;
+
+        default:
+            Panic( EVtEngPanicInvalidVideoQualityValue );
+            break;
+        }
+    __VTPRINTEXITR( "MH.VQ.ToTradeOff %d", tradeOff )
+    return tradeOff;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::FindVQSParam
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngMediaHandler::TVtEngVideoQuality::FindVQSParam( TInt aId ) const
+    {
+    __VTPRINTENTER( "MH.VQ.FindVQSParam" )
+    TInt result( KErrNotFound );
+    for ( TInt i = iParamList.Count() - 1; i >= 0; i-- )
+        {
+        if ( iParamList[ i ].iId == aId )
+            {
+            result = i;
+            break;
+            }
+        }
+    __VTPRINTEXITR( "MH.VQ.FindVQSParam %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::TVQSParams::TVQSParams
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TVtEngVideoQuality::TVQSParams::TVQSParams()
+    {
+    Mem::FillZ( this, sizeof( TVQSParams ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::TVtEngVideoQuality::TVQSParams::TVQSParams
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler::TVtEngVideoQuality::TVQSParams::TVQSParams(
+    TInt aId, const TVideoQuality aValue, TBool aSetPeer )
+    : iId( aId ), iValue( aValue ), iSetPeer( aSetPeer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::QueryProtoInterfacesL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::QueryProtoInterfacesL()
+	{
+	__VTPRINTENTER( "MH.QueryProtoInterfacesL" )
+	// Ensure call is still connected to prevent unnecessary Protocol
+	// interface acquisition
+    CVtEngStateManager* states = CVtEngUtility::StateManager();
+	const MVtEngSessionInfo::TSessionState sessionState =
+	    states->SessionState();
+      if ( sessionState != MVtEngSessionInfo::EIdle &&
+	       sessionState != MVtEngSessionInfo::EClearing )
+
+        {
+    	// Request the 324M Stack interface
+    	if ( !IsFlag( EProto324IFAcquired ) )
+    		{
+    		/*
+    		AddOperation( EGet324CtrlInterface,
+    			iSessionCommand->GetProtocolInterfaceL(
+    				EVtH324Config,
+    				( MVtProtocolCommand*& ) iH324Config ));
+    				*/
+    		MVtProtocolCommand *pCommand = NULL;
+    		AddOperation( EGet324CtrlInterface,
+    		    iSessionCommand->GetProtocolInterfaceL(
+    		        EVtH324Config,
+    		        ( MVtProtocolCommand*& ) pCommand ));           
+    		iH324Config = static_cast<MVtH324ConfigCommand *>(pCommand);
+    		}
+    	// Get encoder interface.
+    	/*
+    	AddOperation( EGetH263EncInterface,
+    		iSessionCommand->GetProtocolInterfaceL(
+    			EVtVideoEncoderConfig,
+    			( MVtProtocolCommand*& ) iH263Encoder ));
+    			*/
+    	MVtProtocolCommand *pCommand = NULL;
+    	AddOperation( EGetH263EncInterface,
+    	    iSessionCommand->GetProtocolInterfaceL(
+    	        EVtVideoEncoderConfig,
+    	        ( MVtProtocolCommand*& ) pCommand ));       
+    	iH263Encoder = static_cast<MVtVideoConfigCommand *>(pCommand);
+        }
+	__VTPRINTEXIT( "MH.QueryProtoInterfacesL" )
+	}
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ReleaseProtoInterfacesL
+// -----------------------------------------------------------------------------
+//
+void CVtEngMediaHandler::ReleaseProtoInterfacesL()
+	{
+	__VTPRINTENTER( "MH.ReleaseProtoInterfacesL" )
+
+	// Release interfaces
+	__VTPRINT( DEBUG_MEDIA, "LCN: MH.324 started to release interfaces" )
+	if( iH324Config )
+		{
+		/*
+		AddOperation( ERemove324CtrlInterface,
+        iSessionCommand->DeleteProtocolInterfaceL( EVtH324Config, iH324Config ) );*/
+		MVtProtocolCommand *pCommand = NULL;
+		pCommand = static_cast<MVtProtocolCommand *>(iH324Config);
+		AddOperation( ERemove324CtrlInterface,
+		        iSessionCommand->DeleteProtocolInterfaceL( EVtH324Config, pCommand ) );     
+        iH324Config = 0;
+		__VTPRINT( DEBUG_MEDIA, "MH.324 started to release" )
+        }
+
+    if ( iH263Encoder )
+        {
+        /*
+		AddOperation( ERemoveH263EncInterface,
+        iSessionCommand->DeleteProtocolInterfaceL( EVtVideoEncoderConfig, iH263Encoder ) );*/
+        MVtProtocolCommand *pCommand = NULL;
+        pCommand = static_cast<MVtProtocolCommand *>(iH263Encoder);
+        AddOperation( ERemoveH263EncInterface,
+                iSessionCommand->DeleteProtocolInterfaceL( EVtVideoEncoderConfig, pCommand ) );        
+                iH263Encoder = 0;
+		iH263Encoder = 0;
+        __VTPRINT( DEBUG_MEDIA, "MH.263 started to release" )
+        }
+	__VTPRINTEXIT( "MH.ReleaseProtoInterfacesL" )
+	}
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::ExtensionCommandsPending
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::ExtensionCommandsPending() const
+    {
+    __VTPRINTENTER( "MH.ExtensionCommandsPending" )
+    TBool isPending = EFalse;
+    TInt count( iPendingOps->Count() );
+    while ( count-- )
+        {
+        const TOperation op = ( *iPendingOps )[ count ].iOp;
+        switch ( op )
+            {
+            // extension commands
+            case ESendIntraframe:
+            case ESetSupportedResolutions:
+            case ESetVideoQuality:
+			case ESendVTSTO:
+            case ESetFastCsupOptions:
+            case ESetVendorId:
+            case ESetIFrameInterval:
+                isPending = ETrue;
+#ifdef _DEBUG
+                RDebug::Print( _L("  (ext) op=%d,protoCmdId=%d"),
+                    op, ( *iPendingOps )[ count ].iProtoCmdId );
+#else
+// in debug mode allow printing all pending ops to log
+                count = 0; // break loop
+#endif
+                break;
+            default:
+                break;
+            }
+        }
+    __VTPRINTEXITR( "MH.ExtensionCommandsPending %d", isPending )
+    return isPending;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::MediaAddingValidity
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngMediaHandler::MediaAddingValidity() const
+    {
+    __VTPRINTENTER( "MH.MediaAddingValidity" )
+
+    TBool addingOK( ETrue );
+    CVtEngStateManager* states = CVtEngUtility::StateManager();
+    MVtEngSessionInfo::TSessionState sessionState ( states->SessionState() );
+    if( sessionState == MVtEngSessionInfo::EClearing ||
+        sessionState == MVtEngSessionInfo::EIdle )
+        {
+        __VTPRINT( DEBUG_MEDIA, "MH.MediaAddingValidity NOT ALLOWED" )
+        // State is wrong, adding not allowed.
+        addingOK = EFalse;
+        }
+
+    __VTPRINTEXITR( "MH.MediaAddingValidity %d", addingOK )
+
+    return addingOK;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngMediaHandler::CancelInitializeShareImage
+// -----------------------------------------------------------------------------
+void CVtEngMediaHandler::CancelInitializeShareImage()
+    {
+    __VTPRINTENTER( "CVtEngMediaHandler.CancelInitializeShareImage");
+    if(iLocalVideo)
+        {
+        iLocalVideo->CancelInitializeShareImage();
+        }
+    __VTPRINTEXIT( "CVtEngMediaHandler.CancelInitializeShareImage");
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Media/CVtEngRemoteVideo.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,737 @@
+/*
+* 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:  Remote video handler.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngRemoteVideo.h"
+#include    "CVtEngStateManager.h"
+#include    "MVtEngFrameObserver.h"
+#include    <videotelephonyvariant.hrh>
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngEventManager.h"
+#include    "VtEngConstants.h"
+#include    "VtEngPanic.h"
+#include    "TVtEngRenderingDSA.h"
+#include    "TVtEngRenderingDP.h"
+#include    "TVtEngRenderingNGA.h"
+#include    "TVtEngRenderConfigDSA.h"
+#include    "TVtEngRenderConfigDP.h"
+#include    "TVtEngRenderConfigNGA.h"
+#include    "CVtEngDrawDP.h"
+#include    "CVtEngDrawDSA.h"
+#include    "CVtEngDrawNGA.h"
+#include    <fbs.h>
+#include    <w32std.h>
+#include    <cvtlogger.h>
+#include    <mvtprotocolhandler.h>
+#include    <featmgr.h>
+
+// LOCAL CONSTANTS AND MACROS
+// This active object priority.
+const TInt KVtEngRemoteDrawPriority = CActive::EPriorityStandard;
+
+// Timer priority when not frame watching.
+const TInt KVtEngStoppedRenderPriority = CActive::EPriorityLow;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngRemoteVideo
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo::CVtEngRemoteVideo(
+    MVtSessionCommand& aSessionCommand,
+    CVtEngStateManager& aStateManager ) :
+    iSessionCommand( aSessionCommand),
+    iStateManager( aStateManager ),
+    iEnableNGA(ETrue)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::ConstructL()
+    {
+    __VTPRINTENTER( "RV.ConstructL" )
+    //We are in the Proto ESetup state
+    iDrawer =
+        static_cast< CVtEngDraw* >( VtEngDrawFactory::CreateDrawerL( this , iEnableNGA) );
+    //Add protocol Data Sink;
+    iDisplaySink = iDrawer->DisplaySink();
+    iAudioSink = VTProtocolFactory::CreateAudioSink();
+    __VTPRINTEXIT( "RV.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo* CVtEngRemoteVideo::NewL(
+    MVtSessionCommand& aSessionCommand,
+    CVtEngStateManager& aStateManager )
+    {
+    CVtEngRemoteVideo* self = new( ELeave )
+        CVtEngRemoteVideo( aSessionCommand, aStateManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngRemoteVideo
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo::~CVtEngRemoteVideo()
+    {
+    __VTPRINTENTER( "RV.~" )
+	VTProtocolFactory::DeleteAudioSink( iAudioSink );
+    delete iDrawer;
+    __VTPRINTEXIT( "RV.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::SetRenderingParametersL
+// Sets parameters for rendering the remote video.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::SetRenderingParametersL(
+    const TVtEngRenderingOptionsNGA& aParams )
+    {
+    __VTPRINTENTER( "RV.SetRenderingParametersL NGA" )
+        
+    // If rendering is ongoing, stop it
+    StopVideoRendering();
+    // Set new values
+    TVtEngRenderConfigNGA config( aParams );
+    iDrawer->BaseSetConfigL( config );
+    __VTPRINTEXIT( "RV.SetRenderingParametersL NGA" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::SetRenderingParametersL
+// Sets parameters for rendering the remote video.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::SetRenderingParametersL(
+    const TVtEngRenderingOptionsDSA& aParams )
+    {
+    __VTPRINTENTER( "RV.SetRenderingParametersL DSA" )
+
+    __VTPRINT( DEBUG_MEDIA , "================== RV.Params ==================" )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iRect.iTl.iX %d", aParams.iRect.iTl.iX )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iRect.iTl.iY %d", aParams.iRect.iTl.iY )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iRect.iBr.iX %d", aParams.iRect.iBr.iX )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iRect.iBr.iY %d", aParams.iRect.iBr.iY )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iClipRect.iTl.iX %d",
+        aParams.iClipRect.iTl.iX )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iClipRect.iTl.iY %d",
+        aParams.iClipRect.iTl.iY )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iClipRect.iBr.iX %d",
+        aParams.iClipRect.iBr.iX )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iClipRect.iBr.iY %d",
+        aParams.iClipRect.iBr.iY )
+    __VTPRINT( DEBUG_MEDIA , "================== RV.Params ==================" )
+    // If rendering is ongoing, stop it
+    StopVideoRendering();
+    // Set new values
+    TVtEngRenderConfigDSA config( aParams );
+    iDrawer->BaseSetConfigL( config );
+    __VTPRINTEXIT( "RV.SetRenderingParametersL DSA" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::SetRenderingParametersL
+// Sets parameters for rendering the remote video.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::SetRenderingParametersL(
+    const TVtEngRenderingOptionsDP& aParams )
+    {
+    __VTPRINTENTER( "RV.SetRenderingParametersL DP" )
+
+    __VTPRINT( DEBUG_MEDIA , "================== RV.Params ==================" )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iRect.iTl.iX %d", aParams.iRect.iTl.iX )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iRect.iTl.iY %d", aParams.iRect.iTl.iY )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iRect.iBr.iX %d", aParams.iRect.iBr.iX )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iRect.iBr.iY %d", aParams.iRect.iBr.iY )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iClipRect.iTl.iX %d",
+        aParams.iClipRect.iTl.iX )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iClipRect.iTl.iY %d",
+        aParams.iClipRect.iTl.iY )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iClipRect.iBr.iX %d",
+        aParams.iClipRect.iBr.iX )
+    __VTPRINT2( DEBUG_MEDIA , "    aParams.iClipRect.iBr.iY %d",
+        aParams.iClipRect.iBr.iY )
+    __VTPRINT( DEBUG_MEDIA , "================== RV.Params ==================" )
+    // If rendering is ongoing, stop it
+    StopVideoRendering();
+    // Set new values
+    TVtEngRenderConfigDP config( aParams );
+    iDrawer->BaseSetConfigL( config );
+    __VTPRINTEXIT( "RV.SetRenderingParametersL DP" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::StartVideoL
+//
+// For incoming, this function starts/resumes playing out the media to the
+// appropriate sink based on the current settings.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::StartVideoL()
+    {
+    __VTPRINTENTER( "RV.StartVideoL" )
+    if ( iDisplaySink && iDrawer &&
+         ( iDrawer->IsFlag( CVtEngDraw::EFlagInitialized ) ||
+           iDrawer->IsFlag( CVtEngDraw::EBaseConstructCalled ) ) )
+        {
+        iDrawer->BaseStartDrawL();
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    __VTPRINTEXIT( "RV.StartVideoL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::StopVideoRendering
+// Stops rendering of remote video.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::StopVideoRendering()
+    {
+    __VTPRINTENTER( "RV.StopVideoRendering" )
+    // Stop only if active
+    if( iDrawer->GetDsaState() )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RV.Stopping" )
+        iDrawer->BaseStopDraw();
+        }
+    __VTPRINTEXIT( "RV.StopVideoRendering" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::AddVideoSinkL
+// Adds a sink for video to proto.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngRemoteVideo::AddVideoSinkL( TInt aChannelId )
+    {
+    __VTPRINTENTER( "RV.AddVideoSinkL" )
+    if ( iDisplaySink == NULL )
+        {
+        User::Leave( KErrNotReady );
+        }
+    TInt id = iSessionCommand.AddVideoSinkL(
+        aChannelId, *iDisplaySink );
+    iDrawer->VideoSinkAdded();
+    __VTPRINTEXITR( "RV.AddVideoSinkL id=%d", id )
+    return id;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::AddAudioSinkL
+// Adds a sink for audio to proto.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngRemoteVideo::AddAudioSinkL( TInt aChannelId )
+    {
+    __VTPRINTENTER( "RV.AddAudioSinkL" )
+    if ( iAudioSink == NULL )
+        {
+        User::Leave( KErrNotReady );
+        }
+    TInt id = iSessionCommand.AddAudioSinkL( aChannelId, *iAudioSink );
+    __VTPRINTEXITR( "RV.AddAudioSinkL id=%d", id )
+    return id;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::GetDsaState
+// Returns state of Direct Screen Access.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngRemoteVideo::GetDsaState() const
+    {
+    return iDrawer->GetDsaState();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::PauseVideoL
+//
+// For an incoming track  this function pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngRemoteVideo::PauseVideoL()
+    {
+    __VTPRINTENTER( "RV.PauseVideoL" )
+    if ( iDisplaySink == NULL )
+        {
+        User::Leave( KErrNotReady );
+        }
+    TInt cmdId = iSessionCommand.PauseVideoL( *iDisplaySink );
+    __VTPRINTEXITR( "RV.PauseVideoL id=%d", cmdId )
+    return cmdId;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::AudioSink
+// Returns audio sink.
+// -----------------------------------------------------------------------------
+//
+MVTAudioSink* CVtEngRemoteVideo::AudioSink()
+    {
+    return iAudioSink;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::SetUIForegroundL
+// Sets UI foreground state.
+// -----------------------------------------------------------------------------
+void CVtEngRemoteVideo::SetUIForegroundL( TBool aForeground )
+    {
+    __VTPRINTENTER( "RV.SetUIForegroundL" )
+    if( !iDisplaySink )
+        {
+        User::Leave( KErrNotReady );
+        }
+    if( aForeground )
+        {
+        __VTPRINT( DEBUG_MEDIA, " RV.Resuming" )
+        iDisplaySink->Resume();
+        }
+    else
+        {
+        __VTPRINT( DEBUG_MEDIA, " RV.Pausing" )
+        iDisplaySink->Pause();
+        }
+    iDrawer->BaseSetUIForegroundL( aForeground );
+    __VTPRINTEXIT( "RV.SetUIForegroundL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::RequestLastFrame
+// Request update last remote video frame through MVtEngFrameObserver::vtSetFrame
+// -----------------------------------------------------------------------------
+void CVtEngRemoteVideo::RequestLastFrame()
+    {
+    __VTPRINTENTER( "RV.RequestLastFrame" )
+    if(iDrawer)
+        iDrawer->BaseRequestLastFrame();
+__VTPRINTEXIT( "RV.RequestLastFrame" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::~CVtEngDraw
+// Destructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo::CVtEngDraw::~CVtEngDraw()
+    {
+    __VTPRINTENTER( "RVD.~" )
+    Cancel();
+    delete iWatcher;
+    delete iDSA;
+    if ( iDisplaySink )
+        {
+        iDisplaySink->Destroy();
+        }
+    __VTPRINTEXIT( "RVD.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::CVtEngDraw
+// C++ constructor. Cannot leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngRemoteVideo::CVtEngDraw::CVtEngDraw( MDisplaySinkObserver* aObserver ) :
+    CActive( KVtEngRemoteDrawPriority ), iCheckpoint( KVtEngWatcherThreshold ),
+    iObserver( aObserver ), iCallback( WatcherExpired, this ),
+    iDSUpdated( ETrue )
+    {
+    iSourceSize = TSize( KVtEngRemoteVideoDefaultWidth,
+            KVtEngRemoteVideoDefaultHeight );
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::ConstructL( )
+    {
+    __VTPRINTENTER( "RVD.ConstructL" )
+    BaseConstructL();
+    // Create sink
+    iDisplaySink = CreateSinkL();
+    iWatcher = CPeriodic::NewL( KVtEngStoppedRenderPriority );
+    __VTPRINTEXIT( "RVD.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::AbortNow
+// Aborts DSA when requested by Window Server.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::AbortNow(
+    RDirectScreenAccess::TTerminationReasons /*aReason*/ )
+    {
+    __VTPRINTENTER( "RVD.AbortNow" )
+    ClearFlag( EReadyForeground | EStarted );
+    BaseAbortNow();
+    __VTPRINTEXIT( "RVD.AbortNow" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::Restart
+// Restarts DSA.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::Restart(
+    RDirectScreenAccess::TTerminationReasons /*aReason*/ )
+    {
+    __VTPRINTENTER( "RVD.Restart" )
+    TRAPD( err,
+        {
+        if ( !IsFlag( EStarted ) )
+            {
+            if ( !iDSA->IsActive() )
+                {
+                iDSA->StartL();
+                }
+            SetFlag( EStarted );
+            }
+        if ( !Config().iClipRect.IsEmpty() )
+            {
+            __VTPRINT3( DEBUG_MEDIA, "RVD.Restart iClipRect.iTl (%d, %d)",
+                Config().iClipRect.iTl.iX, Config().iClipRect.iTl.iY );
+            __VTPRINT3( DEBUG_MEDIA, "RVD.Restart iClipRect.iBr (%d, %d)",
+                Config().iClipRect.iBr.iX, Config().iClipRect.iBr.iY );
+            iDSA->Gc()->SetClippingRect( Config().iClipRect );
+            }
+        BaseRestartL();
+        } );
+    if ( err != KErrNone )
+        {
+        ClearFlag( EReadyForeground );
+        }
+    else
+        {
+        SetFlag( EReadyForeground );
+        }
+
+    __VTPRINT2( DEBUG_MEDIA, "RVD.Restart flags %d", iFlags )
+    if ( iCheckpoint == KVtEngWatcherThreshold )
+        {
+        __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "RVD.Restart RFs" )
+        TRAP( err, BaseRefreshL() );
+        }
+    __VTPRINTEXITR( "RVD.Restart %d", err )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::GetDsaState
+// Returns the state of DSA: is drawing ongoing.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngRemoteVideo::CVtEngDraw::GetDsaState() const
+    {
+    __VTPRINTENTER( "RVD.GetDsaState" )
+    TBool active( EFalse );
+    active = IsFlag( ERemoteVideoDrawing );
+    __VTPRINTEXITR( "RVD.GetDsaState is active=%d", active )
+    return active;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::WatcherExpired
+// Checks if frame watcher has expired, ie. no frames are received.
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngRemoteVideo::CVtEngDraw::WatcherExpired( TAny* aAny )
+    {
+    CVtEngRemoteVideo::CVtEngDraw* drawer =
+        reinterpret_cast<CVtEngRemoteVideo::CVtEngDraw*>( aAny );
+    drawer->HandleWatcherExpired();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::HandleWatcherExpired
+// Does the checking for frame reception.
+// If not receiving, notify using client (VT UI).
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::HandleWatcherExpired()
+    {
+    __VTPRINTENTER( "RVD.WatcherExpired" )
+    if ( IsFlag( EStarted ) )
+        {
+        __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN, "RVD.WatcherExpired RF:%d",
+            iCheckpoint )
+        if ( iCheckpoint != KVtEngWatcherThreshold &&
+             IsFlag( EFirstFrameReceived ) )
+            {
+            __VTPRINT( DEBUG_MEDIA | DEBUG_RETURN, "RVD.WatcherExpired RF" )
+            TRAP_IGNORE( BaseRefreshL() );
+            }
+        iCheckpoint--;
+        // Not under zero though.
+        if ( iCheckpoint < 0 )
+            {
+            iCheckpoint = 0;
+            }
+        }
+    __VTPRINTEXIT( "RVD.WatcherExpired" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::SetFlag
+// Sets flags.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::SetFlag( TUint aFlags )
+    {
+    iFlags |= aFlags;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::ClearFlag
+// Clears (unsets) flags.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::ClearFlag( TUint aFlags )
+    {
+    iFlags &= ~aFlags;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::IsFlag
+// Tests a flag.
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngRemoteVideo::CVtEngDraw::IsFlag( TUint aFlag ) const
+    {
+    return ( iFlags & aFlag ) != 0 ;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::VideoSinkAdded
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::VideoSinkAdded()
+    {
+    // By clearing this flag every time when sink is added, we assure that
+    // blind icon is correctly faded in UI.
+    ClearFlag( EFirstFrameReceived );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::Activate
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::Activate()
+    {
+    __VTPRINTENTER( "RVD.Activate" )
+    if ( !IsActive() )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD.Activate setting active" )
+        iStatus = KRequestPending;
+        SetActive();
+        }
+    __VTPRINTEXIT( "RVD.Activate" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::ConfigUpdatedL
+// Set drawing configuration.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::ConfigUpdatedL()
+    {
+    __VTPRINTENTER( "RVD.ConfigUpdatedL" )
+    ClearFlag( EFlagInitialized );
+    TRAPD( err, {
+            BaseVerifyConfigL();
+            
+            if ( IsFlag( EReadyInternal ) )
+                {
+                __VTPRINT( DEBUG_MEDIA, "RVD.SetC started" )
+                SetFlag( EStarted );
+                __VTPRINT( DEBUG_MEDIA, "RVD.SetC notify rvd start" )
+                }
+            BaseRefreshBitmapsL();
+            } );
+    if ( err != KErrNone )
+        {
+        __VTPRINT2( DEBUG_MEDIA | DEBUG_RETURN, "RVD.SetC FAILED %d", err )
+        CVtEngEventManager::NotifyEvent( KVtEngMediaInitFailure );
+        }
+    User::LeaveIfError( err );
+    SetFlag( EFlagInitialized );
+    __VTPRINTEXIT( "RVD.ConfigUpdatedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::DisplaySink
+// Returns used display sink.
+// -----------------------------------------------------------------------------
+//
+MDisplaySink* CVtEngRemoteVideo::CVtEngDraw::DisplaySink()
+    {
+    return iDisplaySink;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::DoCancel()
+    {
+    __VTPRINTENTER( "RVD.DoCancel" )
+    BaseDoCancel();
+    iDisplaySink->Release();
+    ClearFlag( EStarted | EFrameWatcherExpired );
+    __VTPRINTEXIT( "RVD.DoCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::RunError
+// -----------------------------------------------------------------------------
+//
+#ifdef VTDEBUG
+TInt CVtEngRemoteVideo::CVtEngDraw::RunError( TInt aError )
+#else
+TInt CVtEngRemoteVideo::CVtEngDraw::RunError( TInt /* aError */ )
+#endif // VTDEBUG
+    {
+    __VTPRINTENTER( "RVD.RunError" )
+    ClearFlag( EStarted );
+    BaseStopDraw();
+    CVtEngEventManager::NotifyEvent( KVtEngRemoteVideoStopped );
+    __VTPRINTEXITR( "RVD.RunError %d", aError )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::CVtEngDraw::CreateAndStartDSAL
+// Create DSA instance.
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::CVtEngDraw::CreateAndStartDSAL()
+    {
+    __VTPRINTENTER( "RVD.CreateAndStartDSAL" )
+    delete iDSA;
+    iDSA = NULL;
+    iDSA = CDirectScreenAccess::NewL(
+    *Config().iWsSession,
+    *Config().iWsSreenDevice,
+    *Config().iWindow,
+    *this );
+    iDSA->StartL();
+    if ( !Config().iClipRect.IsEmpty() )
+        {
+        __VTPRINT( DEBUG_MEDIA, "RVD.CreateAndStartDSAL setting cliprect" )
+        iDSA->Gc()->SetClippingRect( Config().iClipRect );
+        }
+    __VTPRINTEXIT( "RVD.CreateAndStartDSAL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngRemoteVideo::VideoFrameSizeChanged
+// Callback from DisplaySink to inform the size change
+// -----------------------------------------------------------------------------
+//
+void CVtEngRemoteVideo::
+    VideoFrameSizeChangedL( const TSize& /* aFrom */, const TSize& aTo )
+    {
+    __VTPRINTENTER( "RVD.VideoFrameSizeChangedL" )
+    __VTPRINT( DEBUG_MEDIA , " ======= RV.RVD.VideoFrameSizeChangedL ========" )
+    __VTPRINT2( DEBUG_MEDIA , "    aTo.iWidth: %d", aTo.iWidth)
+    __VTPRINT2( DEBUG_MEDIA , "    aTo.iHeight: %d", aTo.iHeight )
+    __VTPRINT( DEBUG_MEDIA , " ======= RV.RVD.VideoFrameSizeChangedL ========" )
+
+    // Notification of changed layout.
+    if ( aTo.iHeight == KVtEngResolutionQCIFHeight &&
+        aTo.iWidth == KVtEngResolutionQCIFWidth )
+        {
+	    // Store the new size.
+	    iDrawer->iSourceSize = aTo;
+        CVtEngEventManager::NotifyEvent( KVtEngResolutionToQCIF );
+        }
+    else if ( aTo.iHeight == KVtEngResolutionSQCIFHeight &&
+        aTo.iWidth == KVtEngResolutionSQCIFWidth )
+        {
+	    // Store the new size.
+	    iDrawer->iSourceSize = aTo;
+        CVtEngEventManager::NotifyEvent( KVtEngResolutionToSQCIF );
+        }
+    else
+        {
+        // Unlisted resolution.
+        __VTPRINTEXITR( "RVD.VideoFrameSizeChangedL %d", 0 )
+        return;
+        }
+
+    iDrawer->BaseVideoFrameSizeChangedL( aTo );
+
+    __VTPRINTEXITR( "RVD.VideoFrameSizeChangedL %d", 1 )
+    }
+
+// VtEngDrawFactory
+
+// -----------------------------------------------------------------------------
+// VtEngDrawFactory::CreateDrawerL
+// -----------------------------------------------------------------------------
+//
+MVtEngDraw* VtEngDrawFactory::CreateDrawerL( MDisplaySinkObserver* aObserver, TBool aSupportNGA )
+    {
+    __VTPRINTENTER( "VtEngDrawFactory.CreateDrawerL" )
+    MVtEngDraw* drawer = NULL;
+    if(aSupportNGA)
+        {
+        drawer = CVtEngDrawNGA::NewL( aObserver );
+        }
+    else
+        {
+    if ( FeatureManager::FeatureSupported( KFeatureIdDisplayPost ) )
+	    {
+	    drawer = CVtEngDrawDP::NewL( aObserver );
+	    }
+        else
+	    {
+	    drawer = CVtEngDrawDSA::NewL( aObserver );
+	    }
+        }
+    __VTPRINTEXIT( "VtEngDrawFactory.CreateDrawerL" )
+    return drawer;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/Session/CVtEngSessionHandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,323 @@
+/*
+* 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:  Session handler.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngSessionHandler.h"
+#include    "CVtEngOperation.h"
+#include    "CVtEngStateManager.h"
+#include 	"cvtengincomingcallmonitor.h"
+#include    "vtengcommands.h"
+#include    "CVtEngOperation.h"
+#include    "CVtCtlFactory.h"
+#include    "MVtCtlCallControl.h"
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+#include    "VtCtlTypes.h" // for TVtCtlCSSessionInfoV1 
+#include    "cvtlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::CVtEngSessionHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngSessionHandler::CVtEngSessionHandler() 
+    : CActive( CActive::EPriorityStandard ), iIncomingCallMonitor(NULL)
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::ConstructL()
+    {
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+    StartIncomingCallMonitorL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngSessionHandler* CVtEngSessionHandler::NewL(  )
+    {
+    CVtEngSessionHandler* self = new( ELeave ) 
+        CVtEngSessionHandler( );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::~CVtEngSessionHandler
+// Destructor
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngSessionHandler::~CVtEngSessionHandler()
+    {
+    __VTPRINTENTER( "SH.~" )
+    Cancel();
+    Uninitialize();
+    delete iIncomingCallMonitor;
+    __VTPRINTEXIT( "SH.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::HandleL
+// Performs session request.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::HandleL( 
+    CVtEngOperation& /*aOperation*/ )
+    {
+    __VTPRINT( DEBUG_SESSION, "SH.HandleL leave not supported" )
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::State
+// Returns session state
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngSessionHandler::State( 
+    TBool aForcedRefresh ) const
+    {
+    CVtEngStateManager* states = CVtEngUtility::StateManager();
+    if ( aForcedRefresh )
+        {
+        states->Update();
+        }
+    return states->SessionState();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::GetDirection
+// Returns direction.
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSessionHandler::GetDirection( 
+    TDirection& aDirection ) const
+    {
+    __VTPRINTENTER( "SH.GetDirection" )
+    if ( !iSessionControl )
+        {
+        __VTPRINTEXITR( "SH.GetDirection err=%d", KErrNotFound )
+        return KErrNotFound;
+        }
+
+    TVtCtlCSSessionInfoV1 info;
+    TPckg<TVtCtlCSSessionInfoV1> pckg( info );
+    TRAPD( err, iSessionControl->GetSessionInfoL( KActiveSessionId, pckg ) );
+    if ( err == KErrNone )
+        {
+        switch ( info.iDirection )
+            {
+            case MVtCtlCallControl::EDirectionMobileOriginated:
+                aDirection = EDirectionMO;
+                break;
+            case MVtCtlCallControl::DirectionMobileTerminated:
+                aDirection = EDirectionMT;
+                break;
+            default:
+                aDirection = EDirectionNone;
+                break;
+            }
+        }
+    __VTPRINT2( DEBUG_SESSION, "SH.direction dir=%d", aDirection )
+    __VTPRINTEXITR( "SH.GetDirection err=%d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::GetDuration
+// Returns session duration.
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSessionHandler::GetDuration( 
+    TDuration& aDuration,
+    TBool& aEnabled ) const
+    {
+    if ( !iSessionControl )
+        {
+        return KErrNotFound;
+        }
+
+    TVtCtlDuration duration;
+    TInt err ( iSessionControl->GetDuration( KActiveSessionId, duration ) );
+    if ( err == KErrNone )
+        {
+        aDuration = duration;
+        const CVtEngSettings& settings = CVtEngUtility::Settings();
+        aEnabled = settings.Config().iCallTimerOn;
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::GetCLI
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CVtEngSessionHandler::GetCLI( TCLI& aCLI ) const
+    {
+    const CVtEngSettings& settings = CVtEngUtility::Settings();
+    const TBool isValid = settings.GetCLI( aCLI);
+    TInt res = KErrNone;
+    if ( !isValid )
+        {
+        res = KErrNotReady;    
+        }
+    return res;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::HandleVtSessionEventL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::HandleVtSessionEventL( 
+    TVtCtlEvent aEvent,
+    TAny* /*aParams*/ )
+    {
+    if ( aEvent == KVtCtlEventSessionStatusChanged )
+        {
+        CVtEngStateManager* states = CVtEngUtility::StateManager();
+        states->Update( );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::InitializeL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::InitializeL()
+    {
+    __VTPRINTENTER( "SH.Initilialize" )
+    if ( iSessionControl )
+        {
+        // already initialized
+        __VTPRINTEXIT( "SH.Initilialize" )
+        return;
+        }
+    TInt err = iLib.Load( KVtCtlLibraryName() );
+    CleanupClosePushL( iLib );
+    if ( err == KErrNone )
+        {
+        TLibraryFunction func = iLib.Lookup( 1 );
+        iFactory = reinterpret_cast<CVtCtlFactory*>( func() );
+        iSessionControl = iFactory->CreateCallControlL( *this );
+        
+        // Update state
+        CVtEngStateManager* states = CVtEngUtility::StateManager();
+        states->Update();
+        }    
+    CleanupStack::Pop(); // lib
+    __VTPRINTEXIT( "SH.Initilialize" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::Uninitialize
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::Uninitialize()
+    {
+    if ( iFactory )
+        {
+        iFactory->Delete( iSessionControl );
+        delete iFactory;
+        iFactory = NULL;
+        iSessionControl = NULL;
+        }
+    iLib.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::RealState
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+MVtCtlCallControl::TVtCtlState CVtEngSessionHandler::RealState() const
+    {
+    MVtCtlCallControl::TVtCtlState state( MVtCtlCallControl::EUnknown );
+    if ( iSessionControl )
+        {
+        state = iSessionControl->GetSessionState( KActiveSessionId );
+        __VTPRINT2( DEBUG_SESSION, "SH.realState=%d", state )
+        }
+    return state;
+    }
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::RunL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::RunL()
+    {
+    InitializeL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::DoCancel
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::DoCancel()
+    {
+    // nothing here
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngSessionHandler::StartIncomingCallMonitorL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngSessionHandler::StartIncomingCallMonitorL()
+    {
+    iIncomingCallMonitor = CVtEngIncomingCallMonitor::NewL();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngDtmfBuffered.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* 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:  Buffered state of DTMF sending.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngDtmfState.h"
+#include    "VtEngPanic.h"
+#include    <cvtlogger.h>
+
+// CONSTANTS
+const TInt KVtEngDtmfToneBufferSize = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::NewL
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState* CVtEngDtmfBuffered::NewL( 
+    MVtEngDtmfHandler& aDtmfHandler,
+    MVtH324ConfigCommand& aH324Config )
+    {
+    CVtEngDtmfBuffered* self = new ( ELeave ) 
+        CVtEngDtmfBuffered( aDtmfHandler, aH324Config );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::~CVtEngDtmfBuffered
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfBuffered::~CVtEngDtmfBuffered()
+    {
+    delete iTones;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::SendDtmfL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfBuffered::SendDtmfL( const TVtEngDtmfTone& aTone )
+    {
+    // just add to buffer and wait for completion of pending send operation.
+    iTones->AppendL( aTone );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::DtmfSendCompleteL
+// 
+// PSEUDO CODE:
+// deallocate Protocol dtmf instance
+// if ( previous_sending_OK )
+//     if ( tones_in_buffer > 1 )
+//         next_state = buffered
+//     else
+//         next_state = sending
+//     endif
+//     send tone from buffer and change state
+// endif
+// if ( previous_sending_FAIL or new_sending_FAIL )
+//     reset buffer 
+//     next_state = idle
+// endif
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfBuffered::DtmfSendCompleteL( TInt aError )
+    {
+    __VTPRINTENTER( "DtmfStateBuffered.DtmfSendCompleteL" )
+    CVtEngDtmfState::DtmfSendCompleteL( aError );
+    const TInt count( iTones->Count() );
+    __VTPRINT2( DEBUG_MEDIA , "DtmfStateBuffered.Send bufSize=%d", count )
+
+    TInt index( KErrNone );
+    if ( count && aError == KErrNone )
+        {
+        __VTPRINT2( DEBUG_MEDIA , "DtmfStateBuffered cnt=%d", count )
+        const TVtEngDtmfTone& tone = iTones->At( index );
+        MVtEngDtmfHandler::TVtEngDtmfState nextState = ( count > 1 ) ?
+            MVtEngDtmfHandler::EVtDtmfStateBuffered :
+            MVtEngDtmfHandler::EVtDtmfStateSending;
+        TRAP( aError, DoSendAndActivateStateL( tone, nextState ) );
+        iTones->Delete( index );
+        }
+    
+    if ( aError != KErrNone )
+        {
+        __VTPRINT2( DEBUG_MEDIA , "DtmfStateBuffered.failed=%d", aError )
+        // if failed clear DTMF buffer and go to dtmf idle state
+        iTones->Reset();
+        iDtmfHandler.ActivateState( MVtEngDtmfHandler::EVtDtmfStateIdle );
+        }
+    __VTPRINTEXIT( "DtmfStateBuffered.DtmfSendCompleteL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::CVtEngDtmfBuffered
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfBuffered::CVtEngDtmfBuffered( 
+    MVtEngDtmfHandler& aDtmfHandler,
+    MVtH324ConfigCommand& aH324Config ) 
+    : CVtEngDtmfState( aDtmfHandler, aH324Config)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfBuffered::ConstructL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfBuffered::ConstructL()
+    {
+    iTones = new ( ELeave ) 
+        CArrayFixFlat<TVtEngDtmfTone>( KVtEngDtmfToneBufferSize );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngDtmfIdle.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* 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:  Idle state of DTMF sending.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngDtmfState.h"
+#include    "VtEngPanic.h"
+#include    "MVtEngDtmfHandler.h"
+#include    <cvtlogger.h>
+#include    <mvtprotocolhandler.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::NewL
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState* CVtEngDtmfIdle::NewL( 
+    MVtEngDtmfHandler& aDtmfHandler,
+    MVtH324ConfigCommand& aH324Config )
+    {
+    CVtEngDtmfIdle* self = new ( ELeave ) 
+        CVtEngDtmfIdle( aDtmfHandler, aH324Config );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::~CVtEngDtmfIdle
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfIdle::~CVtEngDtmfIdle()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::SendDtmfL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfIdle::SendDtmfL( const TVtEngDtmfTone& aTone )
+    {
+    __VTPRINTENTER( "DtmfStateIdle.Send" )
+    DoSendAndActivateStateL( aTone, MVtEngDtmfHandler::EVtDtmfStateSending );    
+    __VTPRINTEXIT( "DtmfStateIdle.Send" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::DtmfSendCompleteL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfIdle::DtmfSendCompleteL( TInt /*aError*/ )
+    {
+    __VTPRINT( DEBUG_MEDIA , "DtmfStateIdle.SendComplete" )
+    // Do nothing (should be never called since state is always
+    // "sending" or "buffered" when sending is completed).
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfIdle::CVtEngDtmfIdle
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfIdle::CVtEngDtmfIdle( 
+    MVtEngDtmfHandler& aDtmfHandler,
+    MVtH324ConfigCommand& aH324Config ) 
+    : CVtEngDtmfState( aDtmfHandler, aH324Config )
+    {
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngDtmfSending.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* 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:  Sending state of DTMF sending.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngDtmfState.h"
+#include    "VtEngPanic.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::NewL
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState* CVtEngDtmfSending::NewL( 
+    MVtEngDtmfHandler& aDtmfHandler,
+    MVtH324ConfigCommand& aH324Config )
+    {
+    CVtEngDtmfState* self = new ( ELeave ) 
+        CVtEngDtmfSending( aDtmfHandler, aH324Config );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::~CVtEngDtmfSending
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfSending::~CVtEngDtmfSending()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::SendDtmfL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfSending::SendDtmfL( const TVtEngDtmfTone& aTone )
+    {
+    __VTPRINTENTER( "DtmfStateSending.Send" )
+    CVtEngDtmfState& state = iDtmfHandler.ActivateState( 
+        MVtEngDtmfHandler::EVtDtmfStateBuffered );
+    // let buffered state handle this
+    state.SendDtmfL( aTone );
+    __VTPRINTEXIT( "DtmfStateSending.Send" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::DtmfSendCompleteL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfSending::DtmfSendCompleteL( TInt aError )
+    {
+    __VTPRINTENTER( "DtmfStateSending.SendComplete" )
+    CVtEngDtmfState::DtmfSendCompleteL( aError );
+    // sending complete, change state
+    iDtmfHandler.ActivateState( MVtEngDtmfHandler::EVtDtmfStateIdle );
+    __VTPRINTEXIT( "DtmfStateSending.SendComplete" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfSending::CVtEngDtmfSending
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfSending::CVtEngDtmfSending( 
+    MVtEngDtmfHandler& aDtmfHandler,
+    MVtH324ConfigCommand& aH324Config ) 
+    :  CVtEngDtmfState( aDtmfHandler, aH324Config )
+    {
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngDtmfState.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* 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:  Base state class of DTMF sending.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngDtmfState.h"
+#include    "MVtEngDtmfHandler.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfState::CVtEngDtmfState
+// 
+// -----------------------------------------------------------------------------
+//
+CVtEngDtmfState::CVtEngDtmfState( 
+    MVtEngDtmfHandler& aDtmfHandler,
+    MVtH324ConfigCommand& aH324Config ) :
+    iDtmfHandler( aDtmfHandler ),
+    iH324Config( aH324Config )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfState::DtmfSendCompleteL
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfState::DtmfSendCompleteL( TInt /*aError*/ )
+    {
+    __VTPRINTENTER( "DtmfState.DtmfSendCompleteL" )
+    iDtmfHandler.ReleaseProtoDtmf();
+    __VTPRINTEXIT( "DtmfState.DtmfSendCompleteL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngDtmfState::DoSendAndActivateStateL
+//
+// Requests new Protocol dtmf tone instance from the DTMF handler, sends it and
+// changes state. 
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngDtmfState::DoSendAndActivateStateL(
+    const TVtEngDtmfTone& aDtmf,
+    MVtEngDtmfHandler::TVtEngDtmfState aNewState )
+    {
+    __VTPRINTENTER( "DtmfState.DoSendAndActivateStateL" )
+    MVTUserInput& protoDtmf = iDtmfHandler.ReserveProtoDtmfL( aDtmf );
+    iDtmfHandler.StoreCommandId( iH324Config.SendUserInputMessageL( protoDtmf ));
+    iDtmfHandler.ActivateState( aNewState );
+    __VTPRINTEXIT( "DtmfState.DoSendAndActivateStateL" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateAlerting.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* 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:  Base class for states
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngStateAlerting.h"
+#include    <cvtlogger.h>
+#include    "CVtEngOperation.h"
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngAudioHandler.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::CVtEngStateAlerting
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateAlerting::CVtEngStateAlerting( 
+    CVtEngStateManager& aStateManager,
+    CVtEngEventManager& aEventManager )
+    : CVtEngStateBase( aStateManager, aEventManager )
+    {
+    }
+
+// Destructor
+CVtEngStateAlerting::~CVtEngStateAlerting()
+    {
+    __VTPRINT( DEBUG_DESTRUCT, "~StateAlrt")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::UpdateL
+// Updates state.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateAlerting::UpdateL()
+    {
+    __VTPRINTENTER(  "StateAlert.Update" )
+    const MVtCtlCallControl::TVtCtlState bearerstate = 
+        SessionHandler().RealState();
+    CVtEngStateBase* newState = NULL;
+    if ( bearerstate == MVtCtlCallControl::EIdle ||
+         bearerstate == MVtCtlCallControl::EDisconnecting )
+        {
+        newState = NewStateL( MVtEngSessionInfo::EIdle );
+        }
+    else
+        {
+        newState = NegotiatingOrConnectedStateL(); // or null
+        }
+    if ( newState )
+        {
+        newState->OpenL( this );
+        }
+    __VTPRINTEXIT( "StateAlert.Update")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::OpenL
+// State transition to alerting state.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateAlerting::DoOpenL()
+    {
+    __VTPRINTENTER( "StateAlert.Open" )
+    NotifyStateChange( MVtEngSessionInfo::ERemoteAlerting );
+    
+    // Instantiate temporary devsound for audio routing
+    AudioHandler().SetRoutingEnablerL( ETrue );
+    __VTPRINTEXIT( "StateAlert.Open" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::ValidateCommand
+// Returns if a command is valid in idle state.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateAlerting::ValidateCommand(
+    const TVtEngCommandId aCommandId )
+    {
+    __VTPRINT( DEBUG_DETAIL |DEBUG_GEN, "StateAlert.Validate" )
+    TBool okToPerform( EFalse );
+    switch ( aCommandId )
+        {
+        case KVtEngInitializeEngine:
+        case KVtEngInitializeEngineDiag:
+        case KVtEngInitializeEngineTest:
+        case KVtEngSetSource:
+        case KVtEngPrepareViewFinder:
+        case KVtEngPrepareViewFinderDSA:
+        case KVtEngPrepareViewFinderDP:
+        case KVtEngStartViewFinder:
+        case KVtEngPauseViewFinder:
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRenderNGA:
+            okToPerform = ETrue;
+            break;
+        default:
+            okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+            break;
+        }
+    return okToPerform;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::State
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateAlerting::State() const
+    {
+    return MVtEngSessionInfo::ERemoteAlerting;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateAlerting::HandleL
+// Handles an operation when behavior is state dependent.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateAlerting::HandleL( 
+    CVtEngOperation& aOp )
+    {
+    TBool handled( CVtEngStateBase::HandleL( aOp ));
+    return handled;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateBase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,395 @@
+/*
+* 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:  Base class for states
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngStateBase.h"
+#include    "CVtEngOperation.h"
+#include    "CVtEngHandlerContainer.h"
+#include    "TVtEngOperationUtils.h"
+#include    "CVtEngStateInitializing.h"
+#include    "CVtEngStateAlerting.h"
+#include    "CVtEngStateRinging.h"
+#include    "CVtEngStateConnected.h"
+#include    "CVtEngStateClearing.h"
+#include    "CVtEngStateOpen.h"
+#include    "CVtEngStateNegotiating.h"
+#include    "CVtEngStateIdle.h"
+#include    "CVtEngSettings.h"
+#include    "MVtEngSessionInfo.h"
+#include    "VtEngUtils.h"
+#include    "VtEngPanic.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::CVtEngStateBase
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateBase::CVtEngStateBase(
+    CVtEngStateManager& aStateManager,
+    CVtEngEventManager& aEventManager )
+    : iStateManager( aStateManager ),
+      iEventManager( aEventManager )
+    {
+    }
+
+// Destructor
+CVtEngStateBase::~CVtEngStateBase()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::OpenL
+// Changes state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::OpenL( CVtEngStateBase* aOldState )
+    {
+    __VTPRINTENTER( "StateBase.Open" )
+    __VTPRINT( DEBUG_GEN, "StateBase. **** State Change ****" )
+    iStateManager.SetState( *this );
+    if ( aOldState )
+        {
+        aOldState->Close();
+        }
+    // call derived class open.
+    DoOpenL();
+    __VTPRINTEXIT( "StateBase.Open" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::Close
+// Closes state.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::Close()
+    {
+    delete this;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::SaveToSettingsL
+//
+// Saves configuration to settings.
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::SaveToSettingsL( CVtEngOperation& aOp )
+    {
+    const TVtEngCommandId command( aOp.Command() );
+
+    if ( command == KVtEngSetAudioVolume )
+        {
+        MVtEngAudio::TVtEngOutputVolume volume;
+        TVtEngOpParamUtil<MVtEngAudio::TVtEngOutputVolume>::Set( volume, aOp );
+        CVtEngSettings& settings = CVtEngUtility::Settings();
+        settings.SetVolume( volume.iHandsetVolume, volume.iHandsfreeVolume, ETrue );
+        settings.SetVolume( volume.iHandsetVolume, volume.iHandsfreeVolume, EFalse );
+        }    
+    }
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::NotifyStateChangeL
+// Notifies state change to event manager.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::NotifyStateChange(
+    MVtEngSessionInfo::TSessionState /*aNewState*/ )
+    {
+    iEventManager.SessionStateChanged( );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::SetVideoEnabled
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::SetVideoEnabled( TBool aEnabled )
+    {
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+        settings.SetVideoEnabled( aEnabled );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::HandleL
+// Handles an operation when behavior is state dependent.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateBase::HandleL( CVtEngOperation& aOp )
+    {
+    __VTPRINTENTER( "StateBase.Handle" )
+    __VTPRINT2( DEBUG_GEN, "StateBase.Handle cmd=%d", aOp.Command() )
+    TBool handled( EFalse );
+    switch ( aOp.Command() )
+        {
+        case KVtEngSetAudioRouting:
+            // Change audio routing
+            AudioHandler().HandleL( aOp );
+            break;
+
+        case KVtEngSetAudioVolume:
+        case KVtEngIncreaseAudioVolume:
+        case KVtEngDecreaseAudioVolume:
+            // Change audio volume
+            MediaHandler().HandleL( aOp );
+            break;
+        case KVtEngTerminateSession:
+        default:
+            break;
+        }
+    __VTPRINTEXITR( "StateBase.Handle handled=%d", handled )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::SessionHandler
+// Returns session handler.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngSessionHandler& CVtEngStateBase::SessionHandler()
+    {
+    MVtEngSessionInfo& msession = iStateManager.Handlers().Session();
+    CVtEngSessionHandler& handler =
+        static_cast<CVtEngSessionHandler&>( msession );
+    return handler;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::MediaHandler
+// Returns media handler.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngMediaHandler& CVtEngStateBase::MediaHandler()
+    {
+    MVtEngMedia& msession = iStateManager.Handlers().Media();
+    CVtEngMediaHandler& handler =
+        static_cast<CVtEngMediaHandler&>( msession );
+    return handler;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::AudioHandler
+// Returns audio handler.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngAudioHandler& CVtEngStateBase::AudioHandler()
+    {
+    MVtEngAudio& maudio = iStateManager.Handlers().Audio();
+    CVtEngAudioHandler& handler =
+        static_cast<CVtEngAudioHandler&>( maudio );
+    return handler;
+    }
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::SessionHandler
+// Returns session handler.
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngStateBase* CVtEngStateBase::NewStateL(
+    const MVtEngSessionInfo::TSessionState aState )
+    {
+    CVtEngStateBase* newState = NULL;
+    switch ( aState )
+        {
+        case MVtEngSessionInfo::EIdle:
+            newState = new ( ELeave )
+                CVtEngStateIdle( iStateManager, iEventManager );
+            break;
+        case MVtEngSessionInfo::EInitializing:
+            newState = new ( ELeave )
+                CVtEngStateInitializing( iStateManager, iEventManager );
+            break;
+        case MVtEngSessionInfo::ERemoteAlerting:
+            newState = new ( ELeave )
+                CVtEngStateAlerting( iStateManager, iEventManager );
+            break;
+        case MVtEngSessionInfo::EReceiving:
+            newState = new ( ELeave )
+                CVtEngStateRinging( iStateManager, iEventManager );
+            break;
+        case MVtEngSessionInfo::EConnected:
+            newState = new ( ELeave )
+                CVtEngStateConnected( iStateManager, iEventManager );
+            break;
+        case MVtEngSessionInfo::ENegotiating:
+            newState = new ( ELeave )
+                CVtEngStateNegotiating( iStateManager, iEventManager );
+            break;
+        case MVtEngSessionInfo::EOpen:
+            newState = new ( ELeave )
+                CVtEngStateOpen( iStateManager, iEventManager );
+            break;
+        case MVtEngSessionInfo::EClearing:
+            newState = new ( ELeave )
+                CVtEngStateClearing( iStateManager, iEventManager );
+            break;
+        default:
+            Panic( EVtEngPanicInvalidSessionState );
+            break;
+        }
+    return newState;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::NegotiatingOrConnectedStateL
+//
+// -----------------------------------------------------------------------------
+//
+CVtEngStateBase* CVtEngStateBase::NegotiatingOrConnectedStateL(
+    TBool aAcceptOnlyNegotiating )
+    {
+    __VTPRINTENTER( "StateBase.NegOrCon" )
+    __VTPRINT2( DEBUG_GEN, "StateBase.NegOrCon %d", aAcceptOnlyNegotiating)
+    const MVtCtlCallControl::TVtCtlState bearerstate =
+        SessionHandler().RealState();
+    CVtEngStateBase* newState = NULL;
+    if ( bearerstate == MVtCtlCallControl::EConnected )
+        {
+        const MVtProtocolCommand::TVtProtocolState state( MediaHandler().ProtoState() );
+        const CVtEngSettings& settings = CVtEngUtility::Settings();
+        const TBool readyForConnect = settings.Config().iReadyForConnect;
+
+		__VTPRINT3( DEBUG_GEN, "StateBase.NegOrCon readyForConnect:%d, state:%d", readyForConnect, state)
+		__VTPRINT2( DEBUG_GEN, "StateBase.NegOrCon iIsDataportLoaned:%d", settings.Config().iIsDataportLoaned)
+
+        if ( readyForConnect && state == MVtProtocolCommand::ESetup && settings.Config().iIsDataportLoaned )
+            {
+            __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                "StateBase.NegOrCon ready & ESetup")
+            const TInt res( MediaHandler().Connect() );
+            if ( res == KErrNotReady )
+                {
+                // Cannot be done yet, need to wait for an operation
+                // to complete.
+                __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                    "StateBase.NegOrCon not ready" )
+                }
+            else if ( res != KErrNone )
+                {
+                __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                    "StateBase.NegOrCon fail")
+                iEventManager.NotifyEvent( KVtEngNegotiationProblem );
+                }
+            else
+                {
+                // change to negotiating state
+                newState = NewStateL( MVtEngSessionInfo::ENegotiating );
+                __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                    "StateBase.NegOrCon-->negotiating")
+                }
+            }
+        else if ( !aAcceptOnlyNegotiating )
+            {
+            newState = NewStateL( MVtEngSessionInfo::EConnected );
+            __VTPRINT( DEBUG_GEN | DEBUG_DETAIL,
+                "StateBase.NegOrCon-->connected")
+            }
+        }
+    __VTPRINTEXIT( "StateBase.NegOrCon" )
+    return newState;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::TerminateSessionL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateBase::TerminateSessionL( CVtEngOperation& aOp )
+    {
+    // State transition to "clearing state" initiates disconnect on protocol.
+    CVtEngStateBase* newState = NewStateL( MVtEngSessionInfo::EClearing );
+    // just store aOp for callback to UI
+    CVtEngMediaHandler& mHandler = MediaHandler();
+    CleanupStack::PushL( newState );
+    newState->OpenL( this );
+    CleanupStack::Pop(); // newState
+    mHandler.HandleL( aOp );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateBase::ValidateCommand
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateBase::ValidateCommand(
+            const TVtEngCommandId aCommandId )
+    {
+    __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateBase.Validate")
+    TBool okToPerform( EFalse );
+    switch ( aCommandId )
+        {
+            // Flow through, ok to execute ==>  check the state possibilities
+        case KVtEngInitializeEngine:
+        case KVtEngInitializeEngineDiag:
+        case KVtEngInitializeEngineTest:
+        case KVtEngResetEngine:
+        case KVtEngStartRenderRemote:
+        case KVtEngStopRenderRemote:
+        case KVtEngPrepareRemoteRender:
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRenderNGA:        
+        case KVtEngPrepareViewFinder:
+        // Media
+        case KVtEngSetUIForeground:
+            okToPerform = ETrue;
+            break;
+        case KVtEngPrepareCamera:
+        case KVtEngSetSource:
+        case KVtEngSetZoomStep:
+        case KVtEngStartViewFinder:
+        case KVtEngFreeze:
+        case KVtEngUnfreeze:
+        case KVtEngSetVideoQuality:
+        case KVtEngHandleLayoutChange:
+
+        // Media object sharing
+        case KVtEngInitializeShareImage:
+        case KVtEngStartShareImage:
+        case KVtEngStopShareImage:
+
+        case KVtEngMuteOutgoingAudio:
+        case KVtEngUnmuteOutgoingAudio:
+        case KVtEngSetAudioRouting:
+        case KVtEngSetAudioVolume:
+        case KVtEngIncreaseAudioVolume:
+        case KVtEngDecreaseAudioVolume:
+        case KVtEngRequestLastRemoteFrame:
+
+            okToPerform =
+                ( MediaHandler().ValidateCommand( aCommandId ) == KErrNone );
+            break;
+        default:
+            case KVtEngTerminateSession: // valid only in open state
+            break;
+        }
+    return okToPerform;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateClearing.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,144 @@
+/*
+* 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:  Base class for states
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngStateClearing.h"
+#include    <cvtlogger.h>
+#include    "CVtEngOperation.h"
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::CVtEngStateClearing
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateClearing::CVtEngStateClearing( 
+    CVtEngStateManager& aStateManager,
+    CVtEngEventManager& aEventManager )
+    : CVtEngStateBase( aStateManager, aEventManager )
+    {
+    }
+
+// Destructor
+CVtEngStateClearing::~CVtEngStateClearing()
+    {
+    __VTPRINT( DEBUG_DESTRUCT, "~StateClr")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::UpdateL
+// Updates state.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateClearing::UpdateL()
+    {
+    __VTPRINTENTER( "StateClr.Update" )
+    const MVtCtlCallControl::TVtCtlState bearerstate = 
+        SessionHandler().RealState();
+    const MVtProtocolCommand::TVtProtocolState protostate( MediaHandler().ProtoState() );
+
+    __VTPRINT2( DEBUG_GEN, "StateClr.bearerState=%d", bearerstate )
+    __VTPRINT2( DEBUG_GEN, "StateClr.protoState=%d", protostate )
+
+    if ( bearerstate == MVtCtlCallControl::EIdle ||
+         bearerstate == MVtCtlCallControl::EDisconnecting ||
+         bearerstate == MVtCtlCallControl::EUnknown ||
+         protostate == MVtProtocolCommand::EIdle || 
+         protostate == MVtProtocolCommand::ESetup )
+        {
+        CVtEngStateBase* idleState = NewStateL( MVtEngSessionInfo::EIdle );
+        idleState->OpenL( this );
+        }
+    __VTPRINTEXIT( "StateClr.Update" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::OpenL
+// State transition to clearing state.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateClearing::DoOpenL()
+    {
+    __VTPRINTENTER( "StateClr.Open")
+    
+    // Do disconnect on Protocol, it is possible that disconnect is already
+    // ongoing and we get error and that's fine.
+    TInt err( MediaHandler().Disconnect() );
+    if ( err != KErrNone && err != KErrAlreadyExists )
+        {
+        __VTPRINT2( DEBUG_GEN, "StateClr.OpenL disconnect fail=%d", err)
+        }
+    // Reset settings
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+    settings.ResetAll();
+    NotifyStateChange( MVtEngSessionInfo::EClearing );
+    __VTPRINTEXIT( "StateClr.Open")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::ValidateCommand
+// Returns if a command is valid in idle state.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateClearing::ValidateCommand(
+            const TVtEngCommandId aCommandId )
+    {
+    TBool okToPerform( EFalse );
+    switch ( aCommandId )
+        {
+        case KVtEngTerminateSession:
+            break;
+        default:
+            okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+            break;
+        }
+    return okToPerform;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::State
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateClearing::State() const
+    {
+    return MVtEngSessionInfo::EClearing;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateClearing::HandleL
+// Handles an operation when behavior is state dependent.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateClearing::HandleL( CVtEngOperation& aOp )
+    {
+    TBool handled( CVtEngStateBase::HandleL( aOp ));
+    return handled;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateConnected.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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:  Base class for states
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngStateConnected.h"
+#include    <cvtlogger.h>
+#include    "CVtEngOperation.h"
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::CVtEngStateConnected
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateConnected::CVtEngStateConnected( 
+    CVtEngStateManager& aStateManager,
+    CVtEngEventManager& aEventManager )
+    : CVtEngStateBase( aStateManager, aEventManager )
+    {
+    }
+
+// Destructor
+CVtEngStateConnected::~CVtEngStateConnected()
+    {
+    __VTPRINT( DEBUG_DESTRUCT, "~StateConnected")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::UpdateL
+// Updates state.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateConnected::UpdateL()
+    {
+    __VTPRINTENTER( "StateConnected.Update")
+    const MVtCtlCallControl::TVtCtlState bearerstate = 
+        SessionHandler().RealState();
+    MVtProtocolCommand::TVtProtocolState state( MediaHandler().ProtoState() );
+    
+        
+    CVtEngStateBase* newState = NULL;
+    if ( bearerstate != MVtCtlCallControl::EConnected )
+        {
+        // we've lost bearer connection, go to idle
+        newState = NewStateL( MVtEngSessionInfo::EIdle );
+        }
+    else if ( state == MVtProtocolCommand::EConnected )
+        {
+        // protocol is open (should always go through neg.state but just in case)
+        // change to open state
+        newState = NewStateL( MVtEngSessionInfo::EOpen );
+        }
+    else if ( state == MVtProtocolCommand::EDisconnecting ||
+              state == MVtProtocolCommand::EResetting )
+        {
+        // change to clearing state
+        newState = NewStateL( MVtEngSessionInfo::EClearing );
+        }
+    else
+        {
+        // protocol is set up so connect now if ready
+        newState = NegotiatingOrConnectedStateL( ETrue );
+        }
+    if ( newState )
+        {
+        newState->OpenL( this );
+        }
+    __VTPRINTEXIT( "StateConnected.Update")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::DoOpenL
+// State transition to connected state.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateConnected::DoOpenL()
+    {
+    __VTPRINTENTER( "StateConnected.Open")
+    NotifyStateChange( MVtEngSessionInfo::EConnected );
+    //start monitor incoming call
+    __VTPRINTEXIT( "StateConnected.Open")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::ValidateCommand
+// Returns if a command is valid in idle state.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateConnected::ValidateCommand(
+            const TVtEngCommandId aCommandId )
+    {
+    __VTPRINT( DEBUG_DETAIL |DEBUG_GEN, "StateConnected.Validate")
+    TBool okToPerform( EFalse );
+    switch ( aCommandId )
+        {
+        case KVtEngSetSource:
+        case KVtEngPrepareViewFinder:
+        case KVtEngStartViewFinder:
+        case KVtEngPauseViewFinder:
+        case KVtEngStopViewFinder:
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRenderNGA:
+            okToPerform = ETrue;
+            break;
+        default:
+            okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+            break;
+        }
+    return okToPerform;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::State
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateConnected::State() const
+    {
+    return MVtEngSessionInfo::EConnected;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateConnected::HandleL
+// Handles an operation when behavior is state dependent.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateConnected::HandleL( CVtEngOperation& aOp )
+    {
+    TBool handled( CVtEngStateBase::HandleL( aOp ));
+    return handled;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateIdle.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* 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:  Idle state
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngStateIdle.h"
+#include    <cvtlogger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::CVtEngStateIdle
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateIdle::CVtEngStateIdle( 
+    CVtEngStateManager& aStateManager,
+    CVtEngEventManager& aEventManager )
+    : CVtEngStateBase( aStateManager, aEventManager )
+    {
+    }
+
+// Destructor
+CVtEngStateIdle::~CVtEngStateIdle()
+    {
+    __VTPRINT( DEBUG_DESTRUCT, "~Stateidl")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateIdle::UpdateL()
+    {
+    __VTPRINTENTER( "StateIdle.Update")
+   
+    const MVtCtlCallControl::TVtCtlState state = SessionHandler().RealState();
+    CVtEngStateBase* newState = NULL;
+    
+    if( iStateManager.PreviousSessionState() == MVtEngSessionInfo::EUnknown )
+        {
+        switch ( state )
+            {
+            case MVtCtlCallControl::EInitializing:
+                newState = NewStateL( MVtEngSessionInfo::EInitializing );
+                break;
+            case MVtCtlCallControl::EAlerting:
+                newState = NewStateL( MVtEngSessionInfo::ERemoteAlerting );
+                break;
+            case MVtCtlCallControl::ERinging:
+                newState = NewStateL( MVtEngSessionInfo::EReceiving );
+                break;
+            case MVtCtlCallControl::EConnected:
+                newState = NegotiatingOrConnectedStateL();
+                break;
+            default:
+                break;
+            }
+        if ( newState )
+            {
+            CVtEngUtility* utils = CVtEngUtility::EngineUtils();
+            
+            // Notify UI about initial autolock state. UI must have this
+            // information early enough to deduce if it is allowed to 
+            // go to foreground.
+            utils->NotifyLockState();            
+            utils->StartSATListenL();
+            newState->OpenL( this );
+            }
+        }
+    else
+        {
+        __VTPRINT( DEBUG_GEN, "StateIdle.Update wrong previous state, ignoring")        
+        }
+    __VTPRINTEXIT( "StateIdle.Update")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::OpenL
+// State transition to idle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateIdle::DoOpenL()
+    {
+    __VTPRINTENTER( "StateIdle.Open")
+    // Reset settings
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+    settings.ResetAll();
+    
+    NotifyStateChange( MVtEngSessionInfo::EIdle );
+    __VTPRINTEXIT( "StateIdle.Open")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::ValidateCommand
+// Returns if a command is valid in idle state.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateIdle::ValidateCommand(
+            const TVtEngCommandId aCommandId )
+    {
+    __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateIdle.Validate")
+    TBool okToPerform( EFalse );
+    switch ( aCommandId )
+        {
+        case KVtEngPrepareViewFinder:        
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRender:
+        case KVtEngPrepareRemoteRenderNGA:
+            okToPerform = ETrue;
+            break;
+        default:
+            okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+            break;
+        }
+    return okToPerform;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateIdle::State
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateIdle::State() const
+    {
+    return MVtEngSessionInfo::EIdle;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateInitializing.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2006 - 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:  Initializing state
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngStateInitializing.h"
+#include    "CVtEngOperation.h"
+#include    "CVtEngSettings.h"
+#include    "VtEngUtils.h"
+#include    "CVtEngAudioHandler.h"
+#include    "CVtEngInitializer.h"
+#include    <cvtlogger.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::CVtEngStateInitializing
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateInitializing::CVtEngStateInitializing( 
+    CVtEngStateManager& aStateManager,
+    CVtEngEventManager& aEventManager )
+    : CVtEngStateBase( aStateManager, aEventManager )
+    {
+    }
+
+// Destructor
+CVtEngStateInitializing::~CVtEngStateInitializing()
+    {
+    __VTPRINT( DEBUG_DESTRUCT, "~Stateini")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateInitializing::UpdateL()
+    {
+    __VTPRINTENTER( "StateInit.Update")
+    const MVtCtlCallControl::TVtCtlState bearerstate = 
+        SessionHandler().RealState();
+
+    CVtEngStateBase* newState = NULL;
+    if ( bearerstate == MVtCtlCallControl::EIdle ||
+         bearerstate == MVtCtlCallControl::EDisconnecting )
+        {
+        newState = NewStateL( MVtEngSessionInfo::EClearing );
+        // Initializer may be waiting for dataport. In that case MediaHandler 
+        // has already signaled reqStatus of CVtEngInitializer which must
+        // complete KVtEngInitializeEngine command in order uninitialisation to
+        // finish properly. This scenario may happen in 1st call since phone
+        // boot, i.e. when dataport name is not already published.
+        CVtEngUtility::EngineUtils()->Initializer().CancelInit();
+        }
+    else if ( bearerstate == MVtCtlCallControl::EAlerting )
+        {
+        newState = NewStateL( MVtEngSessionInfo::ERemoteAlerting );
+        }
+    else
+        {
+        newState = NegotiatingOrConnectedStateL(); // or null
+        }
+    if ( newState )
+        {
+        newState->OpenL( this );
+        }
+    __VTPRINTEXIT( "StateInit.Update")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::OpenL
+// State transition to initializing.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateInitializing::DoOpenL()
+    {
+    __VTPRINTENTER( "StateInit.Open" )
+    NotifyStateChange( MVtEngSessionInfo::EInitializing );
+    
+    // Instantiate temporary devsound for audio routing
+    AudioHandler().SetRoutingEnablerL( ETrue );
+    __VTPRINTEXIT( "StateInit.Open" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::ValidateCommand
+// Returns if a command is valid in initializing state.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateInitializing::ValidateCommand(
+            const TVtEngCommandId aCommandId )
+    {
+    __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateInit.Validate")
+    TBool okToPerform( EFalse );
+    switch ( aCommandId )
+        {
+        case KVtEngPrepareViewFinder:        
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRenderNGA:
+        case KVtEngSetSource:
+        case KVtEngStartViewFinder:
+            okToPerform = ETrue;
+            break;
+        default:
+            okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+            break;
+        }
+    return okToPerform;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::State
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateInitializing::State() const
+    {
+    return MVtEngSessionInfo::EInitializing;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateInitializing::HandleL
+// Handles an operation when behavior is state dependent.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateInitializing::HandleL( CVtEngOperation& aOp )
+    {
+    TBool handled( CVtEngStateBase::HandleL( aOp ));
+    if ( !handled )
+        {
+        switch ( aOp.Command() )
+            {
+            case KVtEngStartRenderRemote:
+                SetVideoEnabled( ETrue );
+                handled = ETrue;
+                break;
+            }
+        }
+    return handled;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateManager.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,182 @@
+/*
+* 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:  Implementation of state manager for session and audio routing states.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtEngStateManager.h"
+#include    "CVtEngHandlerContainer.h"
+#include    "CVtEngStateBase.h"
+#include    "CVtEngStateIdle.h"
+#include    "CVtEngStateOpen.h"
+#include    "CVtEngEventManager.h"
+#include    "CVtEngStateConnected.h"
+#include    "CVtEngOperation.h"
+#include    "cvtlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::CVtEngStateManager
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateManager::CVtEngStateManager( 
+    CVtEngHandlerContainer& aHandlers,
+    CVtEngEventManager& aEventManager ) : 
+    iPreviousSessionState( MVtEngSessionInfo::EUnknown ),
+    iHandlers( aHandlers ), 
+    iEventManager( aEventManager )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateManager::ConstructL()
+    {
+    iSessionState = new ( ELeave ) 
+        CVtEngStateIdle( *this, iEventManager );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateManager* CVtEngStateManager::NewL(
+    CVtEngHandlerContainer& aHandlers,
+    CVtEngEventManager& aEventManager )
+    {
+    __VTPRINT( DEBUG_GEN , "CVtEngStateManager::NewL" )
+    CVtEngStateManager* self = new ( ELeave ) 
+        CVtEngStateManager( aHandlers, aEventManager );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+    
+// Destructor
+CVtEngStateManager::~CVtEngStateManager()
+    {
+    __VTPRINT( DEBUG_GEN , "CVtEngStateManager::~" )
+    delete iSessionState;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::UpdateL
+// Updates current state.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateManager::Update( )
+    {
+    if ( iSessionState )
+        {
+        TRAPD(err,iSessionState->UpdateL());
+        if ( err != KErrNone )
+            {
+            __VTPRINT2( DEBUG_GEN, "SM.update fail=%d", err )
+            iEventManager.NotifyEvent( err );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::IsCommandPossible
+// Checks if a command is possible in current state.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateManager::IsCommandPossible( 
+            const TVtEngCommandId aCommandId ) const
+    {
+    if ( iSessionState )
+        {
+        return iSessionState->ValidateCommand( aCommandId );
+        }
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::SetState
+// Sets new session state.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateManager::SetState( CVtEngStateBase& aNewState )
+    {
+    if( iSessionState )
+        {
+        iPreviousSessionState = iSessionState->State();
+        }
+    iSessionState = &aNewState;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::HandleOperationL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateManager::HandleOperationL( CVtEngOperation& aOp )
+    {
+    __VTPRINT2( DEBUG_GEN, "StateMgr.HandleOp=%d", aOp.Command() )
+    TInt handled( EFalse );
+    if ( iSessionState )
+        {
+        handled = iSessionState->HandleL( aOp );
+        }
+    __VTPRINT2( DEBUG_GEN | DEBUG_RETURN, "StateMgr.HandleOp handled=%d", 
+        handled )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::SessionState
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateManager::SessionState() const
+    {
+    if ( iSessionState )
+        {
+        return iSessionState->State();
+        }
+    return MVtEngSessionInfo::EUnknown;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateManager::PreviousSessionState
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateManager::PreviousSessionState() const
+    {
+    return iPreviousSessionState;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateNegotiating.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,167 @@
+/*
+* 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:  Negotiating state
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngStateNegotiating.h"
+#include    <cvtlogger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::CVtEngStateNegotiating
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateNegotiating::CVtEngStateNegotiating( 
+    CVtEngStateManager& aStateManager,
+    CVtEngEventManager& aEventManager )
+    : CVtEngStateBase( aStateManager, aEventManager )
+    {
+    }
+
+// Destructor
+CVtEngStateNegotiating::~CVtEngStateNegotiating()
+    {
+    __VTPRINT( DEBUG_DESTRUCT, "~Stateneg")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateNegotiating::UpdateL()
+    {
+    __VTPRINTENTER( "StateNegotiate.Update" )
+    const MVtCtlCallControl::TVtCtlState bearerstate = 
+        SessionHandler().RealState();
+    const MVtProtocolCommand::TVtProtocolState state( MediaHandler().ProtoState() );
+    CVtEngStateBase* newState = NULL;
+
+    if ( bearerstate != MVtCtlCallControl::EConnected ||
+         state == MVtProtocolCommand::ESetup ) // <- connect failed
+        {
+        newState = NewStateL( MVtEngSessionInfo::EClearing );
+        }
+    else if ( state == MVtProtocolCommand::EConnected )
+        {
+        // change to open state
+        newState = NewStateL( MVtEngSessionInfo::EOpen );
+        }
+    else if ( state == MVtProtocolCommand::ESetup )
+        {
+        // should not usually happen unless connect fails
+        newState = NewStateL( MVtEngSessionInfo::EConnected );
+        }
+    if ( newState )
+        {
+        newState->OpenL( this );
+        }
+    __VTPRINTEXIT( "StateNegotiate.Update" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::OpenL
+// State transition to negotiating.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateNegotiating::DoOpenL( )
+    {
+    __VTPRINTENTER( "StateNegotiate.Open" )
+    NotifyStateChange( MVtEngSessionInfo::ENegotiating);
+    __VTPRINTEXIT( "StateNegotiate.Open" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::ValidateCommand
+// Returns if a command is valid in negotiating state.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateNegotiating::ValidateCommand(
+    const TVtEngCommandId aCommandId )
+    {
+    __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateNegotiate.Validate")
+    TBool okToPerform( EFalse );
+    switch ( aCommandId )
+        {
+        case KVtEngPrepareViewFinder:        
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRender:
+        case KVtEngPrepareRemoteRenderNGA:
+        case KVtEngStartRenderRemote: // cached to settings
+        case KVtEngSetSource:
+        case KVtEngPrepareCamera:
+        case KVtEngSetZoomStep:
+        case KVtEngStartViewFinder:
+        case KVtEngStopViewFinder:
+        case KVtEngTerminateSession:
+            okToPerform = ETrue;
+            break;
+        default:
+            okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+            break;
+        }
+    return okToPerform;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::State
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateNegotiating::State() const
+    {
+    return MVtEngSessionInfo::ENegotiating;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateNegotiating::HandleL
+// Handles an operation when behavior is state dependent.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateNegotiating::HandleL( CVtEngOperation& aOp )
+    {
+    __VTPRINTENTER( "StateNegotiate.HandleL" )
+    TBool handled( CVtEngStateBase::HandleL( aOp ) );
+    if ( !handled )
+        {
+        switch ( aOp.Command() )
+            {
+            case KVtEngStartRenderRemote:
+                SetVideoEnabled( ETrue );
+                handled = ETrue;
+                break;
+            case KVtEngTerminateSession:
+                TerminateSessionL( aOp );
+                break;
+            }
+        }
+    __VTPRINTEXITR( "StateNegotiate.HandleL %d", handled )
+    return handled;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateOpen.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,288 @@
+/*
+* 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:  Open state handle interfaces implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngStateOpen.h"
+#include    "CVtEngOperation.h"
+#include    "CVtEngAudioHandler.h"
+#include    <cvtlogger.h>
+
+#include    "CVtEngExtensions.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::CVtEngStateOpen
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateOpen::CVtEngStateOpen( 
+    CVtEngStateManager& aStateManager,
+    CVtEngEventManager& aEventManager )
+    : CVtEngStateBase( aStateManager, aEventManager )
+    {
+    }
+
+// Destructor
+CVtEngStateOpen::~CVtEngStateOpen()
+    {
+    __VTPRINT( DEBUG_DESTRUCT, "~StateOpen")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateOpen::UpdateL()
+    {
+    __VTPRINTENTER( "StateOpen.Update" )
+    const MVtCtlCallControl::TVtCtlState bearerstate = 
+        SessionHandler().RealState();
+
+    const MVtProtocolCommand::TVtProtocolState protoState( MediaHandler().ProtoState() );
+    const TBool bearerIdle = ( bearerstate == MVtCtlCallControl::EIdle ||
+        bearerstate == MVtCtlCallControl::EUnknown );
+    const TBool bearerDisconnecting = 
+        ( bearerstate == MVtCtlCallControl::EDisconnecting );
+
+    CVtEngStateBase* newState = NULL;
+
+    if ( protoState == MVtProtocolCommand::ESetup || 
+         protoState == MVtProtocolCommand::EIdle  || 
+         bearerIdle )
+        {
+        newState = NewStateL( MVtEngSessionInfo::EIdle );
+        }
+    else if ( bearerDisconnecting || protoState == MVtProtocolCommand::EDisconnecting ) 
+        {
+        newState = NewStateL( MVtEngSessionInfo::EClearing );
+        }
+    if ( newState )
+        {
+        newState->OpenL( this );
+        }
+    __VTPRINTEXIT( "StateOpen.Update" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::OpenL
+// State transition to open.
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateOpen::DoOpenL()
+    {
+    __VTPRINTENTER( "StateOpen.Open" )
+    
+    // set audio routing (and ouput volume)
+    RouteAudioL( NULL );
+
+    NotifyStateChange( MVtEngSessionInfo::EOpen );
+    __VTPRINTEXIT( "StateOpen.Open" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::ValidateCommand
+// Returns if a command is valid in open state.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateOpen::ValidateCommand(
+            const TVtEngCommandId aCommandId )
+    {
+    __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateOpen.Validate")
+    TBool okToPerform( EFalse );
+    switch ( aCommandId )
+        {
+        case KVtEngInitializeEngine: // temporary     
+        case KVtEngPrepareCamera:
+        case KVtEngSetZoomStep:
+        case KVtEngStartViewFinder:
+        case KVtEngPauseViewFinder:
+        case KVtEngStopViewFinder:
+        case KVtEngStartRenderRemote: 
+        case KVtEngStopRenderRemote: 
+        case KVtEngPauseRenderRemote:
+        case KVtEngTerminateSession:
+        case KVtEngStartDtmfTone:
+        case KVtEngStopDtmfTone:
+        // Handling of different UIIs, support is there
+        case KVtEngSetUIIDtmfSupport:
+        case KVtEngSetUIIBasicStringSupport:
+        case KVtEngSetUIIIA5StringSupport:
+        case KVtEngSetUIIGeneralStringSupport:
+        case KVtEngSwitchToVoice:
+            okToPerform = ETrue;
+            break;
+
+        // Extension commands
+        case KVtEngSetContrast:
+        case KVtEngSetBrightness:
+        case KVtEngSetWhiteBalance:
+        case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+        case KVtEngStartRecord:
+        case KVtEngStopRecord:
+#endif // RD_VT_RTF
+        	{
+        	// Get extension handle from Utils
+        	__VTPRINT(DEBUG_GEN, "StateOpen extension->ValidateCommand")
+            okToPerform = CVtEngUtility::Extensions()->ValidateCommand(
+            	aCommandId );
+            break;
+        	}
+
+        default:
+            okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+            break;
+        }
+    return okToPerform;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::State
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateOpen::State() const
+    {
+    return MVtEngSessionInfo::EOpen;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::HandleL
+// Handles an operation when behavior is state dependent.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateOpen::HandleL( CVtEngOperation& aOp )
+    {
+    __VTPRINTENTER( "StateOpen.HandleL" )
+    TBool handled( CVtEngStateBase::HandleL( aOp ) );
+    switch ( aOp.Command() )
+        {
+        case KVtEngTerminateSession:
+            TerminateSessionL( aOp );
+            handled = ETrue;
+            break;
+      
+        case KVtEngSwitchToVoice:
+            {
+            CVtEngStateBase* newState = 
+                NewStateL( MVtEngSessionInfo::EClearing );
+            CleanupStack::PushL( newState );
+            newState->OpenL( this );        
+            CleanupStack::Pop();
+            // aOp is not passed to media handler because mediator command
+            // sender signals completion, see
+            // CVtEngMdtrCommandSender::HandleVtEventL
+            }
+            break;
+            
+        // Extension commands
+        case KVtEngSetContrast:
+        case KVtEngSetBrightness:
+        case KVtEngSetWhiteBalance:
+        case KVtEngSetColorTone:
+#if defined ( RD_VT_RTF )
+        case KVtEngStartRecord:
+        case KVtEngStopRecord:
+#endif // RD_VT_RTF
+            CallExtensionL( &aOp);
+            break;
+        default:
+            break;
+        }
+    __VTPRINTEXITR( "StateOpen.HandleL %d", handled )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::RouteAudioL
+// Handles audio routing operation.
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateOpen::RouteAudioL( 
+    CVtEngOperation* aOp )
+    {
+    __VTPRINTENTER( "StateOpen.RouteAudioL" )
+    CVtEngSettings& settings = CVtEngUtility::Settings();
+    const CVtEngSettings::TVtEngVideoCallConfig& config = settings.Config();
+
+    CVtEngAudioHandler& audioHandler = AudioHandler();
+    MVtEngAudio::TAudioRoutingState routingState( MVtEngAudio::EAudioWiredHeadset );
+    audioHandler.GetRoutingState( routingState );
+
+    TBool routeAudio( ETrue );
+    TInt volume( config.iAudio.iVolume.iHandsfreeVolume );
+    switch ( routingState )
+        {
+        case MVtEngAudio::EAudioWiredHeadset:
+             routeAudio = EFalse;
+             // fall thru
+        case MVtEngAudio::EAudioHandset:
+        case MVtEngAudio::EAudioBT:
+            volume = config.iAudio.iVolume.iHandsetVolume;
+            break;
+        // use default values
+        case MVtEngAudio::EAudioLoudspeaker:
+        default:
+            break;
+        }
+    __VTPRINT3( DEBUG_GEN | DEBUG_DETAIL, 
+        "StateOpen.RouteAudioL route=%d,vol=%d", routeAudio,volume )
+    if ( aOp == NULL || ( aOp && routeAudio ) )
+        {
+        // set volume if state was changed (called from DoOpenL) or
+        // audio routing will be changed
+        __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "StateOpen.RouteAudioL SetVol" )
+        MediaHandler().SetVolume( volume );
+        }
+
+    // *** AUDIO && ( aOp != NULL ) ***
+    if ( routeAudio && ( aOp != NULL ) )
+        {
+        if ( aOp )
+            {
+            audioHandler.HandleL( *aOp );
+            }
+        }
+    __VTPRINTEXIT( "StateOpen.RouteAudioL" )
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CVtEngStateOpen::CallExtensionL
+// Handles extension operations.
+//
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateOpen::CallExtensionL(
+    CVtEngOperation* aOp)
+    {
+    __VTPRINTENTER( "StateOpen.CallExtensionL" )
+    CVtEngUtility::Extensions()->OfferOperationL( aOp );
+    __VTPRINTEXIT( "StateOpen.CallExtensionL" )
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/Src/State/CVtEngStateRinging.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* 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:  Ringing state handle interfaces implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtEngStateRinging.h"
+#include    "CVtEngInitializer.h"
+#include    "VtEngUtils.h"
+#include    <cvtlogger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::CVtEngStateRinging
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtEngStateRinging::CVtEngStateRinging( 
+    CVtEngStateManager& aStateManager,
+    CVtEngEventManager& aEventManager )
+    : CVtEngStateBase( aStateManager, aEventManager )
+    {
+    }
+
+// Destructor
+CVtEngStateRinging::~CVtEngStateRinging()
+    {
+    __VTPRINT( DEBUG_DESTRUCT, "~StateRing")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::UpdateL
+// Updates state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateRinging::UpdateL()
+    {
+    __VTPRINTENTER( "StateRing.Update" )
+    const MVtCtlCallControl::TVtCtlState bearerstate = 
+        SessionHandler().RealState();
+    CVtEngStateBase* newState = NULL;
+    switch ( bearerstate )
+        {
+        case MVtCtlCallControl::EConnected:
+            newState = NegotiatingOrConnectedStateL();
+            break;
+        case MVtCtlCallControl::EDisconnecting:
+        case MVtCtlCallControl::EIdle:
+            newState = NewStateL( MVtEngSessionInfo::EIdle );
+            // Initializer may be waiting for dataport. In that case MediaHandler 
+            // has already signaled reqStatus of CVtEngInitializer which must
+            // complete KVtEngInitializeEngine command in order uninitialisation to
+            // finish properly. This scenario may happen in 1st call since phone
+            // boot, i.e. when dataport name is not already published.
+            CVtEngUtility::EngineUtils()->Initializer().CancelInit();
+            break;
+        default:
+            break;
+        }
+    if ( newState )
+        {
+        newState->OpenL( this );
+        }
+    __VTPRINTEXIT( "StateRing.Update")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::OpenL
+// State transition to Ring.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtEngStateRinging::DoOpenL()
+    {
+    __VTPRINTENTER( "StateRing.Open")
+    NotifyStateChange( MVtEngSessionInfo::EReceiving );
+    __VTPRINTEXIT( "StateRing.Open")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::ValidateCommand
+// Returns if a command is valid in ringing state.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CVtEngStateRinging::ValidateCommand(
+    const TVtEngCommandId aCommandId )
+    {
+    __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "Statering.Validate")
+    TBool okToPerform( EFalse );
+    switch ( aCommandId )
+        {
+        case KVtEngSetSource:
+        case KVtEngPrepareViewFinder:                
+        case KVtEngStartViewFinder:
+        case KVtEngPauseViewFinder:
+        case KVtEngPrepareRemoteRenderDSA:
+        case KVtEngPrepareRemoteRenderDP:
+        case KVtEngPrepareRemoteRender:
+        case KVtEngPrepareRemoteRenderNGA:
+        case KVtEngStartRenderRemote: 
+            okToPerform = ETrue;
+            break;
+        default:
+            okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
+            break;
+        }
+    return okToPerform;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngStateRinging::State
+// Returns session state.
+// 
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState CVtEngStateRinging::State() const
+    {
+    return MVtEngSessionInfo::EReceiving;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/bwins/VIDEOTELENGU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+	??1CVtEngModel@@UAE@XZ @ 1 NONAME ; CVtEngModel::~CVtEngModel(void)
+	?Audio@CVtEngModel@@QBEAAVMVtEngAudio@@XZ @ 2 NONAME ; class MVtEngAudio & CVtEngModel::Audio(void) const
+	?CommandHandler@CVtEngModel@@QBEAAVMVtEngCommandHandler@@XZ @ 3 NONAME ; class MVtEngCommandHandler & CVtEngModel::CommandHandler(void) const
+	?Extension@CVtEngModel@@QAEPAXABVTUid@@@Z @ 4 NONAME ; void * CVtEngModel::Extension(class TUid const &)
+	?Media@CVtEngModel@@QBEAAVMVtEngMedia@@XZ @ 5 NONAME ; class MVtEngMedia & CVtEngModel::Media(void) const
+	?NewL@CVtEngModel@@SAPAV1@AAVMVtEngEventObserver@@AAVMVtEngCommandObserver@@@Z @ 6 NONAME ; class CVtEngModel * CVtEngModel::NewL(class MVtEngEventObserver &, class MVtEngCommandObserver &)
+	?Session@CVtEngModel@@QBEAAVMVtEngSessionInfo@@XZ @ 7 NONAME ; class MVtEngSessionInfo & CVtEngModel::Session(void) const
+
Binary file vtengines/videoteleng/data/videoteleng_stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/videoteleng/data/videoteleng_stub.pkg	Mon Nov 23 14:47:47 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:
+;
+; Languages
+&EN
+
+; Header
+#{"videoteleng"}, (0x101F867F), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\videoteleng.dll"
+""-"z:\sys\bin\cscallctrl.dll"
+""-"z:\sys\bin\vtlogger.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/data/vtmediatorplugin.pkg	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,35 @@
+;
+; 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:
+;
+
+; vtmediatorplugin.pkg
+;
+; Languages
+&EN
+
+;Header
+#{"vtmediatorplugin patch"},(0x2001599F),10,1,0,TYPE=PU
+
+; localized vendor name
+%{"Nokia"}
+
+; unique vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\udeb\vtmediatorplugin.dll"-"!:\sys\bin\vtmediatorplugin.dll"
+"\epoc32\data\z\resource\plugins\vtmediatorplugin.rsc"-"!:\sys\bin\vtmediatorplugin.rsc"
+
+
+; End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/data/vtmediatorplugin.rss	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 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:  Resource file for VT Mediator plugin.
+*
+*/
+
+
+// RESOURCE IDENTIFIER
+// n/a
+
+// INCLUDES
+#include <registryinfov2.rh>
+#include <mediatoruids.hrh>
+
+
+// -----------------------------------------------------------------------------
+// theInfo
+// ECom interface definition for the VT Mediator plugin.
+// -----------------------------------------------------------------------------
+RESOURCE REGISTRY_INFO theInfo
+	{
+	resource_format_version = RESOURCE_FORMAT_VERSION_2;
+	dll_uid = 0x2001599F;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = KMediatorPluginInterfaceUid;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x200159A0;
+					version_no         = 1;
+					display_name       = "VT Mediator Plugin";
+					default_data       = "Mediator";
+					opaque_data        = "";
+					rom_only           = 1;
+					}
+				};
+			}
+		};
+	}
+
Binary file vtengines/vtmediatorplugin/data/vtmediatorplugin.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/data/vtmediatorplugin_stub.pkg	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,30 @@
+;
+; 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:
+;
+; Languages
+&EN
+
+; Header
+#{"vtmediatorplugin"}, (0x2001599F), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\vtmediatorplugin.dll"
+""-"z:\resource\plugins\vtmediatorplugin.r*"
Binary file vtengines/vtmediatorplugin/data/vtmediatorplugin_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 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 Telephony Mediator Plugin
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/vtinternalmediatorapi.h |../../../inc/vtinternalmediatorapi.h
+                    
+../data/vtmediatorplugin_stub.sis   /epoc32/data/z/system/install/vtmediatorplugin_stub.sis
+                    
+// Export IBY file
+../rom/vtmediatorplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(vtmediatorplugin.iby)
+
+PRJ_MMPFILES
+vtmediatorplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/group/vtmediatorplugin.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 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 telephony mediator plugin
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>   // for APP_LAYER_SYSTEMINCLUDE macro
+
+// Build target
+
+CAPABILITY      CAP_ECOM_PLUGIN
+TARGET		    vtmediatorplugin.dll
+TARGETTYPE	    PLUGIN
+UID             0x10009D8D 0x2001599F
+VENDORID        VID_DEFAULT
+
+SOURCEPATH	../data
+START RESOURCE  vtmediatorplugin.rss
+TARGET          vtmediatorplugin.rsc
+END
+
+SOURCEPATH	../src
+SOURCE		cvtmediatorplugin.cpp
+SOURCE      vtmediatorpluginproxy.cpp
+
+USERINCLUDE     ../inc
+SYSTEMINCLUDE   ../../../inc
+SYSTEMINCLUDE   /epoc32/include/ecom
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY apparc.lib
+LIBRARY apgrfx.lib
+LIBRARY euser.lib
+LIBRARY ws32.lib
+LIBRARY ecom.lib
+LIBRARY mediatorclient.lib
+LIBRARY mediatorpluginbase.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/inc/cvtmediatorplugin.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,349 @@
+/*
+* Copyright (c) 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 Telephony mediator plugin header
+*
+*/
+
+
+#ifndef C_VTMEDIATORPLUGIN_H
+#define C_VTMEDIATORPLUGIN_H
+
+// INCLUDES
+#include <mediatorpluginbase.h>
+#include <mediatornotifications.h>
+#include <mediatoreventconsumer.h>
+#include <mediatoreventprovider.h>
+#include <mediatorcommandresponder.h>
+#include <vtinternalmediatorapi.h>
+#include <mediatoreventsfromtelephonyapi.h>
+#include <mediatorcommandinitiator.h>
+#include <w32std.h>
+
+
+
+using namespace TelephonyMediator;
+using namespace MediatorService;
+
+class TelephonyMediator::TTelephonyCallDataParam;
+class CMediatorCommandInitiator;
+/**
+* Mediator plugin for CS video telephony. Fullfills responsibilities:
+*   - launches Video Telephone application
+*   - caches CLI and Dataport information for VT app for time between
+*     the data is broadcasted to time VT is ready to receive it.                                                                 
+* @since S60 5.0
+*/
+
+class CVtMediatorPlugin : public CMediatorPluginBase, 
+                            public MMediatorNotifications,
+                            public MMediatorEventObserver,
+                            public MMediatorCommandObserver,
+                            public MMediatorCommandResponseObserver
+	{
+public:          
+       
+     static CMediatorPluginBase* NewL();
+     
+    /**
+     * Destructor.
+     */
+    ~CVtMediatorPlugin();
+    
+public: // From Base class
+    
+    virtual void StartL();
+    
+public: // From MMediatorNotifications
+
+    /**
+    * Raises VT specific CLI/dataport event when event is registered by VT app,
+    * or when the information is available
+    *
+    * @since Series 60 3.1
+    * @param aDomain    The identifier of the domain.
+    * @param aCategory  The identifier of the category.
+    * @param aEvents    The list of events that have been registered.
+    * @return None.
+    */
+    virtual void MediatorEventsAddedL( TUid aDomain, 
+                                       TUid aCategory, 
+                                       const REventList& aEvents );
+
+    /**
+    * New commands have been registered. The commands can now be subscribed.
+    * The list can contain 1-n new commands into the category.
+    *
+    * @since Series 60 3.1
+    * @param aDomain    The identifier of the domain.
+    * @param aCategory  The identifier of the category.
+    * @param aCommands  List of commands that have been registered.
+    * @return None.
+    */
+    virtual void MediatorCommandsAddedL( TUid aDomain, 
+                                         TUid aCategory,
+                                         const RCommandList& aCommands );
+     
+    /**
+    * A category has been removed. All subscriptions are cancelled.
+    *
+    * @since Series 60 3.1
+    * @param aDomain    The identifier of the domain.
+    * @param aCategory  The identifier of the category.        
+    * @return None.
+    */
+    virtual void MediatorCategoryRemovedL( TUid aDomain, TUid aCategory );
+
+    /**
+    * List of events has been removed. All subscriptions are cancelled.
+    * List can contain 1-n events from the specified category.
+    *
+    * @since Series 60 3.1
+    * @param aDomain    The identifier of the domain.
+    * @param aCategory  The identifier of the category.
+    * @param aEvents    The list of events removed.
+    * @return None.
+    */
+    virtual void MediatorEventsRemovedL( TUid aDomain, 
+                                         TUid aCategory,
+                                         const REventList& aEvents );
+                                         
+    /**
+    * List of commands have been removed. All subscriptions are cancelled.
+    * List can contain 1-n commands from the specified category.
+    *
+    * @since Series 60 3.1
+    * @param aDomain    The identifier of the domain.
+    * @param aCategory  The identifier of the category.
+    * @param aCommands  The list of commands removed
+    * @return None.
+    */
+    virtual void MediatorCommandsRemovedL( TUid aDomain, 
+                                           TUid aCategory,
+                                           const MediatorService::RCommandList& aCommands ); 
+         
+public: // from MMediatorCommandObserver
+    
+    /**
+    * @see MMediatorCommandObserver::MediatorCommandL       
+    */
+    virtual void MediatorCommandL( TUid aDomain,
+                                 TUid aCategory, 
+                                 TInt aCommandId,
+                                 TVersion aVersion, 
+                                 const TDesC8& aData );
+    
+    /**
+    * @see MMediatorCommandObserver::CancelMediatorCommand       
+    */
+    virtual void CancelMediatorCommand( TUid aDomain,
+                                      TUid aCategory, 
+                                      TInt aCommandId );
+    
+public:// from MMediatorCommandResponseObserver
+    /**
+    * @see MMediatorCommandResponseObserver::CommandResponseL
+    */
+     virtual void CommandResponseL( TUid aDomain,
+                                   TUid aCategory, 
+                                   TInt aCommandId,
+                                   TInt aStatus, 
+                                   const TDesC8& aData );  
+                                               
+public: // from MMediatorEventObserver
+                                                   
+        /**
+        * A Mediator Service event.
+        *
+        * @since Series 60 3.1        
+        * @param aDomain    The identifier of the domain.
+        * @param aCategory  The identifier of the category.
+        * @param aEventId   The identifier of the event.
+        * @param aData      The parameters of the event.
+        * @return None.
+        */
+        virtual void MediatorEventL( TUid aDomain,
+                                     TUid aCategory, 
+                                     TInt aEventId, 
+                                     const TDesC8& aData );                                               
+
+public: // new
+    static TInt EventRaiserCallback( TAny* aAny );
+    
+private: // constructors
+    
+    CVtMediatorPlugin();      void ConstructL();
+
+    enum TInternalState {
+        /** 
+         * Waiting for video call state to reach value that is suitable
+         * for launching Video Telephone application. In this state
+         * video call is not ongoing.
+         */
+        EWaitingAppLaunch,
+        
+        /** 
+         * Waiting for VT application's readiness to receive video call info
+         * events. In this state video call is ongoing and VT application
+         * is starting up.
+         */
+        EWaitingEventRegistration,
+        
+        /** 
+         * VT application is ready to receive video call info events.
+         */
+        EReady
+    };
+    
+private: // new functions    
+    void ChangeCallDataEventSubscriptionL(
+        const REventList& aEvents,
+        const TBool aEventRegistered );
+    
+    void HandleVtCommandUnregistrationL();
+    
+    void HandleVtCommandRegistrationL();
+    
+    void LaunchVtAppL();
+    
+    void SaveCallData( const TelephonyMediator::TTelephonyCallDataParam& aData, TVtVideoTelephonyCallInformation& iVtCallInfo);
+                         
+    void HandleDataportCommandL( const TDesC8& aData );
+                             
+    void ClearData(TVtVideoTelephonyCallInformation& aVtCallInfo, TCallState& aCallState);
+    
+    void RegisterVtInternalEventL();
+    //test
+    void RegisterVtInternalEvent_2L();
+    
+    void RegisterDataportCommandL();
+    
+    void RaiseVtEventL();    
+                                    
+    /**
+     * Starts VT application if video call state transition is suitable.
+     */                                    
+    void HandleCallStateChangeL( const TelephonyMediator::TTelephonyCallDataParam& aData ); 
+    
+    TBool IsEnoughMemory();
+    
+    void FreeRam();
+    
+    void StopDeathActiveL();
+    
+private: 
+    // for detecting subscription to video call information from VT app.
+    CMediatorNotifications* iMediatorNotifications;
+
+    // for sending video call information events
+    CMediatorEventProvider* iEventProvider;
+                                                            
+    // for receiving CLI from Telephony
+    CMediatorEventConsumer* iEventConsumer;
+
+    // for responding to dataport/releasedataport command from Telephony
+    CMediatorCommandResponder* iCommandResponder;
+    
+    // for issue command to vt app
+    CMediatorCommandInitiator* iCommandInitiator;
+    
+    // supported mediator commands
+    MediatorService::RCommandList iCommandList;
+    
+    // plugin's internal state 
+    TInternalState iState;
+    
+    // cached active video call state (from last call data event from Telephony)                    
+    TCallState iActiveVideoCallState;
+        
+    TVtVideoTelephonyCallInformation iActiveVideoCallInfo;
+    
+    // cached waiting video call state (from last call data event from Telephony)                    
+    TCallState iWaitingVideoCallState;
+           
+    TVtVideoTelephonyCallInformation iWaitingVideoCallInfo;
+    
+    // for raising event to VT asynchronously when it starts up
+    CAsyncCallBack* iCallBack;
+    
+    class CAppDeathActive;
+    // Owned application death waiter.
+    CAppDeathActive* iAppDeathActive;
+    
+    // Owned application thread.
+    RThread iAppThread;    
+    
+    // Application thread id.
+    TThreadId iAppThreadId;
+    
+    // Owned window server session.
+    RWsSession iWsSession;
+    /**
+        * Active object for waiting thread death.
+        *
+        * @since 2.6
+        * @lib videotelcomms.lib
+        */
+    NONSHARABLE_CLASS( CAppDeathActive ) : public CActive
+         {
+         public: // Constructors
+              
+             /**
+             * Constructor.
+             */
+             CAppDeathActive( CVtMediatorPlugin& aMediatorPlugin, 
+                     RThread& aAppThread );
+              
+             /**
+             * Destructor.
+             */
+             ~CAppDeathActive();
+
+         public: // New functions
+
+             /**
+             * Starts active object.
+             */
+             void Start();
+
+         public: // From base classes
+
+             /**
+             * @see CActive::RunL.
+             */
+             virtual void RunL();
+                
+             /**
+             * @see CActive::DoCancel.
+             */
+             virtual void DoCancel();
+                
+             /**
+             * @see CActive::RunError.
+             */
+             virtual TInt RunError( TInt aError );
+
+         private:
+
+             // Reference to starter.
+             CVtMediatorPlugin& iMediatorPlugin;
+
+             // Reference to thread.
+             RThread& iAppThread;
+
+         };
+    
+    };
+
+#endif // C_VTMEDIATORPLUGIN_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/inc/vtinternalmediatorapi.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 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:  Message Interface between VT mediator plugin and VT application
+*
+*/
+
+
+#ifndef VTINTERNALMEDIATORAPI_H
+#define VTINTERNALMEDIATORAPI_H
+
+// INCLUDES
+#include <e32base.h>
+
+/** The category UID for the messages in this header file.
+ * UID for category is not real UID, it just need to unique in Domain
+ */
+const TUid KCatVideotelInternalEvents = { 0x101F8690 };   
+const TUid KCatVideotelInternalCommands = { 0x101F8691 };  
+
+/**  Version number of this API */
+const TInt KVideotelMdtrEventVersionMajor( 1 );
+const TInt KVideotelMdtrEventVersionMinor( 0 );
+const TInt KVideotelMdtrEventVersionBuild( 0 );
+
+/**  Version number of this API */
+const TInt KVideotelMdtrCommandsVersionMajor( 1 );
+const TInt KVideotelMdtrCommandsVersionMinor( 0 );
+const TInt KVideotelMdtrCommandsVersionBuild( 0 );
+
+struct TVtVideoTelephonyCallInformation
+{   
+    /** Max length of display text */
+    enum { TDisplayTextMaxLength = 100 };        
+                                     
+    /** Display text type definition */
+    typedef TBuf<TDisplayTextMaxLength> TDisplayText;
+
+    /** Remote end CLI identifier (name/number/call id) */
+    TDisplayText iDisplayText;
+    
+    /** Call id of the video call */
+    TInt iCallId;
+                                 
+    /** Indicates voice call creation possibility to remote end (number is
+     *  available)
+     */
+    TBool iVoiceCallPossible; 
+    
+    /** Dataport name or empty buffer if not specified in the event */
+    TName iDataport;
+
+    /**
+    * Defines which parts of the event date is valid
+    */
+    enum TMessageDataValidity {
+        EDisplayTextValid = 0x01,
+        EDataportValid    = 0x02
+    };
+                                               
+    /** Event data validity */
+    TUint iEventDataValidity;
+        
+};
+
+typedef TPckgBuf<TVtVideoTelephonyCallInformation> TVtMediatorInfoPackage;
+
+/**  Events bwtween Video Telephony Mediator plugin and VT application. */
+enum TVideotelMdtrEvents
+    {
+    /**
+     * Event with TVtVideoTelephonyCallInformation as content
+     * Consuming event requires capability ECapabilityReadDeviceData
+     */
+    EVtMediatorEventVideoCallInformation = 0
+    };
+
+enum TVideotelMdtrCommands
+    {
+    EVtMediatorReleaseDataport = 0
+    };
+
+#endif // VTINTERNALMEDIATORAPI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/rom/vtmediatorplugin.iby	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 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:  IBY file
+ *
+*/
+
+#ifndef __VTMEDIATORPLUGIN_IBY__
+#define __VTMEDIATORPLUGIN_IBY__
+
+#ifdef __CS_VIDEO_TELEPHONY
+ECOM_PLUGIN( vtmediatorplugin.dll, vtmediatorplugin.rsc)
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/src/cvtmediatorplugin.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1024 @@
+/*
+* Copyright (c) 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 Telephony mediator plugin header
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32def.h>
+#include <w32std.h>
+#include <apacmdln.h>
+#include <apaflrec.h>
+#include <apgcli.h>
+#include <mediatordomainuids.h>
+#include <eikdll.h>
+#include <apgcli.h>
+#include <apgwgnam.h>
+#include <apgtask.h>
+#include <mediatorcommandstotelephonyapi.h>
+#include <videotelcontrolmediatorapi.h>
+#include <videoteltophonecommandsapi.h>
+#include "cvtmediatorplugin.h"
+
+
+// CONSTANTS
+#ifdef _DEBUG
+#define TRACE(x) RDebug::Print( _L(x) );
+#define TRACE2(x,y) RDebug::Print( _L(x),y );
+#else
+#define TRACE(x)
+#define TRACE2(x,y)
+#endif
+                       
+// This array's values are used in algorithm defining if video telephone
+// application should be started. Previous state value is substracted from new 
+// state value and if result is greater than zero, app is started.
+// This tackles transitions where a state is for some reason skipped,
+// e.g. idle -> connected (dialling/ringing/answering states were not detected).
+// Negative value indicates call clearing.
+static const TInt KVtCallStateActionArray[] = {
+    0, //ECallStateUnknown
+    0, //ECallStateIdle
+    1, // ECallStateDialling
+    0, // ECallStateEmergencyDialling (not valid video call state)
+    1, // ECallStateRinging
+    1, // ECallStateConnecting
+    1, // ECallStateConnected
+    0, // ECallStateHangingUp
+    0, // ECallStateHeld (not valid video call state)
+    1, // ECallStateAnswering
+    0, // ECallStateRejecting
+    0  // ECallStateDisconnecting
+    };
+
+static const TInt KVtAppNotReady = 5000;
+
+static const TInt KVtEngMdtrCmdTimeout = 500000;
+
+static const TInt KVtInitCallId = -1000;
+
+// array granularity is 2 (use dataport, release dataport commands)
+static const TInt KVtMdtrCmdArrayGranularity = 2;
+
+const TUid KVtCmVideoTelUiUid = { 0x101F8681 };
+
+static const TInt KRamNeededForVideoCalls = 4000000;
+
+// VT application path 
+_LIT( KVtCmVideoTelUiPath, "\\sys\\bin\\videotelui.exe" );
+
+
+// -----------------------------------------------------------------------------
+// CMediatorTestPlugin::CMediatorTestPlugin
+// First phase construction.
+// -----------------------------------------------------------------------------
+CVtMediatorPlugin::CVtMediatorPlugin() : CMediatorPluginBase(),
+    iCommandList( KVtMdtrCmdArrayGranularity ),
+    iState( EWaitingAppLaunch ),
+    iActiveVideoCallState( ECallStateUnknown ),
+    iWaitingVideoCallState( ECallStateUnknown )
+    
+	{
+	ClearData(iActiveVideoCallInfo, iActiveVideoCallState);
+	ClearData(iWaitingVideoCallInfo, iWaitingVideoCallState);
+	}
+	
+CMediatorPluginBase* CVtMediatorPlugin::NewL()
+    {
+    TRACE("CVtMediatorPlugin::NewL<")
+    CVtMediatorPlugin* self = new (ELeave) CVtMediatorPlugin;
+    TRACE("CVtMediatorPlugin::NewL>")
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+CVtMediatorPlugin::~CVtMediatorPlugin()
+	{
+	TRACE("CVtMediatorPlugin::~CVtMediatorPlugin<")
+    
+	if ( iMediatorNotifications )
+	    {
+	    iMediatorNotifications->UnregisterNotificationObserver();
+	    delete iMediatorNotifications;
+	    }
+
+	// ignore error
+	if ( iEventConsumer )
+	    {
+	    iEventConsumer->UnsubscribeEvent(
+	            KMediatorTelephonyDomain,
+	            KCatEventsFromTelephony,
+	            EPhoneEventCallData );     
+	    delete iEventConsumer;
+	    }
+        
+    // ignore error     
+	if ( iEventProvider )
+	    {
+	    iEventProvider->UnregisterEvent(
+	            KMediatorVideoTelephonyDomain,
+	            KCatVideotelInternalEvents,
+	            EVtMediatorEventVideoCallInformation );   
+	    delete iEventProvider;
+	    }
+        
+    // ignore error
+	if ( iCommandResponder )
+	    {
+	    iCommandResponder->UnregisterCommand(
+	                KMediatorVideoTelephonyDomain,
+	                KCatPhoneToVideotelCommands,
+	                iCommandList );
+	    iCommandList.Close();
+	    delete iCommandResponder;
+	    }
+	
+	delete iCommandInitiator;
+    
+           
+    if( iAppDeathActive )
+        {
+        delete iAppDeathActive;
+        iAppThread.Close();
+        iWsSession.Close();
+        
+        }
+
+    TRACE("CVtMediatorPlugin::~CVtMediatorPlugin>")
+	}
+
+// -----------------------------------------------------------------------------
+// StartL.
+// -----------------------------------------------------------------------------
+void CVtMediatorPlugin::StartL()
+	{
+    TRACE("CVtMediatorPlugin.StartL<")
+    
+    // for monitoring VT app starting
+    iMediatorNotifications = CMediatorNotifications::NewL();
+    iMediatorNotifications->RegisterNotificationObserver( this );
+    
+    // consumer for call data events
+    iEventConsumer = CMediatorEventConsumer::NewL( this );
+    
+    iCommandInitiator = CMediatorCommandInitiator::NewL( this );
+    
+    
+    RegisterVtInternalEventL();
+    
+    RegisterDataportCommandL();       
+          
+    TRACE("CVtMediatorPlugin.StartL>")
+	}
+
+// -----------------------------------------------------------------------------
+// MediatorEventL.
+// -----------------------------------------------------------------------------
+void CVtMediatorPlugin::MediatorEventL( TUid /*aDomain*/,
+                             TUid aCategory,
+                             TInt aEventId,
+                             const TDesC8& aData )
+    {
+    TRACE("CVtMediatorPlugin.MediatorEventL<")
+    if ( aCategory == KCatEventsFromTelephony &&
+         aEventId == EPhoneEventCallData )
+        {
+        TTelephonyCallDataParamPackage pckg;
+        pckg.Copy( aData );
+        const TTelephonyCallDataParam telCallData = pckg();        
+        HandleCallStateChangeL( telCallData );        
+        }
+    TRACE("CVtMediatorPlugin.MediatorEventL>")
+    }
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::MediatorEventsAddedL
+//
+// subscribes to CLI event when it is registered
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorEventsAddedL( TUid aDomain/*aDomain*/,
+                                   TUid aCategory,
+                                   const REventList& aEvents )
+    {
+    TRACE("CVtMediatorPlugin.MediatorEventsAddedL<")
+    
+    if ( aCategory == KCatEventsFromTelephony )
+        {
+        ChangeCallDataEventSubscriptionL( aEvents, ETrue );
+        }    
+    TRACE("CVtMediatorPlugin.MediatorEventsAddedL>")
+    }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorCommandsAddedL( TUid /*aDomain*/,
+                                     TUid aCategory,
+                                     const RCommandList& /*aCommands*/ )
+    {
+    TRACE("CVtMediatorPlugin.MediatorCommandsAddedL<")
+    if ( aCategory == KCatPhoneToVideotelCommands )
+        {
+        HandleVtCommandRegistrationL();
+        }
+    TRACE("CVtMediatorPlugin.MediatorCommandsAddedL>")
+    }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorCategoryRemovedL( TUid /*aDomain*/,
+    TUid /*aCategory*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorEventsRemovedL( TUid /*aDomain*/,
+                                     TUid aCategory,
+                                     const REventList& aEvents )
+    {
+    TRACE("CVtMediatorPlugin.MediatorEventsRemovedL<")
+    if ( aCategory == KCatEventsFromTelephony )
+        {
+        ChangeCallDataEventSubscriptionL( aEvents, EFalse );
+        }    
+    TRACE("CVtMediatorPlugin.MediatorEventsRemovedL>")
+    }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorCommandsRemovedL( TUid /*aDomain*/,
+                                       TUid aCategory,
+                                       const RCommandList& /*aCommands*/ )
+    {
+    TRACE("CVtMediatorPlugin.MediatorCommandsRemovedL<")  
+    if ( aCategory == KCatPhoneToVideotelCommands )
+        {
+        // VT has unregistered commands, meaning it is shutting down
+        HandleVtCommandUnregistrationL();
+        }
+    TRACE("CVtMediatorPlugin.MediatorCommandsRemovedL>")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::MediatorCommandL
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::MediatorCommandL( TUid aDomain,
+                                 TUid aCategory, 
+                                 TInt aCommandId,
+                                 TVersion /*aVersion*/, 
+                                 const TDesC8& aData )
+    {
+    TRACE("CVtMediatorPlugin.MediatorCommandL<") 
+    if ( aCategory == KCatPhoneToVideotelCommands )
+        {
+        if ( aCommandId == EVtCmdUseDataport )
+            {
+#ifdef _DEBUG           
+            // error in responding is ignored but printed on debug build
+            const TInt err =
+#endif            
+            iCommandResponder->IssueResponse( 
+                aDomain, aCategory, aCommandId, KErrNone, KNullDesC8() );
+            TRACE2("CVtMediatorPlugin.MediatorCommandL EVtCmdUseDataport err=%d", err )
+            HandleDataportCommandL( aData );
+            }
+        else if ( aCommandId == EVtCmdReleaseDataport )
+            {
+            if ( EReady == iState )
+                {
+                const TVersion version( 
+                        KVideotelMdtrCommandsVersionMajor,
+                        KVideotelMdtrCommandsVersionMinor,
+                        KVideotelMdtrCommandsVersionBuild );
+
+#ifdef _DEBUG           
+            // error in responding is ignored but printed on debug build
+            const TInt err =
+#endif                          
+                iCommandInitiator->IssueCommand(
+                        KMediatorVideoTelephonyDomain,
+                        KCatVideotelInternalCommands,
+                        EVtMediatorReleaseDataport,
+                        version,
+                        KNullDesC8() );
+            TRACE2("CVtMediatorPlugin.MediatorCommandL EVtCmdReleaseDataport, send to VT err=%d", err )
+                
+                }
+            else
+                {
+#ifdef _DEBUG           
+                // error in responding is ignored but printed on debug build
+                const TInt err =
+#endif            
+                iCommandResponder->IssueResponse( 
+                        aDomain, 
+                        aCategory, 
+                        aCommandId, 
+                        KErrNone, 
+                        KNullDesC8() );
+                TRACE2("CVtMediatorPlugin.MediatorCommandL EVtCmdReleaseDataport, just Resp err=%d", err ) 
+                }
+           
+            }
+        }
+    TRACE("CVtMediatorPlugin.MediatorCommandL>")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CommandResponseL
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CommandResponseL( TUid aDomain, TUid aCategory, 
+    TInt aCommandId, TInt /*aStatus*/, const TDesC8& /*aData*/ )
+    {
+    TRACE("CVtMediatorPlugin.CommandResponseL<")
+    if( ( aDomain == KMediatorVideoTelephonyDomain ) &&
+        ( aCategory == KCatVideotelInternalCommands ) )
+        {
+        TInt res =
+        iCommandResponder->IssueResponse( 
+                KMediatorVideoTelephonyDomain,
+                KCatPhoneToVideotelCommands,
+                EVtCmdReleaseDataport, 
+                KErrNone, 
+                KNullDesC8() );         
+         TRACE2("CVtMediatorPlugin.CommandResponseL, IssueResponse res: %d", res )  
+         User::LeaveIfError( res );      
+        }
+    TRACE("CVtMediatorPlugin.CommandResponseL>")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CancelMediatorCommand
+//
+// no-op
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CancelMediatorCommand( TUid /*aDomain*/,
+                                      TUid /*aCategory*/, 
+                                      TInt /*aCommandId*/ )
+    {
+    }
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::ChangeCallDataEventSubscriptionL
+//
+// Takes care of 'call data' event subscription.
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::ChangeCallDataEventSubscriptionL(
+    const REventList& aEvents,
+    const TBool aEventRegistered )
+    {
+    TRACE("CVtMediatorPlugin.ChangeCLIEventSubscription<")
+   
+    TInt res( KErrNone );
+    TInt eventCount = aEvents.Count();
+    while ( eventCount-- )
+        {
+        const TEvent& aEvent = aEvents[ eventCount ];
+        if ( aEvent.iEventId == EPhoneEventCallData )
+            {
+            if ( aEventRegistered )
+                {
+                // Phone has registered Call data event => subscribe it                
+                const TVersion version(
+                    KTelephonyEventsVersionMajor,
+                    KTelephonyEventsVersionMinor,
+                    KTelephonyEventsVersionBuild );
+                res = iEventConsumer->SubscribeEvent(
+                    KMediatorTelephonyDomain,
+                    KCatEventsFromTelephony,
+                    EPhoneEventCallData, version );
+                }
+            else
+                {
+                // Phone has unregistered Call data event => unsubscribe it
+                res = iEventConsumer->UnsubscribeEvent(
+                    KMediatorTelephonyDomain,
+                    KCatEventsFromTelephony,
+                    EPhoneEventCallData );
+                }
+            TRACE2("   (un)subscribe result=%d", res )
+            eventCount = 0; // break loop
+            }
+        }
+    
+    TRACE2("CVtMediatorPlugin.ChangeCLIEventSubscription result=%d>", res )
+    User::LeaveIfError( res );
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::HandleVtCommandRegistrationL
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::HandleVtCommandRegistrationL()
+    {
+    TRACE("CVtMediatorPlugin.HandleVtCommandRegistrationL<" )
+    if ( iState == EWaitingEventRegistration )
+        {
+        // VT app registered commands => it can also receive events
+        // NOTE: it is expected that VT application first subscribes
+        // to internal events and only after that registers commands to
+        // avoid timing problems.
+        iState = EReady;
+        delete iCallBack;
+        iCallBack = NULL;
+        TCallBack cb( &EventRaiserCallback, this );
+        iCallBack = new ( ELeave ) CAsyncCallBack( cb, 
+            CActive::EPriorityStandard );        
+        TRACE("CVtMediatorPlugin enque async callback" )
+        iCallBack->CallBack();        
+        }
+    TRACE("CVtMediatorPlugin.HandleVtCommandRegistrationL>" )
+    }
+
+TInt CVtMediatorPlugin::EventRaiserCallback( TAny* aAny )
+    {
+    TRACE("CVtMediatorPlugin.EventRaiserCallback<" )
+    CVtMediatorPlugin* plugin = reinterpret_cast<CVtMediatorPlugin*>( aAny );
+    delete plugin->iCallBack;
+    plugin->iCallBack = NULL;
+    TRAP_IGNORE( plugin->RaiseVtEventL() );
+    TRACE("CVtMediatorPlugin.EventRaiserCallback>" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::HandleVtCommandUnregistrationL()
+    {
+    // unregistration means that VT app is shutting down.    
+    TRACE("CVtMediatorPlugin.HandleVtCommandUnregistrationL<" )
+    ClearData(iActiveVideoCallInfo, iActiveVideoCallState);
+    //ClearData(iWaitingVideoCallInfo);
+    TRACE("CVtMediatorPlugin.HandleVtCommandUnregistrationL>" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::LaunchVtAppL()
+    {
+        
+    TRACE("CVtMediatorPlugin.LaunchVtAppL<" )
+    
+    if ( !IsEnoughMemory() )
+        {
+        const TVersion KTelephonyCmdVersion(
+                KTelephonyCommandsVersionMajor,
+                KTelephonyCommandsVersionMinor,
+                KTelephonyCommandsVersionBuild );
+        const TInt res =
+        iCommandInitiator->IssueCommand(
+                KMediatorTelephonyDomain,
+                KCatVideoTelToPhoneCommands,
+                EVtCmdLowMemory,
+                KTelephonyCmdVersion,
+                KNullDesC8() );
+        ClearData(iActiveVideoCallInfo, iActiveVideoCallState);
+        ClearData(iWaitingVideoCallInfo, iWaitingVideoCallState);
+        TRACE("CVtMediatorPlugin.LaunchVtAppL, Insufficient Memory" )
+        return;
+        }
+
+    iAppDeathActive = new ( ELeave ) CAppDeathActive( *this, iAppThread );
+       
+    User::LeaveIfError( iWsSession.Connect() );
+
+    TInt wgId = 0;
+    TBool found = EFalse;
+
+    // Check if there is already application running. Then we do not 
+    // start new one - rather we just monitor the existing one.
+    while ( ( wgId != KErrNotFound ) && !found )
+        {
+        CApaWindowGroupName::FindByAppUid( 
+            KVtCmVideoTelUiUid, 
+            iWsSession, 
+            wgId );
+
+        TApaTask task( iWsSession );
+        task.SetWgId( wgId );
+        if ( task.Exists() )
+            {
+            if ( iAppThread.Open( task.ThreadId() ) == KErrNone )
+                {
+                TExitType exitType = iAppThread.ExitType();
+                found = ( exitType == EExitPending );
+
+                if ( found )
+                    {
+                    iAppThreadId = task.ThreadId();
+                    }
+                }
+            }
+            
+        if ( !found )
+            {
+            iAppThread.Close();
+             }
+        }
+
+    // If application was not found, then launch new application.
+    if ( !found )
+        {
+        TThreadId threadId;
+#ifndef SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
+        CApaCommandLine* cmd = CApaCommandLine::NewLC();
+        cmd->SetExecutableNameL( KVtCmVideoTelUiPath );
+#else // !SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
+        CApaCommandLine* cmd = CApaCommandLine::NewLC( KVtCmVideoTelUiPath );
+#endif // SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
+        cmd->SetCommandL( EApaCommandBackground );
+            
+        RApaLsSession session;
+        User::LeaveIfError( session.Connect() );
+        CleanupClosePushL( session );
+            
+        TInt err = session.StartApp( *cmd, threadId );
+        if ( err > KErrNone )
+            {
+            err = KErrGeneral;
+            }
+        User::LeaveIfError( err );
+        CleanupStack::PopAndDestroy( 2, cmd ); // CleanupClosePushL, cmd
+        User::LeaveIfError( iAppThread.Open( threadId ) );
+        iAppThreadId = threadId;
+        }
+
+    // Start active objects.
+    iState = EWaitingEventRegistration;
+    iAppDeathActive->Start();
+    TRACE("CVtMediatorPlugin.LaunchVtAppL>" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::SaveCallData( const TTelephonyCallDataParam& aData, TVtVideoTelephonyCallInformation& iVtCallInfo )
+    {
+    TRACE("CVtMediatorPlugin.SaveCallData<" )
+    iVtCallInfo.iDisplayText = aData.iCLIText.Left(
+        TVtVideoTelephonyCallInformation::TDisplayTextMaxLength );
+        
+    TRACE2("CVtMediatorPlugin.SaveCallData iDisplayText=%S",
+        &iVtCallInfo.iDisplayText );
+                
+    iVtCallInfo.iCallId = aData.iCallId;
+    
+    if ( KNullDesC() != aData.iRemotePhoneNumber )
+        {
+        iVtCallInfo.iVoiceCallPossible = ETrue;
+        }
+    iVtCallInfo.iEventDataValidity |= 
+        TVtVideoTelephonyCallInformation::EDisplayTextValid;
+    TRACE2("CVtMediatorPlugin.SaveCallData data saved=%d>",
+        aData.iCallType == ECallTypeVideo )
+    }
+
+                     
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::HandleDataportCommandL( const TDesC8& aData )
+    {
+    TRACE("CVtMediatorPlugin.HandleDataportCommandL<" ) 
+    TDataPortPackage pckg;
+    pckg.Copy( aData );
+    iActiveVideoCallInfo.iDataport = pckg();
+    iActiveVideoCallInfo.iEventDataValidity |= 
+        TVtVideoTelephonyCallInformation::EDataportValid;     
+    RaiseVtEventL();
+    TRACE("CVtMediatorPlugin.HandleDataportCommandL>" )
+    }
+
+                         
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::ClearData
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::ClearData(TVtVideoTelephonyCallInformation& aVtCallInfo, TCallState& aCallState)
+    {
+    TRACE("CVtMediatorPlugin.ClearData<" )
+    if ( aVtCallInfo.iCallId == iActiveVideoCallInfo.iCallId )
+        {
+        iState = EWaitingAppLaunch;
+        }
+    aVtCallInfo.iEventDataValidity = 0;
+    aVtCallInfo.iDataport.Zero();
+    aVtCallInfo.iVoiceCallPossible = EFalse;
+    //for video call, it should be 9/10
+    //for other call, it will be from -1 to 8
+    aVtCallInfo.iCallId = KVtInitCallId;
+    aVtCallInfo.iDisplayText.Zero();
+    aCallState = ECallStateIdle;
+    TRACE("CVtMediatorPlugin.ClearData>" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::RegisterVtInternalEventL
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::RegisterVtInternalEventL()
+    {
+    TRACE("CVtMediatorPlugin.RegisterVtInternalEventL<" )
+    iEventProvider = CMediatorEventProvider::NewL();
+    
+    TVersion version(
+        KVideotelMdtrEventVersionMajor,
+        KVideotelMdtrEventVersionMinor,
+        KVideotelMdtrEventVersionBuild );
+
+    TCapabilitySet capSet;
+    capSet.SetEmpty();
+    capSet.AddCapability( ECapabilityReadDeviceData );
+            
+    const TInt err = iEventProvider->RegisterEvent(
+        KMediatorVideoTelephonyDomain,
+        KCatVideotelInternalEvents,
+        EVtMediatorEventVideoCallInformation,
+        version,
+        capSet );
+          
+   
+    TRACE2("CVtMediatorPlugin.RegisterVtInternalEventL err=%d>", err )
+    User::LeaveIfError( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::RegisterDataportCommandL
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::RegisterDataportCommandL()
+    {
+    TRACE("CVtMediatorPlugin.RegisterDataportCommandL<" )
+    iCommandResponder = CMediatorCommandResponder::NewL( this );
+    
+    TCapabilitySet capSet;
+    capSet.SetEmpty();
+    capSet.AddCapability( ECapabilityWriteDeviceData );
+    MediatorService::TCommand command;
+    
+    command.iCaps = capSet;
+    command.iVersion = TVersion( 
+            KPhoneToVideotelCmdVersionMajor, 
+            KPhoneToVideotelCmdVersionMinor,
+            KPhoneToVideotelCmdVersionBuild );
+    command.iTimeout = KVtEngMdtrCmdTimeout;
+        
+    // enable microphone command
+    command.iCommandId = EVtCmdUseDataport;
+    iCommandList.Append( command );
+        
+    // Releasedataport command
+    capSet.SetEmpty();
+    capSet.AddCapability( ECapabilityPowerMgmt );
+    command.iCommandId = EVtCmdReleaseDataport;
+    iCommandList.Append( command );
+    
+    const TInt err = iCommandResponder->RegisterCommand( 
+        KMediatorVideoTelephonyDomain,
+        KCatPhoneToVideotelCommands,
+        iCommandList );    
+    
+    TRACE2("CVtMediatorPlugin.RegisterDataportCommandL err=%d>", err )
+    User::LeaveIfError( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::RaiseVtEventL
+//
+// Raises VT call info event if in suitable state, i.e. VT app has subscribed 
+// the event.
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::RaiseVtEventL()
+    {
+    TRACE("CVtMediatorPlugin.RaiseVtEventL<" )
+    TInt result = KVtAppNotReady;  // does not cause leave
+    TRACE2("CVtMediatorPlugin.RaiseVtEventL iState=%d>", 
+            iState )
+    TRACE2("CVtMediatorPlugin.RaiseVtEventL iActiveVideoCallState=%d>", 
+            iActiveVideoCallState )            
+    if ( iState == EReady && // application subscribed to the event
+    
+        // don't send event if video call is not starting/ongoing
+         ( iActiveVideoCallState >= ECallStateDialling &&
+         iActiveVideoCallState <= ECallStateConnected ) )
+        {
+        const TVersion version(
+            KVideotelMdtrEventVersionMajor,
+            KVideotelMdtrEventVersionMinor,
+            KVideotelMdtrEventVersionBuild );            
+            
+        const TVtMediatorInfoPackage pckg( iActiveVideoCallInfo );
+        result = iEventProvider->RaiseEvent(
+            KMediatorVideoTelephonyDomain,
+            KCatVideotelInternalEvents,
+            EVtMediatorEventVideoCallInformation,
+            version,
+            pckg
+            );
+        }
+    TRACE2("CVtMediatorPlugin.RaiseVtEventL result=%d>", result )
+    User::LeaveIfError( result );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::HandleCallStateChangeL
+//
+// Compares previous and new video call states and resolves based on result
+// if Video telephone applicaton should be launched.
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::HandleCallStateChangeL(
+    const TTelephonyCallDataParam& aData )
+    {
+    TRACE("CVtMediatorPlugin.HandleCallStateChangeL<" )    
+    
+    TRACE2("CVtMediatorPlugin.HandleCallStateChangeL calltype=%d>", 
+            aData.iCallType )
+    TRACE2("CVtMediatorPlugin.HandleCallStateChangeL saved Activecallid=%d>", 
+            iActiveVideoCallInfo.iCallId )
+    TRACE2("CVtMediatorPlugin.HandleCallStateChangeL saved Waitingcallid=%d>", 
+            iWaitingVideoCallInfo.iCallId )
+    TRACE2("CVtMediatorPlugin.HandleCallStateChangeL callid=%d>", 
+            aData.iCallId )   
+    TRACE2("CVtMediatorPlugin.HandleCallStateChangeL ActiveCallOldState=%d>", 
+            iActiveVideoCallState )
+    TRACE2("CVtMediatorPlugin.HandleCallStateChangeL WaitingCallOldState=%d>", 
+            iWaitingVideoCallState )
+    TRACE2("CVtMediatorPlugin.HandleCallStateChangeL NewState=%d>",
+            aData.iCallState )
+            
+    //if the call is waitingcall, just save/clear
+    if ( aData.iCallType == ECallTypeVideo ||       
+        // check also call id because in call clearing states call type may
+        // be unspecified but call id is saved in call setup and we can
+        // compare to it.
+         iActiveVideoCallInfo.iCallId == aData.iCallId  ||
+         iWaitingVideoCallInfo.iCallId == aData.iCallId )
+        {
+        TBool isWaitingCall = ETrue;
+        
+        /**
+         * firstly we should check the callid to identify if it is a waitingcal/activecall
+         * imagine the usecase that long press endkey to shutdown both calls.
+         * after that checking iState
+         */
+        if ( iWaitingVideoCallInfo.iCallId == aData.iCallId )
+            {
+            isWaitingCall =  ETrue;
+            }
+        else if ( iActiveVideoCallInfo.iCallId == aData.iCallId )
+            {
+            isWaitingCall = EFalse;
+            }
+        //no vt app launched, this happens while vt first launching or end key to shutdown both calls
+        else if ( iState == EWaitingAppLaunch )
+            {
+            isWaitingCall =  EFalse;
+            }
+        
+        TRACE2("CVtMediatorPlugin.HandleCallStateChangeL isWaitingCall=%d>",
+                isWaitingCall)
+        
+        TCallState& callState = isWaitingCall?iWaitingVideoCallState:iActiveVideoCallState;
+        TVtVideoTelephonyCallInformation& vtCallInfo = isWaitingCall?iWaitingVideoCallInfo:iActiveVideoCallInfo;
+            
+        TBool launchNeeded = KVtCallStateActionArray[ aData.iCallState ] -
+                    KVtCallStateActionArray[callState] > 0;
+        if ( isWaitingCall )
+            {
+            launchNeeded = EFalse;
+            }
+        callState = aData.iCallState;
+            
+        switch ( callState )
+            {
+            case ECallStateDialling:
+            case ECallStateRinging:
+            case ECallStateConnecting:
+            case ECallStateConnected:
+                SaveCallData( aData,  vtCallInfo);
+                break;
+            default:
+                // data becomes invalid in other states (=call clearing/idle)
+                ClearData(vtCallInfo, callState);
+                break;
+            }
+        if ( launchNeeded )
+            {
+            LaunchVtAppL();
+            }
+        if ( !isWaitingCall )
+            {
+            RaiseVtEventL();
+            }
+        }
+        
+    TRACE("CVtMediatorPlugin.HandleCallStateChangeL>" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::IsEnoughMemory
+//
+// Check if there is enough memory to launch
+// -----------------------------------------------------------------------------
+//
+TBool CVtMediatorPlugin::IsEnoughMemory()
+    {
+    TRACE("CVtMediatorPlugin::IsEnoughMemory<" )    
+    // Fetch amount of free memory.
+    TMemoryInfoV1Buf memory;
+    UserHal::MemoryInfo( memory );
+    TInt freeRam = (TInt)( memory().iFreeRamInBytes );
+    TRACE2("CVtMediatorPlugin::IsEnoughMemory: freeRam = %d", freeRam )
+    
+    TBool enoughRam = ETrue;
+
+    if ( freeRam < KRamNeededForVideoCalls )
+        {
+        FreeRam();
+        freeRam = (TInt)( memory().iFreeRamInBytes );
+        TRACE2("CVtMediatorPlugin::IsEnoughMemory: after free, freeRam = %d", freeRam )
+        if ( freeRam < KRamNeededForVideoCalls )
+            {
+            enoughRam = EFalse;
+            TRACE ("CVtMediatorPlugin::IsEnoughMemory : Not enough RAM")
+                
+            }
+        }
+    TRACE("CVtMediatorPlugin::IsEnoughMemory>" )    
+    return enoughRam;
+    }  
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::FreeRam
+// Try to free memory to match the memory usage of VT
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::FreeRam()
+    {
+    TRACE("CVtMediatorPlugin.FreeRam()<")
+    User::CompressAllHeaps();
+    TRACE("CVtMediatorPlugin.FreeRam()>")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::StopDeathActiveL
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::StopDeathActiveL()
+    {
+    TRACE("CVtMediatorPlugin.StopDeathActive<")
+    delete iAppDeathActive;
+    iAppThread.Close();
+    iWsSession.Close();
+    //if there is a waiting call, check if we need to launch it
+    TRACE2("CVtMediatorPlugin.StopDeathActive WaitintCallID=%d>",
+            iWaitingVideoCallInfo.iCallId)
+    if ( iWaitingVideoCallInfo.iCallId != KVtInitCallId )
+        {
+        iActiveVideoCallInfo = iWaitingVideoCallInfo;
+        iActiveVideoCallState = iWaitingVideoCallState;
+        ClearData(iWaitingVideoCallInfo, iWaitingVideoCallState);
+        
+        if ( iActiveVideoCallState == ECallStateDialling ||
+                iActiveVideoCallState ==  ECallStateRinging ||
+                iActiveVideoCallState == ECallStateConnecting ||
+                iActiveVideoCallState == ECallStateConnected ||
+                iActiveVideoCallState == ECallStateAnswering )
+                {
+                LaunchVtAppL();
+                RaiseVtEventL();
+                }
+        }
+    TRACE("CVtMediatorPlugin.StopDeathActive>")
+    }
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::CAppDeathActive
+// -----------------------------------------------------------------------------
+//
+CVtMediatorPlugin::CAppDeathActive::CAppDeathActive( 
+        CVtMediatorPlugin& aMediatorPlugin,
+        RThread& aAppThread
+    )
+    : CActive( CActive::EPriorityStandard ),
+      iMediatorPlugin( aMediatorPlugin ),
+      iAppThread( aAppThread )
+      
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::~CAppDeathActive
+// -----------------------------------------------------------------------------
+//
+CVtMediatorPlugin::CAppDeathActive::~CAppDeathActive()
+    {
+    TRACE("CVtMediatorPlugin.~CAppDeathActive")
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::Start
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CAppDeathActive::Start()
+    {
+    TRACE("CVtMediatorPlugin.Start<")
+    Cancel();
+    iAppThread.Logon( iStatus );
+    SetActive();
+    TRACE("CVtMediatorPlugin.Start>")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CAppDeathActive::RunL()
+    {
+    //do something here
+    TRACE("CVtMediatorPlugin.RunL<")
+    iMediatorPlugin.StopDeathActiveL();
+    TRACE("CVtMediatorPlugin.RunL>")
+      
+    }
+        
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtMediatorPlugin::CAppDeathActive::DoCancel()
+    {
+    iAppThread.LogonCancel( iStatus );
+    }
+        
+// -----------------------------------------------------------------------------
+// CVtMediatorPlugin::CAppDeathActive::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CVtMediatorPlugin::CAppDeathActive::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtengines/vtmediatorplugin/src/vtmediatorpluginproxy.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 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:  Source file for MediatorTest Plugin Proxy
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+#include <implementationproxy.h>
+#include "cvtmediatorplugin.h"
+
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+	{
+	IMPLEMENTATION_PROXY_ENTRY( 0x200159A0, CVtMediatorPlugin::NewL )
+	};
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+	return ImplementationTable;
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/EABI/DisplaySinkU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	_Z11CreateSinkLR18TDisplaySinkParamsRK6TDesC8 @ 1 NONAME
+	_ZN18TDisplaySinkParamsC1Ev @ 2 NONAME
+	_ZN18TDisplaySinkParamsC2Ev @ 3 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/EABI/VtImageConverterU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,32 @@
+EXPORTS
+	_ZN24CVTYUVFbsBitmapConverter15SetDestinationLERK10CFbsBitmap @ 1 NONAME
+	_ZN24CVTYUVFbsBitmapConverter15SetDestinationLEi @ 2 NONAME
+	_ZN24CVTYUVFbsBitmapConverter8ProcessLEv @ 3 NONAME
+	_ZN24CVTYUVFbsBitmapConverterD0Ev @ 4 NONAME
+	_ZN24CVTYUVFbsBitmapConverterD1Ev @ 5 NONAME
+	_ZN24CVTYUVFbsBitmapConverterD2Ev @ 6 NONAME
+	_ZN25CVSFbsBitmapIYUVConverter10SetSourceLERK10CFbsBitmap @ 7 NONAME
+	_ZN25CVSFbsBitmapIYUVConverter4NewLERK10CFbsBitmap @ 8 NONAME
+	_ZN25CVSFbsBitmapIYUVConverter8ProcessLEv @ 9 NONAME
+	_ZN25CVSFbsBitmapIYUVConverterD0Ev @ 10 NONAME
+	_ZN25CVSFbsBitmapIYUVConverterD1Ev @ 11 NONAME
+	_ZN25CVSFbsBitmapIYUVConverterD2Ev @ 12 NONAME
+	_ZN25CVTIYUVFbsBitmapConverter4NewLERK5TSizeRK10CFbsBitmap @ 13 NONAME
+	_ZN25CVTIYUVFbsBitmapConverter4NewLERK5TSizei @ 14 NONAME
+	_ZN25CVTYV12FbsBitmapConverter4NewLERK5TSizeRK10CFbsBitmap @ 15 NONAME
+	_ZN25CVTYV12FbsBitmapConverter4NewLERK5TSizei @ 16 NONAME
+	_ZN30CVTYUVPlanarFbsBitmapConverter10SetSourceLERK5TSizeRK6TDesC8 @ 17 NONAME
+	_ZN30CVTYUVPlanarFbsBitmapConverter10SetSourceLERK6TDesC8 @ 18 NONAME
+	_ZN30CVTYUVPlanarFbsBitmapConverter14SetSourceSizeLERK5TSize @ 19 NONAME
+	_ZNK25CVSFbsBitmapIYUVConverter7YUVDataEv @ 20 NONAME
+	_ZTI24CVTYUVFbsBitmapConverter @ 21 NONAME ; #<TI>#
+	_ZTI25CVSFbsBitmapIYUVConverter @ 22 NONAME ; #<TI>#
+	_ZTI25CVTIYUVFbsBitmapConverter @ 23 NONAME ; #<TI>#
+	_ZTI25CVTYV12FbsBitmapConverter @ 24 NONAME ; #<TI>#
+	_ZTI30CVTYUVPlanarFbsBitmapConverter @ 25 NONAME ; #<TI>#
+	_ZTV24CVTYUVFbsBitmapConverter @ 26 NONAME ; #<VT>#
+	_ZTV25CVSFbsBitmapIYUVConverter @ 27 NONAME ; #<VT>#
+	_ZTV25CVTIYUVFbsBitmapConverter @ 28 NONAME ; #<VT>#
+	_ZTV25CVTYV12FbsBitmapConverter @ 29 NONAME ; #<VT>#
+	_ZTV30CVTYUVPlanarFbsBitmapConverter @ 30 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/EABI/VtImageTransformsU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,59 @@
+EXPORTS
+	_ZN12CVtImageIYUV4NewLERK5TSize @ 1 NONAME
+	_ZN12CVtImageIYUV4NewLERK5TSizeR5TPtr8 @ 2 NONAME
+	_ZN12CVtImageIYUV4NewLERK5TSizeRK6TDesC8 @ 3 NONAME
+	_ZN12CVtImageIYUV9SetImageLER5TPtr8 @ 4 NONAME
+	_ZN12CVtImageIYUV9SetImageLERK6TDesC8 @ 5 NONAME
+	_ZN12CVtImageIYUVD0Ev @ 6 NONAME
+	_ZN12CVtImageIYUVD1Ev @ 7 NONAME
+	_ZN12CVtImageIYUVD2Ev @ 8 NONAME
+	_ZN14CVtImageBitmap10SetBitmapLEi @ 9 NONAME
+	_ZN14CVtImageBitmap4NewLERK5TSize12TDisplayMode @ 10 NONAME
+	_ZN14CVtImageBitmap4NewLEi @ 11 NONAME
+	_ZN14CVtImageBitmap7ResizeLERK5TSize @ 12 NONAME
+	_ZN14CVtImageBitmapD0Ev @ 13 NONAME
+	_ZN14CVtImageBitmapD1Ev @ 14 NONAME
+	_ZN14CVtImageBitmapD2Ev @ 15 NONAME
+	_ZN14CVtImageScaler11SetQualityLENS_8TQualityE @ 16 NONAME
+	_ZN14CVtImageScaler4NewLER22MVtImageScalerObserverNS_8TQualityEN7CActive9TPriorityE @ 17 NONAME
+	_ZN14CVtImageScaler6ScaleLERK8CVtImageRS0_ @ 18 NONAME
+	_ZN14CVtImageScalerD0Ev @ 19 NONAME
+	_ZN14CVtImageScalerD1Ev @ 20 NONAME
+	_ZN14CVtImageScalerD2Ev @ 21 NONAME
+	_ZN15CVtImageRotator4NewLER23MVtImageRotatorObserverN7CActive9TPriorityE @ 22 NONAME
+	_ZN15CVtImageRotator7RotateLERK8CVtImageRS0_RKNS_14TRotationAngleE @ 23 NONAME
+	_ZN15CVtImageRotatorD0Ev @ 24 NONAME
+	_ZN15CVtImageRotatorD1Ev @ 25 NONAME
+	_ZN15CVtImageRotatorD2Ev @ 26 NONAME
+	_ZNK12CVtImageIYUV12UVPlaneWidthEv @ 27 NONAME
+	_ZNK12CVtImageIYUV13UVPlaneHeightEv @ 28 NONAME
+	_ZNK12CVtImageIYUV1UEv @ 29 NONAME
+	_ZNK12CVtImageIYUV1VEv @ 30 NONAME
+	_ZNK12CVtImageIYUV1YEv @ 31 NONAME
+	_ZNK12CVtImageIYUV5ImageEv @ 32 NONAME
+	_ZNK14CVtImageBitmap6BitmapEv @ 33 NONAME
+	_ZNK8CVtImage4TypeEv @ 34 NONAME
+	_ZTI12CVtImageIYUV @ 35 NONAME ; #<TI>#
+	_ZTI14CVtImageBitmap @ 36 NONAME ; #<TI>#
+	_ZTI14CVtImageScaler @ 37 NONAME ; #<TI>#
+	_ZTI15CVtImageRotator @ 38 NONAME ; #<TI>#
+	_ZTI25CVtImageScalerImplNearest @ 39 NONAME ; #<TI>#
+	_ZTI26CVtImageScalerImplBilinear @ 40 NONAME ; #<TI>#
+	_ZTI28CVtImageRotatorImplClockwise @ 41 NONAME ; #<TI>#
+	_ZTI29CVtImageRotatorImplMirrorFlip @ 42 NONAME ; #<TI>#
+	_ZTI33CVtImageScalerImplWeightedAverage @ 43 NONAME ; #<TI>#
+	_ZTV12CVtImageIYUV @ 44 NONAME ; #<VT>#
+	_ZTV14CVtImageBitmap @ 45 NONAME ; #<VT>#
+	_ZTV14CVtImageScaler @ 46 NONAME ; #<VT>#
+	_ZTV15CVtImageRotator @ 47 NONAME ; #<VT>#
+	_ZTV25CVtImageScalerImplNearest @ 48 NONAME ; #<VT>#
+	_ZTV26CVtImageScalerImplBilinear @ 49 NONAME ; #<VT>#
+	_ZTV28CVtImageRotatorImplClockwise @ 50 NONAME ; #<VT>#
+	_ZTV29CVtImageRotatorImplMirrorFlip @ 51 NONAME ; #<VT>#
+	_ZTV33CVtImageScalerImplWeightedAverage @ 52 NONAME ; #<VT>#
+	_ZN14CVtImageScaler5ScaleERK8CVtImageRS0_ @ 53 NONAME
+	_ZN15CVtImageRotator6RotateERK8CVtImageRS0_RKNS_14TRotationAngleE @ 54 NONAME
+	_ZN14CVtImageScaler9ScaleNowLERK8CVtImageRS0_ @ 55 NONAME
+	_ZTI18CVtImageScalerImpl @ 56 NONAME ; #<TI>#
+	_ZTV18CVtImageScalerImpl @ 57 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bmarm/DISPLAYSINKU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+	SetBitmapAvailable__12CDisplaySinkQ212CDisplaySink9TBitmapNo @ 1 NONAME R3UNUSED ; CDisplaySink::SetBitmapAvailable(CDisplaySink::TBitmapNo)
+	Release__12CDisplaySink @ 2 NONAME R3UNUSED ; CDisplaySink::Release(void)
+	ResumeSink__12CDisplaySink @ 3 NONAME R3UNUSED ; CDisplaySink::ResumeSink(void)
+	NewSinkL__12CDisplaySinkG18TDisplaySinkParamsRC6TDesC8 @ 4 NONAME ; CDisplaySink::NewSinkL(TDisplaySinkParams, TDesC8 const &)
+	UpdateSinkParamsL__12CDisplaySinkRC18TDisplaySinkParamsRi @ 5 NONAME R3UNUSED ; CDisplaySink::UpdateSinkParamsL(TDisplaySinkParams const &, int &)
+	"_._12CDisplaySink" @ 6 NONAME R3UNUSED ; CDisplaySink::~CDisplaySink(void)
+	__18TDisplaySinkParams @ 7 NONAME R3UNUSED ; TDisplaySinkParams::TDisplaySinkParams(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bmarm/VTIMAGECONVERTERU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,18 @@
+EXPORTS
+	"_._25CVSFbsBitmapIYUVConverter" @ 1 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::~CVSFbsBitmapIYUVConverter(void)
+	NewL__25CVTIYUVFbsBitmapConverterRC5TSizeRC10CFbsBitmap @ 2 NONAME R3UNUSED ; CVTIYUVFbsBitmapConverter::NewL(TSize const &, CFbsBitmap const &)
+	NewL__25CVTIYUVFbsBitmapConverterRC5TSizei @ 3 NONAME R3UNUSED ; CVTIYUVFbsBitmapConverter::NewL(TSize const &, int)
+	NewL__25CVTYV12FbsBitmapConverterRC5TSizeRC10CFbsBitmap @ 4 NONAME R3UNUSED ; CVTYV12FbsBitmapConverter::NewL(TSize const &, CFbsBitmap const &)
+	NewL__25CVTYV12FbsBitmapConverterRC5TSizei @ 5 NONAME R3UNUSED ; CVTYV12FbsBitmapConverter::NewL(TSize const &, int)
+	ProcessL__24CVTYUVFbsBitmapConverter @ 6 NONAME R3UNUSED ; CVTYUVFbsBitmapConverter::ProcessL(void)
+	ProcessL__25CVSFbsBitmapIYUVConverter @ 7 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::ProcessL(void)
+	SetDestinationL__24CVTYUVFbsBitmapConverterRC10CFbsBitmap @ 8 NONAME R3UNUSED ; CVTYUVFbsBitmapConverter::SetDestinationL(CFbsBitmap const &)
+	SetDestinationL__24CVTYUVFbsBitmapConverteri @ 9 NONAME R3UNUSED ; CVTYUVFbsBitmapConverter::SetDestinationL(int)
+	SetSourceL__25CVSFbsBitmapIYUVConverterRC10CFbsBitmap @ 10 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::SetSourceL(CFbsBitmap const &)
+	SetSourceL__30CVTYUVPlanarFbsBitmapConverterRC5TSizeRC6TDesC8 @ 11 NONAME R3UNUSED ; CVTYUVPlanarFbsBitmapConverter::SetSourceL(TSize const &, TDesC8 const &)
+	SetSourceL__30CVTYUVPlanarFbsBitmapConverterRC6TDesC8 @ 12 NONAME R3UNUSED ; CVTYUVPlanarFbsBitmapConverter::SetSourceL(TDesC8 const &)
+	SetSourceSizeL__30CVTYUVPlanarFbsBitmapConverterRC5TSize @ 13 NONAME R3UNUSED ; CVTYUVPlanarFbsBitmapConverter::SetSourceSizeL(TSize const &)
+	YUVData__C25CVSFbsBitmapIYUVConverter @ 14 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::YUVData(void) const
+	"_._24CVTYUVFbsBitmapConverter" @ 15 NONAME R3UNUSED ; CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter(void)
+	NewL__25CVSFbsBitmapIYUVConverterRC10CFbsBitmap @ 16 NONAME R3UNUSED ; CVSFbsBitmapIYUVConverter::NewL(CFbsBitmap const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bmarm/VTIMAGETRANSFORMSU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,28 @@
+EXPORTS
+	"_._15CVtImageRotator" @ 1 NONAME R3UNUSED ; CVtImageRotator::~CVtImageRotator(void)
+	Image__C12CVtImageIYUV @ 2 NONAME R3UNUSED ; CVtImageIYUV::Image(void) const
+	NewL__12CVtImageIYUVRC5TSize @ 3 NONAME R3UNUSED ; CVtImageIYUV::NewL(TSize const &)
+	NewL__12CVtImageIYUVRC5TSizeR5TPtr8 @ 4 NONAME R3UNUSED ; CVtImageIYUV::NewL(TSize const &, TPtr8 &)
+	NewL__12CVtImageIYUVRC5TSizeRC6TDesC8 @ 5 NONAME R3UNUSED ; CVtImageIYUV::NewL(TSize const &, TDesC8 const &)
+	NewL__14CVtImageBitmapRC5TSize12TDisplayMode @ 6 NONAME R3UNUSED ; CVtImageBitmap::NewL(TSize const &, TDisplayMode)
+	NewL__14CVtImageBitmapi @ 7 NONAME R3UNUSED ; CVtImageBitmap::NewL(int)
+	NewL__14CVtImageScalerR22MVtImageScalerObserverQ214CVtImageScaler8TQualityQ27CActive9TPriority @ 8 NONAME R3UNUSED ; CVtImageScaler::NewL(MVtImageScalerObserver &, CVtImageScaler::TQuality, CActive::TPriority)
+	NewL__15CVtImageRotatorR23MVtImageRotatorObserverQ27CActive9TPriority @ 9 NONAME R3UNUSED ; CVtImageRotator::NewL(MVtImageRotatorObserver &, CActive::TPriority)
+	ResizeL__14CVtImageBitmapRC5TSize @ 10 NONAME R3UNUSED ; CVtImageBitmap::ResizeL(TSize const &)
+	RotateL__15CVtImageRotatorRC8CVtImageR8CVtImageRCQ215CVtImageRotator14TRotationAngle @ 11 NONAME ; CVtImageRotator::RotateL(CVtImage const &, CVtImage &, CVtImageRotator::TRotationAngle const &)
+	ScaleL__14CVtImageScalerRC8CVtImageR8CVtImage @ 12 NONAME R3UNUSED ; CVtImageScaler::ScaleL(CVtImage const &, CVtImage &)
+	SetBitmapL__14CVtImageBitmapi @ 13 NONAME R3UNUSED ; CVtImageBitmap::SetBitmapL(int)
+	SetImageL__12CVtImageIYUVR5TPtr8 @ 14 NONAME R3UNUSED ; CVtImageIYUV::SetImageL(TPtr8 &)
+	SetImageL__12CVtImageIYUVRC6TDesC8 @ 15 NONAME R3UNUSED ; CVtImageIYUV::SetImageL(TDesC8 const &)
+	SetQualityL__14CVtImageScalerQ214CVtImageScaler8TQuality @ 16 NONAME R3UNUSED ; CVtImageScaler::SetQualityL(CVtImageScaler::TQuality)
+	Type__C8CVtImage @ 17 NONAME R3UNUSED ; CVtImage::Type(void) const
+	UVPlaneHeight__C12CVtImageIYUV @ 18 NONAME R3UNUSED ; CVtImageIYUV::UVPlaneHeight(void) const
+	UVPlaneWidth__C12CVtImageIYUV @ 19 NONAME R3UNUSED ; CVtImageIYUV::UVPlaneWidth(void) const
+	U__C12CVtImageIYUV @ 20 NONAME R3UNUSED ; CVtImageIYUV::U(void) const
+	V__C12CVtImageIYUV @ 21 NONAME R3UNUSED ; CVtImageIYUV::V(void) const
+	Y__C12CVtImageIYUV @ 22 NONAME R3UNUSED ; CVtImageIYUV::Y(void) const
+	"_._12CVtImageIYUV" @ 23 NONAME R3UNUSED ; CVtImageIYUV::~CVtImageIYUV(void)
+	"_._14CVtImageBitmap" @ 24 NONAME R3UNUSED ; CVtImageBitmap::~CVtImageBitmap(void)
+	"_._14CVtImageScaler" @ 25 NONAME R3UNUSED ; CVtImageScaler::~CVtImageScaler(void)
+	Bitmap__C14CVtImageBitmap @ 26 NONAME R3UNUSED ; CVtImageBitmap::Bitmap(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bwins/DISPLAYSINKU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	??0TDisplaySinkParams@@QAE@XZ @ 1 NONAME ; TDisplaySinkParams::TDisplaySinkParams(void)
+	?CreateSinkL@@YAPAVMDisplaySink@@AAVTDisplaySinkParams@@ABVTDesC8@@@Z @ 2 NONAME ; class MDisplaySink * CreateSinkL(class TDisplaySinkParams &, class TDesC8 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bwins/VTIMAGECONVERTERU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,18 @@
+EXPORTS
+	??1CVSFbsBitmapIYUVConverter@@UAE@XZ @ 1 NONAME ; public: virtual __thiscall CVSFbsBitmapIYUVConverter::~CVSFbsBitmapIYUVConverter(void)
+	??1CVTYUVFbsBitmapConverter@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter(void)
+	?NewL@CVSFbsBitmapIYUVConverter@@SAPAV1@ABVCFbsBitmap@@@Z @ 3 NONAME ; public: static class CVSFbsBitmapIYUVConverter * __cdecl CVSFbsBitmapIYUVConverter::NewL(class CFbsBitmap const &)
+	?NewL@CVTIYUVFbsBitmapConverter@@SAPAV1@ABVTSize@@ABVCFbsBitmap@@@Z @ 4 NONAME ; public: static class CVTIYUVFbsBitmapConverter * __cdecl CVTIYUVFbsBitmapConverter::NewL(class TSize const &,class CFbsBitmap const &)
+	?NewL@CVTIYUVFbsBitmapConverter@@SAPAV1@ABVTSize@@H@Z @ 5 NONAME ; public: static class CVTIYUVFbsBitmapConverter * __cdecl CVTIYUVFbsBitmapConverter::NewL(class TSize const &,int)
+	?NewL@CVTYV12FbsBitmapConverter@@SAPAV1@ABVTSize@@ABVCFbsBitmap@@@Z @ 6 NONAME ; public: static class CVTYV12FbsBitmapConverter * __cdecl CVTYV12FbsBitmapConverter::NewL(class TSize const &,class CFbsBitmap const &)
+	?NewL@CVTYV12FbsBitmapConverter@@SAPAV1@ABVTSize@@H@Z @ 7 NONAME ; public: static class CVTYV12FbsBitmapConverter * __cdecl CVTYV12FbsBitmapConverter::NewL(class TSize const &,int)
+	?ProcessL@CVSFbsBitmapIYUVConverter@@QAEXXZ @ 8 NONAME ; public: void __thiscall CVSFbsBitmapIYUVConverter::ProcessL(void)
+	?ProcessL@CVTYUVFbsBitmapConverter@@UAEXXZ @ 9 NONAME ; public: virtual void __thiscall CVTYUVFbsBitmapConverter::ProcessL(void)
+	?SetDestinationL@CVTYUVFbsBitmapConverter@@UAEXABVCFbsBitmap@@@Z @ 10 NONAME ; public: virtual void __thiscall CVTYUVFbsBitmapConverter::SetDestinationL(class CFbsBitmap const &)
+	?SetDestinationL@CVTYUVFbsBitmapConverter@@UAEXH@Z @ 11 NONAME ; public: virtual void __thiscall CVTYUVFbsBitmapConverter::SetDestinationL(int)
+	?SetSourceL@CVSFbsBitmapIYUVConverter@@QAEXABVCFbsBitmap@@@Z @ 12 NONAME ; public: void __thiscall CVSFbsBitmapIYUVConverter::SetSourceL(class CFbsBitmap const &)
+	?SetSourceL@CVTYUVPlanarFbsBitmapConverter@@UAEXABVTDesC8@@@Z @ 13 NONAME ; public: virtual void __thiscall CVTYUVPlanarFbsBitmapConverter::SetSourceL(class TDesC8 const &)
+	?SetSourceL@CVTYUVPlanarFbsBitmapConverter@@UAEXABVTSize@@ABVTDesC8@@@Z @ 14 NONAME ; public: virtual void __thiscall CVTYUVPlanarFbsBitmapConverter::SetSourceL(class TSize const &,class TDesC8 const &)
+	?SetSourceSizeL@CVTYUVPlanarFbsBitmapConverter@@UAEXABVTSize@@@Z @ 15 NONAME ; public: virtual void __thiscall CVTYUVPlanarFbsBitmapConverter::SetSourceSizeL(class TSize const &)
+	?YUVData@CVSFbsBitmapIYUVConverter@@QBE?AVTPtrC8@@XZ @ 16 NONAME ; public: class TPtrC8  __thiscall CVSFbsBitmapIYUVConverter::YUVData(void)const 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/bwins/VTIMAGETRANSFORMSU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,31 @@
+EXPORTS
+	??1CVtImageBitmap@@UAE@XZ @ 1 NONAME ; public: virtual __thiscall CVtImageBitmap::~CVtImageBitmap(void)
+	??1CVtImageIYUV@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CVtImageIYUV::~CVtImageIYUV(void)
+	??1CVtImageRotator@@UAE@XZ @ 3 NONAME ; public: virtual __thiscall CVtImageRotator::~CVtImageRotator(void)
+	??1CVtImageScaler@@UAE@XZ @ 4 NONAME ; public: virtual __thiscall CVtImageScaler::~CVtImageScaler(void)
+	?Bitmap@CVtImageBitmap@@QBEAAVCFbsBitmap@@XZ @ 5 NONAME ; public: class CFbsBitmap & __thiscall CVtImageBitmap::Bitmap(void)const 
+	?Image@CVtImageIYUV@@QBE?AVTPtrC8@@XZ @ 6 NONAME ; public: class TPtrC8  __thiscall CVtImageIYUV::Image(void)const 
+	?NewL@CVtImageBitmap@@SAPAV1@ABVTSize@@W4TDisplayMode@@@Z @ 7 NONAME ; public: static class CVtImageBitmap * __cdecl CVtImageBitmap::NewL(class TSize const &,enum TDisplayMode)
+	?NewL@CVtImageBitmap@@SAPAV1@H@Z @ 8 NONAME ; public: static class CVtImageBitmap * __cdecl CVtImageBitmap::NewL(int)
+	?NewL@CVtImageIYUV@@SAPAV1@ABVTSize@@@Z @ 9 NONAME ; public: static class CVtImageIYUV * __cdecl CVtImageIYUV::NewL(class TSize const &)
+	?NewL@CVtImageIYUV@@SAPAV1@ABVTSize@@AAVTPtr8@@@Z @ 10 NONAME ; public: static class CVtImageIYUV * __cdecl CVtImageIYUV::NewL(class TSize const &,class TPtr8 &)
+	?NewL@CVtImageIYUV@@SAPAV1@ABVTSize@@ABVTDesC8@@@Z @ 11 NONAME ; public: static class CVtImageIYUV * __cdecl CVtImageIYUV::NewL(class TSize const &,class TDesC8 const &)
+	?NewL@CVtImageRotator@@SAPAV1@AAVMVtImageRotatorObserver@@W4TPriority@CActive@@@Z @ 12 NONAME ; public: static class CVtImageRotator * __cdecl CVtImageRotator::NewL(class MVtImageRotatorObserver &,enum CActive::TPriority)
+	?NewL@CVtImageScaler@@SAPAV1@AAVMVtImageScalerObserver@@W4TQuality@1@W4TPriority@CActive@@@Z @ 13 NONAME ; public: static class CVtImageScaler * __cdecl CVtImageScaler::NewL(class MVtImageScalerObserver &,enum CVtImageScaler::TQuality,enum CActive::TPriority)
+	?ResizeL@CVtImageBitmap@@QAEXABVTSize@@@Z @ 14 NONAME ; public: void __thiscall CVtImageBitmap::ResizeL(class TSize const &)
+	?RotateL@CVtImageRotator@@QAEXABVCVtImage@@AAV2@ABW4TRotationAngle@1@@Z @ 15 NONAME ; public: void __thiscall CVtImageRotator::RotateL(class CVtImage const &,class CVtImage &,enum CVtImageRotator::TRotationAngle const &)
+	?ScaleL@CVtImageScaler@@QAEXABVCVtImage@@AAV2@@Z @ 16 NONAME ; public: void __thiscall CVtImageScaler::ScaleL(class CVtImage const &,class CVtImage &)
+	?SetBitmapL@CVtImageBitmap@@QAEXH@Z @ 17 NONAME ; public: void __thiscall CVtImageBitmap::SetBitmapL(int)
+	?SetImageL@CVtImageIYUV@@QAEXAAVTPtr8@@@Z @ 18 NONAME ; public: void __thiscall CVtImageIYUV::SetImageL(class TPtr8 &)
+	?SetImageL@CVtImageIYUV@@QAEXABVTDesC8@@@Z @ 19 NONAME ; public: void __thiscall CVtImageIYUV::SetImageL(class TDesC8 const &)
+	?SetQualityL@CVtImageScaler@@QAEXW4TQuality@1@@Z @ 20 NONAME ; public: void __thiscall CVtImageScaler::SetQualityL(enum CVtImageScaler::TQuality)
+	?Type@CVtImage@@QBE?AW4TVtImageType@1@XZ @ 21 NONAME ; public: enum CVtImage::TVtImageType  __thiscall CVtImage::Type(void)const 
+	?U@CVtImageIYUV@@QBEPAEXZ @ 22 NONAME ; public: unsigned char * __thiscall CVtImageIYUV::U(void)const 
+	?UVPlaneHeight@CVtImageIYUV@@QBEHXZ @ 23 NONAME ; public: int __thiscall CVtImageIYUV::UVPlaneHeight(void)const 
+	?UVPlaneWidth@CVtImageIYUV@@QBEHXZ @ 24 NONAME ; public: int __thiscall CVtImageIYUV::UVPlaneWidth(void)const 
+	?V@CVtImageIYUV@@QBEPAEXZ @ 25 NONAME ; public: unsigned char * __thiscall CVtImageIYUV::V(void)const 
+	?Y@CVtImageIYUV@@QBEPAEXZ @ 26 NONAME ; public: unsigned char * __thiscall CVtImageIYUV::Y(void)const 
+	?Scale@CVtImageScaler@@QAEXABVCVtImage@@AAV2@@Z @ 27 NONAME ; void CVtImageScaler::Scale(class CVtImage const &, class CVtImage &)
+	?Rotate@CVtImageRotator@@QAEXABVCVtImage@@AAV2@ABW4TRotationAngle@1@@Z @ 28 NONAME ; void CVtImageRotator::Rotate(class CVtImage const &, class CVtImage &, enum CVtImageRotator::TRotationAngle const &)
+	?ScaleNowL@CVtImageScaler@@QAEXABVCVtImage@@AAV2@@Z @ 29 NONAME ; void CVtImageScaler::ScaleNowL(class CVtImage const &, class CVtImage &)
+
Binary file vtprotocolplugins/DisplaySink/data/displaysink_stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/data/displaysink_stub.pkg	Mon Nov 23 14:47:47 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:  
+;
+
+; Languages
+&EN
+; Header
+#{"displaysink"}, (0x101F8693), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\displaysink.dll"
+""-"z:\sys\bin\VtImageConverter.dll"
+""-"z:\sys\bin\VtImageTransforms.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/group/DisplaySink.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* 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:    Project definition file for Display Sink subsystem
+*
+*/
+
+
+#include        <platform_paths.hrh>
+#include        "../inc/DisplaySinkUids.hrh"
+
+TARGET          displaysink.dll
+TARGETTYPE      dll
+VENDORID        VID_DEFAULT
+
+UID             KSharedLibraryUidDefine KUidDisplaySinkLibrary
+
+SOURCEPATH      ../src
+SOURCE          CDisplaySink.cpp
+
+SOURCE			    CDisplaySinkNGA.cpp
+SOURCE          CDisplaySinkDP.cpp
+SOURCE          vtyuvconverter.cpp
+SOURCE          CDisplaySinkDSA.cpp
+
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+SYSTEMINCLUDE   /epoc32/include/mmf/server
+
+LIBRARY         featmgr.lib
+LIBRARY         euser.lib
+LIBRARY         mmfcontrollerframework.lib
+LIBRARY         fbscli.lib
+LIBRARY         vtimageconverter.lib
+LIBRARY         vtimagetransforms.lib
+
+CAPABILITY      CAP_GENERAL_DLL
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/group/VtImageConverter.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* 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:    Project definition file for Display Sink subsystem
+*
+*/
+
+
+
+#include        <platform_paths.hrh>
+#include        "../inc/VtImageConverterUids.hrh"
+
+TARGET          vtimageconverter.dll
+TARGETTYPE      dll
+VENDORID        VID_DEFAULT
+    
+UID             KSharedLibraryUidDefine KUidVtImageConverterLibrary
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/libc
+
+SOURCEPATH      ../src
+SOURCE          CVtImageConverter.cpp
+
+LIBRARY         gdi.lib
+LIBRARY         euser.lib
+LIBRARY         fbscli.lib
+
+CAPABILITY      CAP_GENERAL_DLL
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/group/VtImageTransforms.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* 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:    Project definition file for Video Source image transforms
+*
+*/
+
+
+#include        <platform_paths.hrh>
+#include        "../inc/CVtImageTransformsUids.hrh"
+
+TARGET          vtimagetransforms.dll
+TARGETTYPE      dll
+VENDORID        VID_DEFAULT
+
+UID             KSharedLibraryUidDefine KUidVtImageTransformsLibrary
+
+SOURCEPATH      ../src
+SOURCE          CVtImage.cpp
+SOURCE			CVtImageBitmap.cpp
+SOURCE			CVtImageIYUV.cpp
+SOURCE			CVtImageScaler.cpp
+SOURCE			CVtImageScalerImpl.cpp
+SOURCE			CVtImageScalerImplNearest.cpp
+SOURCE			CVtImageScalerImplWeightedAverage.cpp
+SOURCE			CVtImageScalerImplBilinear.cpp
+SOURCE			CVtImageRotator.cpp
+SOURCE			CVtImageRotatorImpl.cpp
+SOURCE			CVtImageRotatorImplMirrorFlip.cpp
+SOURCE			CVtImageRotatorImplClockwise.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE	/epoc32/include/mmf/server
+SYSTEMINCLUDE	/epoc32/include/mmf/common
+
+LIBRARY         euser.lib
+LIBRARY		    fbscli.lib
+LIBRARY         bitmaptransforms.lib
+
+CAPABILITY      CAP_GENERAL_DLL
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2004 - 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:    Component definition file for Display Sink subsystem.
+*
+*/
+
+
+           
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CVtImageConverter.h      |../../../inc/cvtimageconverter.h
+../inc/cvtimageconverter.inl    |../../../inc/cvtimageconverter.inl
+../inc/mdisplaysink.h           |../../../inc/mdisplaysink.h
+../inc/TDisplaySinkParamsDSA.h  |../../../inc/tdisplaysinkparamsdsa.h
+../inc/tdisplaysinkparamsdsa.inl  |../../../inc/tdisplaysinkparamsdsa.inl
+../inc/TDisplaySinkParamsDP.h  |../../../inc/tdisplaysinkparamsdp.h
+../inc/TDisplaySinkParamsNGA.h |../../../inc/tdisplaysinkparamsnga.h
+../inc/cvtimage.h        |../../../inc/cvtimage.h
+../inc/CVtImageBitmap.h  |../../../inc/cvtimagebitmap.h
+../inc/CVtImageIYUV.h        |../../../inc/cvtimageiyuv.h
+../inc/CVtImageScaler.h  |../../../inc/cvtimagescaler.h
+../inc/cvtimagerotator.h  |../../../inc/cvtimagerotator.h
+
+// Export SIS stub file
+../data/displaysink_stub.SIS   /epoc32/data/z/system/install/displaysink_stub.sis
+
+// Export IBY file
+../rom/DisplaySink.iby            CORE_APP_LAYER_IBY_EXPORT_PATH(displaysink.iby)
+
+PRJ_MMPFILES
+VtImageTransforms.mmp
+VtImageConverter.mmp
+DisplaySink.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CDisplaySink.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,671 @@
+/*
+* 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:    DisplaySink subsystem.
+*
+*/
+
+
+
+
+#ifndef CDISPLAYSINK_H
+#define CDISPLAYSINK_H
+
+//  INCLUDE FILES
+
+#include <bldvariant.hrh>
+#include <e32base.h>
+#include <mmfutilities.h>
+#include <mmfdatasource.h>
+#include <mmfdatasink.h>
+#include <fbs.h>
+#include <mvtprotocolhandler.h>
+
+#include "mdisplaysink.h"
+
+// CONSTANTS
+
+// QCIF size
+#define QCIF TSize( 176, 144 )
+
+// Number of bitmap sets (big/small) in array
+const TInt KBitmapTableCount = 2;
+
+// FORWARD DECLARATIONS
+
+class CDisplaySink;
+class CVTYUVFbsBitmapConverter;
+class CVtCallback;
+class CVtImageIYUV;
+class CMMFDataBuffer;
+class CVtFrameQueue;
+
+// CLASS DECLARATION
+
+/**
+* CVtFrameQueue
+*
+* Storage class for DisplaySink. Used in situations where EmptyBufferL() is
+* called and there's no available bitmaps (or buffers). This class will
+* hold one buffer until next SetBitmapAvailable() is called. Instance operates
+* in protocol thread's active scheduler.
+*
+*  @lib DisplaySink.lib
+*/
+NONSHARABLE_CLASS( CVtFrameQueue ) : public CActive
+    {
+
+public: // new methods
+    /**
+    * C++ constructor.
+    */
+    CVtFrameQueue();
+
+    /**
+    * Adds this to protocol thread's active scheduler.
+    */
+    TInt ThreadLogon();
+
+    /**
+    * Releases stored buffer, when sink is stopped.
+    */
+    void SinkStoppedL();
+
+    /**
+    * Deques from protocol thread's active scheduler.
+    */
+    void ThreadLogoff();
+
+    /**
+    * Stores buffer & supplier.
+    */
+    void Store( MVTVideoSource& aSupplier, CMMFDataBuffer* aBuffer, TSize aFrameSize, TPtr8& aPtr );
+
+    /**
+    * Returns ETrue if buffer is being stored, EFalse otherwise.
+    */
+    TBool IsStored() const;
+
+    /**
+    * Returns stored buffer.
+    */
+    TVtMMFDataBuffer Buffer();
+
+    /**
+    * Releases stored buffer. Supplier's BufferEmptiedL() is called. Call
+    * is executed in protocol thread's context.
+    */
+    void Release();
+
+private:
+
+    /**
+    * Calls BufferEmptiedL() for supplier. This call always happens in protocol
+    * thread context.
+    * @param aBuffer Pointer reference to a buffer to be released.
+    */
+    void DoReleaseBufferL( CMMFDataBuffer*& aBuffer );
+
+private: // from CActive
+    /**
+    * @see CActive::RunL
+    */
+    void RunL();
+
+    /**
+    * @see CActive::DoCancel
+    */
+    void DoCancel();
+
+private:
+    // Stored supplier
+    MVTVideoSource* iSupplier;
+    // Stored buffer
+    CMMFDataBuffer* iBuffer;
+    
+    TSize iFrameSize;
+    TPtr8* iPtr;
+    // Pre-opened thread object that is used for signalling the delayed
+    // BufferEmptiedL() call
+    RThread iThread;
+    // Buffer to be released on next RunL()
+    CMMFDataBuffer* iReleaseBuffer;
+    };
+
+/**
+* CVtCallback
+*
+*
+*  @lib DisplaySink.lib
+*/
+NONSHARABLE_CLASS( CVtCallback ) : public CActive
+    {
+
+private:
+
+    /**
+    * Callback type. Currently only size changes are supported. If new callback
+    * types are needed, add them here.
+    */
+    enum TCallBackType
+        {
+        EVideoFrameSizeChanged
+        };
+
+public:
+
+    /**
+    * C++ constructor.
+    */
+    CVtCallback( MDisplaySinkObserver& aObserver );
+
+    /**
+    * C++ destructor.
+    */
+    ~CVtCallback();
+
+    /**
+    * Video frame size has been changed. Old and new size are given as
+    * parameter.
+    */
+    void VideoFrameSizeChangedL( const TSize& aFrom, const TSize& aTo );
+
+    /**
+    * Returns callback result.
+    */
+    TInt Result() const;
+
+    /**
+    * Boolean variable that tells wether or not call back has been served.
+    */
+    TBool Completed() const;
+
+private:
+
+    /**
+    * Issues callback. Because callback receiver can be in same or different
+    * thread this is made as own function that checks whether or not other
+    * thread needs to be signalled.
+    */
+    void IssueCallbackL();
+
+private: // from CActive
+
+    /**
+    * See CActive documentation.
+    */
+    void RunL();
+
+    /**
+    * See CActive documentation.
+    */
+    void DoCancel();
+
+    /**
+    * See CActive documentation.
+    */
+    TInt RunError( TInt aError );
+
+private:
+
+    // Owner thread's id
+    TThreadId iOwnThreadId;
+
+    // Pointer to observer
+    MDisplaySinkObserver* iObserver;
+
+    // Callback type
+    TCallBackType iCallBackType;
+
+    // Old size
+    TSize iFrom;
+
+    // New size
+    TSize iTo;
+
+    // Callback result
+    TInt iResult;
+
+    // Has callback been completed?
+    TBool iCompleted;
+    };
+
+
+/**
+*  MVTVideoSink interface implementation
+*
+*  @lib DisplaySink.lib
+*/
+NONSHARABLE_CLASS( CDisplaySink ) : public CBase, public MDisplaySink,
+    public MVTVideoSink
+{
+protected: // inner classes
+
+    // Structure containing bitmap related data
+    class TBitmapEntry
+        {
+    public: // data
+
+        // ETrue if this bitmap entry is free
+        TBool iIsFree;
+        };
+
+private:  // from MDisplaySink
+
+    /**
+    * @see MDisplaySink::Destroy
+    */
+    void Destroy();
+
+    /**
+    * @see MDisplaySink::SetBitmapAvailable
+    */
+    void SetBitmapAvailable( TBitmapNo aBitmapNo );
+
+    /**
+    * @see MDisplaySink::Release
+    */
+    void Release();
+
+    /**
+    * @see MDisplaySink::UpdateSinkParamsL
+    */
+    void UpdateSinkParamsL( const TDisplaySinkParams& aParams, TBool& aUpdated );
+
+    /**
+    * @see MDisplaySink::Pause
+    */
+    void Pause();
+
+    /**
+    * @see MDisplaySink::Resume
+    */
+    void Resume();
+
+    /**
+    * @see MDisplaySink::operator MVTVideoSink&
+    */
+    operator MVTVideoSink&();
+
+    /**
+    * @see MDisplaySink::NextFrame
+    */
+    void NextFrame();
+
+private:  // from MVTVideoSink
+    /**
+    * From MVTVideoOutput. See MVTVideoOutput for description.
+    */
+    virtual void SetFormatL( const TDesC8& aFormat );
+
+    /**
+    * From MVTVideoOutput. See MVTVideoOutput for description.
+    */
+    virtual void SetVideoFrameSizeL( const TSize& aSize );
+
+    /**
+    * From MVTVideoOutput. See MVTVideoOutput for description.
+    */
+    virtual void GetVideoFrameSizeL( TSize& aSize ) const;
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual void EmptyBufferL(
+        TVtMMFDataBuffer aDataBuffer,
+        MVTVideoSource* aSupplier,
+        TMediaId aMediaId );
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual void BufferFilledL( CMMFBuffer* aBuffer );
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual TBool CanCreateSinkBuffer();
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual CMMFBuffer* CreateSinkBufferL(
+        TMediaId aMediaId,
+        TBool &aReference );
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler );
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual void SinkThreadLogoff();
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual TInt SinkPrimeL();
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual TInt SinkPlayL();
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual TInt SinkPauseL();
+
+    /**
+    * From MVTVideoSink. See MVTVideoSink for description.
+    */
+    virtual TInt SinkStopL();
+
+private:
+    const RArray<TDesC8* >& GetMultimediaTypesL() const;
+
+
+protected: // Constructors and destructor
+
+    /**
+    * C++ default constructor.
+    */
+    CDisplaySink();
+
+    /**
+    * Destructor.
+    */
+    ~CDisplaySink();
+
+protected:    // New functions
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    * @param "aParams" Initialization parameters.
+    * @param "aInitData" Initialization parameters. Not used.
+    * @exception Can leave with one of the system wide error codes.
+    */
+    void ConstructL( TDisplaySinkParams& aParams, const TDesC8& aInitData );
+
+    /**
+    * Thread logon that may leave. This will be trapped and possible
+    * error code is returned to the caller of SinkThreadLogon().
+    * @exception Can leave with one of the system wide error codes.
+    */
+    void SinkThreadLogonL();
+
+    /**
+    * Sets limit for displaysink frame rate.
+    */
+    void SetFrameRateLimit(
+        TDisplaySinkParams::TFrameRateLimit aFrameRateLimit );
+
+    /**
+    * Resets frame rate limitter.
+    */
+    void ResetFrameRateLimitter();
+
+    /**
+    * Does frame rate limitter validation and also checks if sink is paused.
+    */
+    TBool IsOkToSendFrame();
+
+    /**
+    * Opens fbs session and sets flag, if open succeeds.
+    */
+    void FbsConnectL();
+
+    /**
+    * Opens VT engine thread.
+    */
+    void ThreadOpenL();
+
+    /**
+    * Closes fbs session (if open succeeded earlier).
+    */
+    void FbsDisconnect();
+
+    /**
+    * Closes VT thread (if open succeeded earlier).
+    */
+    void ThreadClose();
+
+    /**
+    * Cleanup operation for SinkThradLogon.
+    */
+    static void SinkThreadLogonCleanup( TAny* aPtr );
+
+private: // new methods implemented in derived classes
+
+    /**
+    * Called from ConstructL() to allow inherited classes to do their own
+    * construction.
+    */
+    virtual void BaseConstructL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData ) = 0;
+
+    /**
+    * Converts image. Calls DoConvertL() to do the task.
+    * @return KErrNone or one of the system wide error codes.
+    */
+    virtual TBool BaseConvert( const TVtMMFDataBuffer& aBuffer ) = 0;
+
+    /**
+    * Called from SinkThreadLogonL().
+    */
+    virtual void BaseSinkThreadLogonL() = 0;
+
+    /**
+    * Called from SinkThreadLogogg().
+    */
+    virtual void BaseSinkThreadLogoff() = 0;
+
+    /**
+    * Called from UpdateSinkParamsL().
+    */
+    virtual void BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams ) = 0;
+
+    /**
+    * Updates sink params.
+    * @exception May leave with one of the system wide error codes (e.g. in
+    * out of memory situaton).
+    */
+    virtual void BaseDoUpdateParamsL() = 0;
+
+    /**
+    * Called when video frame size is set.
+    * @exception May leave with one of the system wide error codes (e.g. in
+    * out of memory situaton).
+    */
+    virtual void BaseSetVideoFrameSizeL( const TSize& aSize ) = 0;
+
+    /**
+    * Returns ETrue if given frame size matches with expected frame size.
+    * Implemented in derived classes because in some cases (e.g. when rotation
+    * is enabled), size calculation is more complicated.
+    */
+    virtual TBool BaseSizesMatch( const TSize& aSize ) = 0;
+
+    /**
+    * Returns reference to TBitmapEntry.
+    */
+    virtual TBitmapEntry& BitmapEntry( TInt aIndex ) = 0;
+
+    /**
+    * EmptyBuffer handling.
+    */
+    virtual void BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer ) = 0;
+
+    /**
+    * Bitmap availability handling.
+    */
+    virtual void BaseSetBitmapAvailable( TBitmapNo aBitmapNo ) = 0;
+
+    /**
+    * Called when source frame size changes.
+    */
+    virtual void BaseVideoFrameSizeChangedL( const TSize& aNewSize ) = 0;
+
+protected:    // Data
+
+    // Video source that provides buffer filled with video frame(s)
+    MVTVideoSource* iSupplier;
+
+    // Event handler to notify events
+    MAsyncEventHandler* iEventHandler;
+
+    // Buffer containing video frame(s) and to be converted
+    CMMFBuffer* iBuffer;
+
+    // Sink data type code as fourCC code
+    TFourCC iSinkFourCC;
+
+    // Sink state enumeration
+    enum TState
+        {
+        EStopped,
+        EPrimed,
+        EPlaying
+        };
+
+    // Sink state
+    TState iState;
+
+    // Array of MIME types supported by sink
+    RArray<TDesC8* > iVTMimeTypes;
+
+    // Video frame size
+    TSize iFrameSize;
+
+    // Thread ID of thread to notify after video frame is converted
+    TThreadId iThreadId;
+
+    // Handle to thread to notify after video frame is converted
+    RThread iThread;
+
+    // Pointer to iStatus member of the Active Object to notify
+    // after video frame is converted
+    TRequestStatus* iRequestStatusPtr;
+
+    // Critical section to serialize access to iBitmapTable
+    RCriticalSection iBitmapCS;
+
+    // Semaphore to force thread context switch after video frame
+    // is converted
+    RSemaphore iSync;
+
+    
+    // This is set to ETrue when new params are set, this pointer
+    // is also used as flag when parameter update is requested.
+    TBool* iParamsUpdated;
+
+    // This flag variable will be set to ETrue when sink parameters
+    // need to be updated (e.g. when frame size changes from QCIF
+    // to Sub QCIF or vice versa)
+    TBool iWaitingForUpdate;
+
+    // Contains expected frame size (this is taken from given bitmaps).
+    TSize iExpectedFrameSize;
+
+    // Active object that will call callbacks to VT engine in VT
+    // engine's thread context.
+    CVtCallback* iVTSignaller;
+
+    // If ETrue, sink does not convert data that is given to it
+    TBool iReleased;
+
+    // Output MIME type holder
+    TBuf8< 128 > iYuv420PlanarDesc;
+
+    // Frame rate interval in milliseconds
+    TInt iFrameRateInterval;
+
+    // Time since last frame was sent (in milliseconds)
+    TInt iMilliSecondsSinceLastFrame;
+
+    // Time stamp for last frame sent
+    TTime iLastFrameTime;
+
+    // When paused remote video will no be sent to VT engine
+    TBool iPaused;
+
+    // DisplaySink params flags
+    TUint32 iDSFlags;
+
+    // Is set to ETrue when SinkThreadLogon() is called.
+    TUint32 iInitFlags;
+
+    // Initialization flags
+    enum TInitFlags
+        {
+        // This flag is set, when SinkThreadLogon() is called
+        ESinkThreadLogonCalled = ( 1 << 0 ),
+
+        // This flag is set, when FbsSession has been connected
+        EFbsSessionConnected = ( 1 << 1 ),
+
+        // This flag is set, when handle to Sink Thread has been opened
+        EThreadOpened = ( 1 << 2 )
+        };
+
+    // Frame queue for holding for holding frames until target conversion
+    // buffer is ready.
+    CVtFrameQueue* iVideoFrameQueue;
+
+    // friend classes
+
+
+    };
+
+/**
+*  Safe cleanup for synchronization primitives.
+*
+*  @lib DisplaySink.lib
+*/
+template < class T >
+class CleanupSignal
+	{
+public:
+    static void PushL( T& aPtr );
+private:
+    static void Signal( TAny *aPtr );
+	};
+
+template < class T >
+void CleanupSignal< T >::PushL( T& aRef )
+	{
+    CleanupStack::PushL( TCleanupItem( &Signal, &aRef ) );
+    }
+
+template < class T >
+void CleanupSignal< T >::Signal( TAny *aPtr )
+	{
+    static_cast< T* >( aPtr )->Signal();
+    }
+
+/**
+* Pushes signalable object into cleanup stack.
+*/
+template < class T >
+void CleanupSignalPushL( T& aRef )
+    {
+    CleanupSignal< T >::PushL( aRef );
+    }
+
+#endif      // CDISPLAYSINK_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CDisplaySinkDP.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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:    DisplaySink subsystem.
+*
+*/
+
+
+
+
+#ifndef CDISPLAYSINKDP_H
+#define CDISPLAYSINKDP_H
+
+//  INCLUDE FILES
+
+#include "CDisplaySink.h"
+#include "TDisplaySinkParamsDP.h"
+
+// CLASS DECLARATION
+
+/**
+*  Displaysink implementation for Display Posting.
+*
+*  @lib displaysink.lib
+*  @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( CDisplaySinkDP ) : public CDisplaySink
+    {
+public: // static constructor
+
+    /**
+    * Static constructor that may leave.
+    */
+    static CDisplaySinkDP* NewL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData );
+
+private: // constructors and destructor
+
+    /**
+    * C++ default constructor.
+    */
+    CDisplaySinkDP();
+
+    /**
+    * destructor
+    */
+    ~CDisplaySinkDP();
+
+private: // from CDisplaySink
+
+    /**
+    * @see CDisplaySink::BaseConstructL
+    */
+    void BaseConstructL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData );
+
+    /**
+    * @see CDisplaySink::BaseConvert
+    */
+    TBool BaseConvert( const TVtMMFDataBuffer& aBuffer );
+
+    /**
+    * @see CDisplaySink::BaseSinkThreadLogonL
+    */
+    void BaseSinkThreadLogonL();
+
+    /**
+    * @see CDisplaySink::BaseSinkThreadLogoff
+    */
+    void BaseSinkThreadLogoff();
+
+    /**
+    * @see CDisplaySink::BaseUpdateSinkParamsL
+    */
+    void BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams );
+
+    /**
+    * @see CDisplaySink::BaseDoUpdateParamsL
+    */
+    void BaseDoUpdateParamsL();
+
+    /**
+    * @see CDisplaySink::BaseDoUpdateParamsL
+    */
+    void BaseSetVideoFrameSizeL( const TSize& aSize );
+
+    /**
+    * @see CDisplaySink::BaseSizesMatch
+    */
+    TBool BaseSizesMatch( const TSize& aSize );
+
+    /**
+    * @see CDisplaySink::BitmapEntry
+    */
+    TBitmapEntry& BitmapEntry( TInt aIndex );
+
+    /**
+    * @see CDisplaySink::BaseEmptyBufferL
+    */
+    void BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer );
+
+    /**
+    * @see CDisplaySink::BaseSetBitmapAvailable
+    */
+    void BaseSetBitmapAvailable( TBitmapNo aBitmapNo );
+
+    /**
+    * @see CDisplaySink::BaseVideoFrameSizeChangedL
+    */
+    void BaseVideoFrameSizeChangedL( const TSize& aNewSize );
+
+private: // MDisplaySink
+
+    /**
+    * @see MDisplaySink::NextFrame
+    */
+    void NextFrame();
+
+private: // new methods
+
+    /**
+    * Updates expected frame size.
+    * @exception May leave with KErrNotSupported, if bitmap sizes do not match.
+    */
+    void UpdateExpectedFrameSizeL();
+
+private: // new classes
+
+    // Class posting buffer related data
+    class TBitmapEntryDP : public TBitmapEntry
+        {
+    public: // data
+
+        // Pointer to Posting Buffer pointer
+        CPostingSurface::TPostingBuff** iBuffer;
+        };
+
+private: // data
+
+    // Array of bitmap related structures
+    TBitmapEntryDP iBitmapTable[ KBitmapTableCount ];
+
+    // Store for saving new parameters in UpdateSinkParamsL() call
+    TDisplaySinkParamsDP iNewParams;
+    };
+
+#endif // CDISPLAYSINKDP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CDisplaySinkDSA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* 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:    DisplaySink subsystem.
+*
+*/
+
+
+
+
+#ifndef CDISPLAYSINKDSA_H
+#define CDISPLAYSINKDSA_H
+
+//  INCLUDE FILES
+
+#include "CDisplaySink.h"
+#include "TDisplaySinkParamsDSA.h"
+
+// CLASS DECLARATION
+
+/**
+*  Displaysink implementation for Direct Screen access.
+*
+*  @lib displaysink.lib
+*  @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( CDisplaySinkDSA ) : public CDisplaySink,
+    public MVtImageRotatorObserver
+    {
+public: // static constructor
+
+    /**
+    * Static constructor that may leave.
+    */
+    static CDisplaySinkDSA* NewL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData );
+
+private: // constructors and destructor
+
+    /**
+    * C++ default constructor.
+    */
+    CDisplaySinkDSA();
+
+    /**
+    * destructor
+    */
+    ~CDisplaySinkDSA();
+
+private: // from CDisplaySink
+
+    /**
+    * @see CDisplaySink::BaseConstructL
+    */
+    void BaseConstructL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData );
+
+    /**
+    * @see CDisplaySink::BaseConvert
+    */
+    TBool BaseConvert( const TVtMMFDataBuffer& aBuffer );
+
+    /**
+    * @see CDisplaySink::BaseSinkThreadLogonL
+    */
+    void BaseSinkThreadLogonL();
+
+    /**
+    * @see CDisplaySink::BaseSinkThreadLogoff
+    */
+    void BaseSinkThreadLogoff();
+
+    /**
+    * @see CDisplaySink::BaseUpdateSinkParamsL
+    */
+    void BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams );
+
+    /**
+    * @see CDisplaySink::BaseDoUpdateParamsL
+    */
+    void BaseDoUpdateParamsL();
+
+    /**
+    * @see CDisplaySink::BaseDoUpdateParamsL
+    */
+    void BaseSetVideoFrameSizeL( const TSize& aSize );
+
+    /**
+    * @see CDisplaySink::BaseSizesMatch
+    */
+    TBool BaseSizesMatch( const TSize& aSize );
+
+    /**
+    * @see CDisplaySink::BitmapEntry
+    */
+    TBitmapEntry& BitmapEntry( TInt aIndex );
+
+    /**
+    * @see CDisplaySink::BaseEmptyBufferL
+    */
+    void BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer );
+
+    /**
+    * @see CDisplaySink::BaseSetBitmapAvailable
+    */
+    void BaseSetBitmapAvailable( TBitmapNo aBitmapNo );
+
+    /**
+    * @see CDisplaySink::BaseVideoFrameSizeChangedL
+    */
+    void BaseVideoFrameSizeChangedL( const TSize& aNewSize );
+
+private: // from MVtImageRotatorObserver
+
+    /**
+    * @see MVtImageRotatorObserver::RotationFinished
+    */
+    void RotationFinished( TInt aError );
+
+private: // new methods
+
+    /**
+    * Updates expected frame size.
+    * @exception May leave with KErrNotSupported, if bitmap sizes do not match.
+    */
+    void UpdateExpectedFrameSizeL();
+
+    /**
+    * Converts image. Calls DoConvertL() to do the task.
+    * @param "aBitmapNo" CFbsBitmap number to use for converted image.
+    * @param "aConverted" Reference to boolean that will be ETrue if buffer
+    * was converted, EFalse otherwise.
+    * @return KErrNone or one of the system wide error codes.
+    */
+    void ConvertL( const TPtrC8& aBuffer, TBool& aConverted );
+
+    /**
+    * Convert YUV420Planar image to a CFbsBitmap.
+    * @param "aBitmapNo" CFbsBitmap number to use for converted image.
+    * @return KErrNone or one of the system wide error codes.
+    */
+    void DoConvertL( const TPtrC8& aBuffer, TBitmapNo aBitmapNo );
+
+private: // new classes
+
+    // Class containing bitmap related data
+    class TBitmapEntryDSA : public TBitmapEntry
+        {
+    public: // data
+
+        // Handle to target bitmap
+        TInt iHandle; // QCIF
+        };
+
+private: // data
+
+    // Array of bitmap related structures
+    TBitmapEntryDSA iBitmapTable[ KBitmapTableCount ];
+
+    // Converter for bitmap 1, created into Protocol thread's heap
+    CVTYUVFbsBitmapConverter* iYUVBitmapConverter1; // owned
+
+    // Converter for bitmap 2, created into Protocol thread's heap
+    CVTYUVFbsBitmapConverter* iYUVBitmapConverter2; // owned
+
+    // Converter for bitmap, created into VT thread's heap
+    CVTYUVFbsBitmapConverter* iYUVBitmapConverterVT;
+
+    // Pointer to image rotator instance.
+    CVtImageRotator* iRotator; // owned
+
+    // Source YUV image for image transforms
+    CVtImageIYUV* iSourceImg;
+
+    // Target YUV image for image transforms
+    CVtImageIYUV* iTargetImg;
+
+    // Rotation angle
+    CVtImageRotator::TRotationAngle iRotationAngle;
+
+    // Store for saving new parameters in UpdateSinkParamsL() call
+    TDisplaySinkParamsDSA iNewParams;
+    };
+
+#endif // CDISPLAYSINKDSA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CDisplaySinkNGA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,157 @@
+/*
+* 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:  Displaysink implementation for NGA.
+*
+*/
+
+#ifndef CDISPLAYSINKNGA_H
+#define CDISPLAYSINKNGA_H
+
+//  INCLUDE FILES
+#include "CDisplaySink.h"
+#include "TDisplaySinkParamsNGA.h"
+
+// CLASS DECLARATION
+
+/**
+*  Displaysink implementation for NGA.
+*
+*  @lib displaysink.lib
+*  @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( CDisplaySinkNGA ) : public CDisplaySink
+    {
+public: // static constructor
+
+    /**
+    * Static constructor that may leave.
+    */
+    static CDisplaySinkNGA* NewL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData );
+
+private: // constructors and destructor
+
+    /**
+    * C++ default constructor.
+    */
+    CDisplaySinkNGA();
+
+    /**
+    * destructor
+    */
+    ~CDisplaySinkNGA();
+
+private: // from CDisplaySink
+
+
+    /**
+    * @see CDisplaySink::BaseConstructL
+    */
+    void BaseConstructL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData );
+
+    /**
+    * @see CDisplaySink::BaseConvert
+    */
+    TBool BaseConvert( const TVtMMFDataBuffer& aBuffer );
+
+    /**
+    * @see CDisplaySink::BaseSinkThreadLogonL
+    */
+    void BaseSinkThreadLogonL();
+
+    /**
+    * @see CDisplaySink::BaseSinkThreadLogoff
+    */
+    void BaseSinkThreadLogoff();
+
+    /**
+    * @see CDisplaySink::BaseUpdateSinkParamsL
+    */
+    void BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams );
+
+    /**
+    * @see CDisplaySink::BaseDoUpdateParamsL
+    */
+    void BaseDoUpdateParamsL();
+
+    /**
+    * @see CDisplaySink::BaseDoUpdateParamsL
+    */
+    void BaseSetVideoFrameSizeL( const TSize& aSize );
+
+    /**
+    * @see CDisplaySink::BaseSizesMatch
+    */
+    TBool BaseSizesMatch( const TSize& aSize );
+
+    /**
+    * @see CDisplaySink::BitmapEntry
+    */
+    TBitmapEntry& BitmapEntry( TInt aIndex );
+
+    /**
+    * @see CDisplaySink::BaseEmptyBufferL
+    */
+    void BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer );
+
+    /**
+    * @see CDisplaySink::BaseSetBitmapAvailable
+    */
+    void BaseSetBitmapAvailable( TBitmapNo aBitmapNo );
+
+    /**
+    * @see CDisplaySink::BaseVideoFrameSizeChangedL
+    */
+    void BaseVideoFrameSizeChangedL( const TSize& aNewSize );
+
+private: // MDisplaySink
+
+    /**
+    * @see MDisplaySink::NextFrame
+    */
+    void NextFrame();
+
+private: // new methods
+
+    /**
+    * Updates expected frame size.
+    * @exception May leave with KErrNotSupported, if bitmap sizes do not match.
+    */
+    void UpdateExpectedFrameSizeL();
+
+private: // new classes
+
+    // Class submit buffer related data
+    class TBitmapEntryNGA : public TBitmapEntry
+        {
+    public: // data
+
+        // Pointer to Surface Buffer pointer
+        //TVideoFrameBuffer** iBuffer;
+        TUint8**  iBuffer;
+        };
+
+private: // data
+
+    // Array of bitmap related structures
+    TBitmapEntryNGA iBitmapTable[ KBitmapTableCount ];
+
+    // Store for saving new parameters in UpdateSinkParamsL() call
+    TDisplaySinkParamsNGA iNewParams;
+    };
+
+#endif // CDISPLAYSINKNGA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageBitmap.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,162 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGEBITMAP_H
+#define CVTIMAGEBITMAP_H
+
+// INCLUDE FILES
+
+#include "cvtimage.h"
+
+// FORWARD DECLARATIONS
+
+class CFbsBitmap;
+
+// CLASS DECLARATIONS
+
+/**
+*  CFbsBitmap image implementation.
+*
+*  @lib videosource.lib
+*/
+class CVtImageBitmap : public CVtImage
+    {
+    public:
+        
+        /**
+        * Creates new instance of CVtImageBitmap.
+        * @param "aBitmapHandle" Handle of bitmap to "bind" this instance to.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVtImageBitmap* NewL( TInt aBitmapHandle );
+
+        /**
+        * Creates new instance of CVtImageBitmap.
+        * @param "aSize" Size of the image in pixels.
+        * @param "aDisplayMode" Display mode of the image.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVtImageBitmap* NewL( 
+            const TSize& aSize, 
+            TDisplayMode aDisplayMode );
+
+        /**
+        * C++ destructor.
+        */
+        IMPORT_C ~CVtImageBitmap();
+
+        /**
+        * Resizes the image to new dimension.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @param "aSize" New size of the image in pixels.
+        */
+        IMPORT_C void ResizeL( const TSize& aSize );
+
+        /**
+        * Sets new bitmap this image references to.
+        * @param "aBitmapHandle" Handle of the bitmap this image will be
+        * referencing to.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        IMPORT_C void SetBitmapL( TInt aBitmapHandle );
+
+        /**
+        * Returns constant reference to CFbsBitmap owned by this instance. 
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return Constant reference to CFbsBitmap.
+        */
+        IMPORT_C CFbsBitmap& Bitmap() const;
+
+    public: // from CVtImage
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TBool NeedHeapLock() const;
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TVtDisplayMode DisplayMode() const;
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TSize Size() const;
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TInt BytesPerRow() const;
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TUint32* DataAddress() const;
+        
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TUint32* LineAddress( TInt aLine ) const;
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CVtImageBitmap();
+
+        /**
+        * Second phase constructor.
+        * @param "aSize" Size of the image in pixels.
+        * @param "aDisplayMode" Display mode of the image.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        void ConstructL( const TSize& aSize, TDisplayMode aDisplayMode );
+
+        /**
+        * Second phase constructor.
+        * @param "aBitmapHandle" Handle of bitmap to "bind" this instance to.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        void ConstructL( TInt aBitmapHandle );
+
+    private:
+
+        // CFbsImage this image instance references to
+        CFbsBitmap* iBitmap; // owned
+    };
+
+
+#endif // CVTIMAGEBITMAP_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageConverter.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,638 @@
+/*
+* 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:    Image conversion library for VideoTelephony.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGECONVERTER_H
+#define CVTIMAGECONVERTER_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <gdi.h>
+
+// CLASS FORWARDS
+
+class CFbsBitmap;
+class CVTYUVFbsBitmapConverter;
+class CVSFbsBitmapIYUVConverter;
+
+// DATA TYPES
+
+typedef TRgb ( *TVSColorReadFunc ) ( TAny*& );
+
+// CLASS DECLARATIONS
+
+/**
+*  Base class for all YUV to CFbsBitmap converters.
+*
+*  @lib VTImageConverter.lib
+*/
+class CVTYUVFbsBitmapConverter : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ destructor.
+        */
+        IMPORT_C ~CVTYUVFbsBitmapConverter();
+
+    public: // New functions
+
+        /**
+        * Starts image conversion from YUV to CFbsBitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        IMPORT_C virtual void ProcessL();
+
+        /**
+        * Sets size of the source YUV image in pixels. This must be implemented
+        * in derived classes.
+        * @param "aSize" Size of source YUV image in pixels.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void SetSourceSizeL( const TSize& aSize ) = 0;
+
+        /**
+        * Sets source YUV image data. This method must be implemented in derived
+        * classes.
+        * @param "aSourceData" 8-bit descriptor containing the YUV data. As
+        * data is referenced and not copied, given reference must be still
+        * valid when ProcessL() is called.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void SetSourceL( const TDesC8& aSourceData ) = 0;
+
+        /**
+        * Sets size of the source YUV image in pixels and image data.
+        * This method must be implemented in derived classes.
+        * @param "aSize" Size of source YUV image in pixels.
+        * @param "aSourceData" 8-bit descriptor containing the YUV data.
+        * As data is referenced and not copied, given reference must be still
+        * valid when ProcessL() is called.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void SetSourceL(
+            const TSize& aSize,
+            const TDesC8& aSourceData ) = 0;
+
+        /**
+        * Sets destination bitmap into which conversion will be made.
+        * @param "aDestinationBitmap" Reference to destination bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        IMPORT_C virtual void SetDestinationL(
+            const CFbsBitmap& aDestinationBitmap );
+
+        /**
+        * Sets destination bitmap into which conversion will be made.
+        * Bitmap is given as handle to existing bitmap.
+        * @param "aHandle" Handle to existing bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        IMPORT_C virtual void SetDestinationL( TInt aHandle );
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+        /**
+        * Updates iY, iU and iV member variables. Must be implemented in
+        * derived classes.
+        * @param "aSourceData" 8-bit descriptor to source YUV data.
+        */
+        virtual void SetYUVPtrs( const TDesC8& aSourceData ) = 0;
+
+        /**
+        * Second phase constructor.
+        * @param "aBitmapHandle" Handle to destination bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void ConstructL( TInt aBitmapHandle );
+
+        /**
+        * Second phase constructor that will be called when destination is
+        * changed.
+        * @param "aBitmapHandle" Handle to destination bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void ReConstructL( TInt aBitmapHandle );
+
+        /**
+        * Updates internal variables.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void SizeUpdateL();
+
+        /**
+        * C++ constructor.
+        * @param "aSourceSize" Source size in pixels.
+        */
+        CVTYUVFbsBitmapConverter( const TSize& aSourceSize );
+
+        /**
+        * Returns source size in pixels.
+        * @return Source size in pixels, as constant reference.
+        */
+        inline const TSize& SourceSize() const;
+
+        /**
+        * Returns source size in pixels.
+        * @return Source size in pixels, as reference.
+        */
+        inline TSize& SourceSize();
+
+        /**
+        * Returns destination size in pixels.
+        * @return Destination size in pixels, as constant reference.
+        */
+        inline const TSize& DestinationSize() const;
+
+        /**
+        * Returns destination size in pixels.
+        * @return Destination size in pixels, as reference.
+        */
+        inline TSize& DestinationSize();
+
+        /**
+        * Main process loop for Color4K mode. This must be implemented in
+        * derived classes.
+        * @param "aWriteFunction" Pointer to function that writes one pixel to
+        * destination.
+        */
+        virtual void DoProcess4K() = 0;
+
+        /**
+        * Main process loop for Color64K mode. This must be implemented in
+        * derived classes.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        virtual void DoProcess64K() = 0;
+
+        /**
+        * Main process loop for Color16M mode. This must be implemented in
+        * derived classes.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        virtual void DoProcess16M() = 0;
+
+        /**
+        * Main process loop for Color16MU mode. This must be implemented in
+        * derived classes.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        virtual void DoProcess16MU16MA() = 0;
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        CVTYUVFbsBitmapConverter();
+
+    private:    // Functions from base classes
+
+    public: // Data
+
+    protected:  // Data
+
+        // Table of coefficients for EColor4K
+        static const TUint8 COFF_TBL_4K[ 80 ];
+
+        // Table of coefficients for EColor64K
+        static const TUint8 COFF_TBL_64K[ 220 ];
+
+        // Table of coefficients for EColor16M
+        static const TUint8 COFF_TBL_16M[ 528 ];
+
+        // Source size in pixels.
+        TSize iSourceSize;
+
+        // Target size in pixels.
+        TSize iDestinationSize;
+
+        // Pointer to destination bitmap.
+        CFbsBitmap* iDestination; // owned, duplicate
+
+        // Pointer descriptor that points to Y data of the YUV image.
+        const TUint8* iY;
+
+        // Pointer descriptor that points to Cr (U) data of the YUV image.
+        const TUint8* iU;
+
+        // Pointer descriptor that points to Cb (V) data of the YUV image.
+        const TUint8* iV;
+
+        // Horizontal skip real value. After every pixel this valus is added
+        // to X index in conversion loop.
+        TReal32 iVSkipReal;
+
+        // Vertical skip real value. After every pixel this valus is added
+        // to Y index in conversion loop.
+        TReal32 iHSkipReal;
+
+    private:    // Data
+    };
+
+/**
+*  Base class for YUV 4:2:0 planar image to CFbsBitmap converters.
+*
+*  @lib VTImageConverter.lib
+*/
+class CVTYUVPlanarFbsBitmapConverter : public CVTYUVFbsBitmapConverter
+    {
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * Sets size of the source YUV image in pixels.
+        * @param "aSize" Size of source YUV image in pixels.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        IMPORT_C void SetSourceSizeL( const TSize& aSize );
+
+        /**
+        * Sets source YUV image data.
+        * @param "aSourceData" 8-bit descriptor containing the YUV data. As
+        * data is referenced and
+        * not copied, given reference must be still valid when ProcessL() is
+        * called.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        IMPORT_C void SetSourceL( const TDesC8& aSourceData );
+
+        /**
+        * Sets size of the source YUV image in pixels and image data. This
+        * method must be
+        * implemented in derived classes.
+        * @param "aSize" Size of source YUV image in pixels.
+        * @param "aSourceData" 8-bit descriptor containing the YUV data. As
+        * data is referenced and
+        * not copied, given reference must be still valid when ProcessL() is
+        * called.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        IMPORT_C void SetSourceL(
+            const TSize& aSize,
+            const TDesC8& aSourceData );
+
+    protected:  // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        * @param "aSourceSize" Source size in pixels.
+        */
+        CVTYUVPlanarFbsBitmapConverter( const TSize& aSourceSize );
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+        /**
+        * Main process loop for Color4K mode.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        void DoProcess4K();
+
+        /**
+        * Main process loop for Color4K mode when scaling is not required.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        void DoProcess4KNoScale();
+
+        /**
+        * Main process loop for Color64K mode.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        void DoProcess64K();
+
+        /**
+        * Main process loop for Color64K mode when scaling is not required.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        void DoProcess64KNoScale();
+
+        /**
+        * Main process loop for Color16M mode.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        void DoProcess16M();
+
+        /**
+        * Main process loop for Color16M mode when scaling is not required.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        void DoProcess16MNoScale();
+
+        /**
+        * Main process loop for Color16MU and Color16MA modes.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        void DoProcess16MU16MA();
+
+        /**
+        * Main process loop for Color16MU and Color16MA modes when scaling is
+        * not required.
+        * @param "aWriteFunction" Pointer to function that writes one pixel
+        * to destination.
+        */
+        void DoProcess16MU16MANoScale();
+
+    private:    // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        CVTYUVPlanarFbsBitmapConverter();
+
+    private:    // Functions from base classes
+    };
+
+/**
+*  FourCC IYUV image to CFbsBitmap converter (see IYUV description below).
+*
+*  All Y samples are found first in memory as an array of unsigned char
+*  (possibly with a larger stride for memory alignment), followed immediately
+*  by all Cr (U) samples (with half the stride of the Y lines, and half the
+*  number of lines), then followed immediately by all Cb (V) samples in a
+*  similar fashion.
+*
+*  @lib VTImageConverter.lib
+*/
+class CVTIYUVFbsBitmapConverter : public CVTYUVPlanarFbsBitmapConverter
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Static factory function to create instance of this class.
+        * @param "aSourceSize" Size of source image in pixels.
+        * @param "aDestination" Reference to destination bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVTIYUVFbsBitmapConverter* NewL(
+            const TSize& aSourceSize,
+            const CFbsBitmap& aDestination );
+
+        /**
+        * Static factory function to create instance of this class.
+        * @param "aSourceSize" Size of source image in pixels.
+        * @param "aBitmapHandle" Handle to destination bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVTIYUVFbsBitmapConverter* NewL(
+            const TSize& aSourceSize,
+            TInt aBitmapHandle );
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+    private:    // Functions from base classes
+
+        /**
+        * Updates iY, iU and iV member variables.
+        * @param "aSourceData" 8-bit descriptor to source YUV data.
+        */
+        void SetYUVPtrs( const TDesC8& aSourceData );
+
+    private:    // Constructors and destructor
+
+        /**
+        * C++ destructor.
+        * @param "aSourceSize" Source size in pixels.
+        */
+        CVTIYUVFbsBitmapConverter( const TSize& aSourceSize );
+
+        /**
+        * C++ default constructor.
+        */
+        CVTIYUVFbsBitmapConverter();
+    };
+
+/**
+*  FourCC YV12 image to CFbsBitmap converter (see YV12 description below).
+*
+*  All Y samples are found first in memory as an array of unsigned char
+*  (possibly with a larger stride for memory alignment), followed immediately
+*  by all Cb (V) samples (with half the stride of the Y lines, and half the
+*  number of lines), then followed immediately by all Cr (U) samples in a
+*  similar fashion.
+*
+*  @lib VTImageConverter.lib
+*/
+class CVTYV12FbsBitmapConverter : public CVTYUVPlanarFbsBitmapConverter
+    {
+    public: // Constructors and destructor
+        /**
+        * Static factory function to create instance of this class.
+        * @param "aSourceSize" Size of source image in pixels.
+        * @param "aDestination" Reference to destination bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVTYV12FbsBitmapConverter* NewL(
+            const TSize& aSourceSize,
+            const CFbsBitmap& aDestination );
+
+        /**
+        * Static factory function to create instance of this class.
+        * @param "aSourceSize" Size of source image in pixels.
+        * @param "aBitmapHandle" Handle to destination bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVTYV12FbsBitmapConverter* NewL(
+            const TSize& aSourceSize,
+            TInt aBitmapHandle );
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+    private:    // Functions from base classes
+
+        /**
+        * Updates iY, iU and iV member variables.
+        * @param "aSourceData" 8-bit descriptor to source YUV data.
+        */
+        void SetYUVPtrs( const TDesC8& aSourceData );
+
+    private: // Constructors and destructor
+
+        /**
+        * C++ destructor.
+        * @param "aSourceSize" Source size in pixels.
+        */
+        CVTYV12FbsBitmapConverter( const TSize& aSourceSize );
+
+        /**
+        * C++ default constructor.
+        */
+        CVTYV12FbsBitmapConverter();
+    };
+
+/**
+*  CFbsBitmap to FourCC IYUV image converter (see IYUV description below).
+*
+*  All Y samples are found first in memory as an array of unsigned char
+*  (possibly with a larger stride for memory alignment), followed immediately
+*  by all Cr (U) samples (with half the stride of the Y lines, and half the
+*  number of lines), then followed immediately by all Cb (V) samples in a
+*  similar fashion.
+*
+*  @lib VTImageConverter.lib
+*/
+class CVSFbsBitmapIYUVConverter : public CBase
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Static factory function to create instance of this class.
+        * @param "aBitmap" Reference to source bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVSFbsBitmapIYUVConverter* NewL(
+            const CFbsBitmap& aBitmap );
+
+        /**
+        * C++ destructor.
+        */
+        IMPORT_C ~CVSFbsBitmapIYUVConverter();
+
+    public: // New functions
+
+        /**
+        * Sets new source bitmap.
+        * @param "aBitmap" Reference to new source bitmap.
+        */
+        IMPORT_C void SetSourceL( const CFbsBitmap& aBitmap );
+
+        /**
+        * Starts image conversion from CFbsBitmap to YUV.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        IMPORT_C void ProcessL();
+
+        /**
+        * After successfull ProcessL() call converted YUV image data can be
+        * fetched using this method.
+        * @return 8-bit pointer descriptor (constant) to YUV image data.
+        */
+        IMPORT_C TPtrC8 YUVData() const;
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CVSFbsBitmapIYUVConverter();
+
+        /**
+        * Second phase constructor.
+        * @param "aBitmap" Reference to source bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void ConstructL( const CFbsBitmap& aBitmap );
+
+    private:    // New functions
+
+        /**
+        * Second phase constructor that is called when source is changed.
+        * @param "aBitmap" Reference to source bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void ReConstructL( const CFbsBitmap& aBitmap );
+
+        /**
+        * Main process loop.
+        * @param "aReadFunction" Pointer to function that reads one pixel from
+        * source.
+        */
+        void DoProcess( TVSColorReadFunc aReadFunction );
+
+    private:    // Functions from base classes
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Destination size in pixels.
+        TSize iSize;
+
+        // Pointer to source bitmap.
+        CFbsBitmap* iSource; // owned, duplicate
+
+        // Heap descriptor that contains converted YUV data.
+        HBufC8* iYUVData; // owned
+
+        // Pointer descriptor that points to Y data of the YUV image.
+        TPtrC8 iY;
+
+        // Pointer descriptor that points to Cr (U) data of the YUV image.
+        TPtrC8 iU;
+
+        // Pointer descriptor that points to Cb (V) data of the YUV image.
+        TPtrC8 iV;
+    };
+
+// INLINE METHODS
+#include "cvtimageconverter.inl"
+
+
+#endif // CVTIMAGECONVERTER_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageIYUV.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGEIYUV_H
+#define CVTIMAGEIYUV_H
+
+// INCLUDE FILES
+
+#include "cvtimage.h"
+
+// CLASS DECLARATIONS
+
+/**
+*  CFbsBitmap image implementation.
+*
+*  @lib videosource.lib
+*/
+class CVtImageIYUV : public CVtImage
+    {
+    public:
+        
+        /**
+        * Creates new instance of CVtImageIYUV.
+        * @param "aSize" Size of the image in pixels.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVtImageIYUV* NewL( const TSize& aSize );
+
+        /**
+        * Creates new instance of CVtImageIYUV.
+        * @param "aSize" Size of the image in pixels.
+        * @param "aImage" Image data as 8-bit descriptor. Image data is copied into 
+        * this instance.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVtImageIYUV* NewL( const TSize& aSize, const TDesC8& aImage );
+
+        /**
+        * Creates new instance of CVtImageIYUV.
+        * @param "aSize" Size of the image in pixels.
+        * @param "aImage" Image data as 8-bit descriptor. This image will be referenced
+        * and thus changes to this instance will be visible in the caller descriptor
+        * as well. Also descriptor must remain accessible lifetime of the current 
+        * instance or until new non-referenced image is set.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVtImageIYUV* NewL( const TSize& aSize, TPtr8& aImage );
+
+        /**
+        * C++ destructor.
+        */
+        IMPORT_C ~CVtImageIYUV();
+
+        /**
+        * Updates image with given data.
+        * @param "aImage" New image.
+        * @param "aImage" Image data as 8-bit descriptor. Image data is copied into 
+        * this instance.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        IMPORT_C void SetImageL( const TDesC8& aImage );
+
+        /**
+        * Updates image with given data.
+        * @param "aImage" Image data as 8-bit descriptor. This image will be referenced
+        * and thus changes to this instance will be visible in the caller descriptor
+        * as well. Also descriptor must remain accessible lifetime of the current 
+        * instance or until new non-referenced image is set.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        IMPORT_C void SetImageL( TPtr8& aImage );
+
+        /**
+        * Returns image as descriptor.
+        * @return Image as 8-bit descriptor.
+        */
+        IMPORT_C TPtrC8 Image() const;
+
+        /**
+        * Returns pointer to Y plane of this image.
+        * @return Pointer to Y plane of this image.
+        */
+        IMPORT_C TUint8* Y() const;
+        
+        /**
+        * Returns pointer to U plane of this image.
+        * @return Pointer to U plane of this image.
+        */
+        IMPORT_C TUint8* U() const;
+        
+        /**
+        * Returns pointer to V plane of this image.
+        * @return Pointer to V plane of this image.
+        */
+        IMPORT_C TUint8* V() const;
+
+        /**
+        * Returns width of the U and V plane in bytes.
+        * @return Width of the U and V plane in bytes.
+        */
+        IMPORT_C TInt UVPlaneWidth() const;
+ 
+        /**
+        * Returns height of the U and V plane in bytes.
+        * @return Height of the U and V plane in bytes.
+        */
+        IMPORT_C TInt UVPlaneHeight() const;
+
+    public: // from CVtImage
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TBool NeedHeapLock() const;
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TVtDisplayMode DisplayMode() const;
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TSize Size() const;
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TInt BytesPerRow() const;
+
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TUint32* DataAddress() const;
+        
+        /**
+        * From CVtImage. See CVtImage for description.
+        */
+        TUint32* LineAddress( TInt aLine ) const;
+
+
+    private:
+
+        /**
+        * Returns size of the image in bytes (all planes
+        * included).
+        * @return Size of the image in bytes.
+        */
+        TInt ImageSize() const;
+
+        /**
+        * C++ constructor.
+        */
+        CVtImageIYUV( const TSize& aSize );
+
+        /**
+        * Second phase constructor.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        void ConstructL( const TDesC8* aImage );
+
+        /**
+        * Validates given size.
+        * @exception If the size is not correct leaves with KErrArgument.
+        */
+        void ValidateSizeL( const TSize& aSize );
+
+        /**
+        * Checks the size of the given descriptor against required size.
+        * @exception If the size is not correct leaves with KErrArgument.
+        */
+        void CheckDescriptorSizeL( const TDesC8& aImage );
+
+        /**
+        * Sets Y, U and V plane pointers.
+        */
+        void SetYUVPointers();
+    private:
+        
+        // Size of the image
+        TSize iSize;
+        
+        // Image data
+        HBufC8* iImage; // owned
+
+        // Image data ptr descriptor
+        TPtr8 iPtrImage;
+
+        // Ptr to Y plane
+        TUint8* iY;
+
+        // Ptr to U plane
+        TUint8* iU;
+        
+        // Ptr to V plane
+        TUint8* iV;
+    };
+
+
+#endif // CVTIMAGEIYUV_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageRotatorImpl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGEROTATORIMPL_H
+#define CVTIMAGEROTATORIMPL_H
+
+// INCLUDE FILES
+
+#include "cvtimagerotator.h"
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+
+// CLASS DECLARATIONS
+
+/**
+*  Image scaler implementation.
+*
+*  @lib videosource.lib
+*/
+class CVtImageRotatorImpl : public CBase
+    {
+    public:
+
+        /**
+        * Sets scaler params.
+        * @param "aParams" Scaling params, including source and target images.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        void SetSourceTargetL( const CVtImage& aSource, CVtImage& aTarget );
+
+        /**
+        * Method to check whether bitmap heap locking is needed or not during
+        * scaling process.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return ETrue if bitmap heap lock is needed, EFalse otherwise.
+        */
+        TBool NeedHeapLock() const;
+
+        /**
+        * Pure virtual rotation method.
+        * @param "aContinue" When method returns, this parameter will contain
+        * ETrue if new call is needed (i.e. scaling is not yet finished) or
+        * EFalse if scaling is complete.
+        * @return KErrNone or one of the system wide error codes.
+        */
+        virtual TInt Rotate( TBool& aContinue ) = 0;
+
+        /**
+        * Pure virtual method for checking specific rotation angle support.
+        * @param "aAngle" Rotation type that will be needed.
+        * @return ETrue if aAngle is one of the supported rotation types
+        * EFalse otherwise.
+        */
+        virtual TBool SupportsRotationAngle( const CVtImageRotator::TRotationAngle& aAngle ) = 0;
+
+        /**
+        * Sets rotation angle to be used.
+        * @param "aAngle" Rotation type that will be needed.
+        */
+        void SetAngle( const CVtImageRotator::TRotationAngle& aAngle );
+
+    protected:
+
+        /**
+        * C++ constructor.
+        * @param "aAngle" Rotation type that will be needed.
+        */
+        CVtImageRotatorImpl( const CVtImageRotator::TRotationAngle& aAngle );
+
+    private:
+
+        /**
+        * Pure virtual source and target image validation method.
+        * @param "aSource" Constant reference to source image.
+        * @param "aTarget" Constant reference to target image.
+        * @exception If source or target is not valid, this method leaves
+        * with KErrNotSupported.
+        */
+        virtual void ValidateSourceTargetL(
+            const CVtImage& aSource,
+            CVtImage& aTarget ) = 0;
+
+    protected:
+
+        // Source for scaling
+        const CVtImage* iSource; // not owned
+
+        // Target image (will hold scaled source)
+        CVtImage* iTarget; // not owned
+
+        // Selected rotation angle
+        CVtImageRotator::TRotationAngle iAngle;
+    };
+
+#endif // CVTIMAGEROTATORIMPL_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageRotatorImplClockwise.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,105 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGEROTATORIMPLCLOCKWISE_H
+#define CVTIMAGEROTATORIMPLCLOCKWISE_H
+
+// INCLUDE FILES
+
+#include "CVtImageRotatorImpl.h"
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+
+// CLASS DECLARATIONS
+
+/**
+*  Image scaler implementation.
+*
+*  @lib videosource.lib
+*/
+class CVtImageRotatorImplClockwise : public CVtImageRotatorImpl
+    {
+    public:
+        /**
+        * C++ constructor
+        * @param "aAngle" Selected rotation angle.
+        */
+        CVtImageRotatorImplClockwise( const CVtImageRotator::TRotationAngle& aAngle );
+        
+        /**
+        * Rotates the image.
+        * @param "aContinue" When method returns, this parameter will contain
+        * ETrue if new call is needed (i.e. scaling is not yet finished) or
+        * EFalse if scaling is complete.
+        * @return KErrNone or one of the system wide error codes.
+        */
+        TInt Rotate( TBool& aContinue );
+
+        /**
+        * Source and target image validation method.
+        * @param "aSource" Constant reference to source image.
+        * @param "aTarget" Constant reference to target image.
+        * @exception If source or target is not valid, this method leaves
+        * with KErrNotSupported.
+        */
+        void ValidateSourceTargetL( 
+            const CVtImage& aSource, 
+            CVtImage& aTarget );
+
+        /**
+        * Method for checking specific rotation angle support.
+        * @param "aAngle" Rotation type that will be needed.
+        * @return ETrue if aAngle is one of the supported rotation types
+        * EFalse otherwise.
+        */
+        TBool SupportsRotationAngle( const CVtImageRotator::TRotationAngle& aAngle );
+
+    private:
+
+        /**
+        * The rotation implementation.
+        */
+        void DoRotate();
+    
+        /**
+        * The rotation implementation for YUV planes.
+        * @param "aSource" Constant pointer to source plane.
+        * @param "aTarget" Pointer to target plane.
+        * @param "aWidth" Width of the plane in pixels.
+        * @param "aHeight" Height of the plane in pixels.
+        * @param "aBytesPerRow" Bytes per row in plane.
+        */
+        void RotatePlane( 
+            const TUint8* aSource, 
+            TUint8* aTarget, 
+            TInt aSourceWidth, 
+            TInt aSourceHeight, 
+            TInt aSourceBytesPerRow,
+            TInt aTargetHeight,
+            TInt aTargetBytesPerRow );
+    };
+
+#endif // CVTIMAGEROTATORIMPLCLOCKWISE_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageRotatorImplMirrorFlip.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,145 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGEROTATORIMPLMIRRORFLIP_H
+#define CVTIMAGEROTATORIMPLMIRRORFLIP_H
+
+// INCLUDE FILES
+
+#include "CVtImageRotatorImpl.h"
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+class CVtImageIYUV;
+
+// CLASS DECLARATIONS
+
+/**
+*  Image scaler implementation.
+*
+*  @lib videosource.lib
+*/
+class CVtImageRotatorImplMirrorFlip : public CVtImageRotatorImpl
+    {
+    public:
+        /**
+        * C++ constructor
+        * @param "aAngle" Selected rotation angle.
+        */
+        CVtImageRotatorImplMirrorFlip( const CVtImageRotator::TRotationAngle& aAngle );
+
+        /**
+        * Rotates the image.
+        * @param "aContinue" When method returns, this parameter will contain
+        * ETrue if new call is needed (i.e. scaling is not yet finished) or
+        * EFalse if scaling is complete.
+        * @return KErrNone or one of the system wide error codes.
+        */
+        TInt Rotate( TBool& aContinue );
+
+        /**
+        * Source and target image validation method.
+        * @param "aSource" Constant reference to source image.
+        * @param "aTarget" Constant reference to target image.
+        * @exception If source or target is not valid, this method leaves
+        * with KErrNotSupported.
+        */
+        void ValidateSourceTargetL( 
+            const CVtImage& aSource, 
+            CVtImage& aTarget );
+
+        /**
+        * Method for checking specific rotation angle support.
+        * @param "aAngle" Rotation type that will be needed.
+        * @return ETrue if aAngle is one of the supported rotation types
+        * EFalse otherwise.
+        */
+        TBool SupportsRotationAngle( const CVtImageRotator::TRotationAngle& aAngle );
+
+    private:
+
+        /**
+        * Mirrors image horizontally from iSource to iTarget.
+        */
+        void Mirror();
+    
+        /**
+        * Mirrors image horizontally from aTarget to aTarget.
+        */
+        void Mirror( CVtImage& aTarget );
+
+        /**
+        * Mirrors IYUV image from iSource to iTarget.
+        */
+        void MirrorIYUV
+            ( 
+            const CVtImageIYUV& aSource, 
+            CVtImageIYUV& aTarget 
+            );
+
+        /**
+        * Mirrors one plane of IYUV image from iSource to iTarget.
+        */
+        void MirrorPlane
+            ( 
+            TUint8* aSource,
+            TUint8* aTarget,
+            TInt aWidth,
+            TInt aHeight,
+            TInt aBytesPerRow
+            );
+
+        /**
+        * Flips image vertically from iSource to iTarget.
+        */
+        void Flip();
+           
+        /**
+        * Flips image vertically from aTarget to aTarget.
+        */
+        void Flip( CVtImage& aTarget );
+
+        /**
+        * Flips IYUV image vertically from iSource to iTarget.
+        */
+        void FlipIYUV
+            ( 
+            const CVtImageIYUV& aSource, 
+            CVtImageIYUV& aTarget 
+            );
+
+        /**
+        * Flips one plane of IYUV.
+        */
+        void FlipPlane
+            ( 
+            TUint8* aSource, 
+            TUint8* aTarget, 
+            TInt aHeight, 
+            TInt aBytesPerRow 
+            );
+    };
+
+#endif // CVTIMAGEROTATORIMPLMIRRORFLIP_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScaler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,247 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGESCALER_H
+#define CVTIMAGESCALER_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+class CVtImageScalerImpl;
+class CVtImage;
+class CFbsBitmap;
+
+// CLASS DECLARATIONS
+
+/**
+*  Image scaler observer interface.
+*
+*  @lib videosource.lib
+*/
+class MVtImageScalerObserver
+    {
+    public:
+        /**
+        * Callback method that is called by CVtImageScaler when scaling has
+        * finished.
+        * @param "aError" KErrNone if the scaling was done successfully, one
+        * of the system wide error codes otherwise.
+        * @return Pointer to newly created instance.
+        */
+        virtual void ScalingFinished( TInt aError ) = 0;
+    };
+
+/**
+*  Image scaler.
+*
+*  @lib videosource.lib
+*/
+class CVtImageScaler : public CActive
+    {
+    public:
+
+        /**
+        * An enumeration within the CVtImageScaler namespace.
+        * It provides a set of panic codes that may happen during
+        * scaling process.
+        */
+        enum TPanics
+            {
+            /**
+            * RotateL() is called while previous rotation process
+            * has not yet been finished.
+            */
+            EBusy = 1
+            };
+
+        /**
+        * An enumeration within the CVtImageScaler namespace.
+        * It provides a set of supported scaling quality settings.
+        */
+        enum TQuality
+            {
+            /**
+            * Nearest neigbour algorithm. Fast but poor image quality
+            * when scale factor exceeds 2x.
+            */
+            ENearest,
+
+            /**
+            * Weighted average algorithm. Slower than Nearest Neighbour
+            * but also better image quality when scaling at factor 2x or
+            * higher.
+            */
+            EWeightedAverage,
+
+            /**
+            * Bilinear scaling algorithm. Slower than Weighted Average
+            * but also better image quality.
+            */
+            EBilinear
+            };
+
+    public:
+
+        /**
+        * Creates new instance of CVtImageScaler.
+        * @param "aObserver" Reference to instance observer.
+        * @param "aQuality" Scaling quality. If this is omitted, then default
+        * value of EWeightedAverage is used.
+        * @param "aPriority" Active object priority.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVtImageScaler* NewL(
+            MVtImageScalerObserver& aObserver,
+            TQuality aQuality = EWeightedAverage,
+            TPriority aPriority = EPriorityStandard );
+
+        /**
+        * C++ destructor.
+        */
+        IMPORT_C ~CVtImageScaler();
+
+        /**
+        * Sets scaling quality.
+        * @param "aQuality" Scaling quality.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        IMPORT_C void SetQualityL( TQuality aQuality );
+
+        /**
+        * Scales image to new size.
+        * @param "aSource" Source image that will be scaled.
+        * @param "aTarget" Target image that will hold the scaled image. New
+        * image's dimensions
+        * will be taken from the size of target image.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        IMPORT_C void ScaleL( const CVtImage& aSource, CVtImage& aTarget );
+
+        /**
+        * Scales image to new size. Possible error during initialization is
+        * returned via MVtImageScalerObserver.
+        * @param "aSource" Source image that will be scaled.
+        * @param "aTarget" Target image that will hold the scaled image. New
+        * image's dimensions will be taken from the size of target image.
+        */
+        IMPORT_C void Scale( const CVtImage& aSource, CVtImage& aTarget );
+
+        /**
+        * Scales image to new size. This scale method is synchronous and
+        * aTarget will contain scaled image of aSource on return. This method
+        * may leave if aSource and/or aTarget are not suitable for scaling.
+        * MVtImageScalerObserver::ScalingFinished is not called when this
+        * method is used.
+        * @param "aSource" Source image that will be scaled.
+        * @param "aTarget" Target image that will hold the scaled image. New
+        * image's dimensions will be taken from the size of target image.
+        */
+        IMPORT_C void ScaleNowL( const CVtImage& aSource, CVtImage& aTarget );
+
+    private: // internal
+
+        /**
+        * C++ default constructor.
+        */
+        CVtImageScaler();
+
+        /**
+        * C++ constructor.
+        * @param "aObserver" Reference to observer.
+        * @param "aPriority" Active object priority.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        CVtImageScaler( MVtImageScalerObserver& aObserver, TPriority aPriority );
+
+        /**
+        * Second phase constructor.
+        * @param "aQuality" Quality of the scaling.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        void ConstructL( TQuality aQuality );
+
+        /**
+        * Sets iStatus to KRequestPending and calls CActive::SetActive().
+        */
+        void Activate();
+
+        /**
+        * Signals this instance AO with given error code.
+        * @param "aError" Signalling error code.
+        */
+        void Signal( TInt aError );
+
+    private: // from CActive
+
+        /**
+        * This is defined in CActive. Check CActive for description.
+        */
+        void RunL();
+
+        /**
+        * This is defined in CActive. Check CActive for description.
+        */
+        void DoCancel();
+
+        /**
+        * Scale method called by the CAsyncCallBack.
+        */
+        static TInt StaticScale( TAny* aPtr );
+
+        /**
+        * Scale method called by the StaticScale.
+        */
+        void DoScale();
+
+    private:
+
+        // Scaling observer
+        MVtImageScalerObserver& iObserver;
+
+        // Active quality implementation
+        CVtImageScalerImpl* iScalerImpl; // owned
+
+        // Bitmap that will be used for locking global bitmap heap
+        CFbsBitmap* iHeapLock; // owned
+
+        // Asynccallback instance
+        CAsyncCallBack* iAsyncCallBack; // owned
+
+        // This is set to ETrue in DoCancel() method, and when CAsyncCallBack
+        // gets executed, iCancelled is checked whether scaling should be done
+        // or not.
+        TBool iCancelled;
+    };
+
+#endif // CVTIMAGESCALER_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerImpl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGESCALERIMPL_H
+#define CVTIMAGESCALERIMPL_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <bitmaptransforms.h>
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+
+// CLASS DECLARATIONS
+
+/**
+*  Image scaler implementation.
+*
+*  @lib videosource.lib
+*/
+class CVtImageScalerImpl : public CActive
+    {
+    protected:
+
+        /**
+         * Constructor.
+         */
+        CVtImageScalerImpl();
+
+    public:
+
+        /**
+         * Destructor.
+         */
+        ~CVtImageScalerImpl();
+
+        /**
+        * Sets scaler params.
+        * @param "aParams" Scaling params, including source and target images.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        void SetSourceTargetL( const CVtImage& aSource, CVtImage& aTarget );
+
+        /**
+        * Method to check whether bitmap heap locking is needed or not during
+        * scaling process.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return ETrue if bitmap heap lock is needed, EFalse otherwise.
+        */
+        TBool NeedHeapLock() const;
+
+        /**
+        * Pure virtual scaling method.
+        * @param "aContinue" When method returns, this parameter will contain
+        * ETrue if new call is needed (i.e. scaling is not yet finished) or
+        * EFalse if scaling is complete.
+        * @return KErrNone or one of the system wide error codes.
+        */
+        virtual TInt Scale( TBool& aContinue ) = 0;
+
+    protected:
+
+        /**
+         * Scales using CBitmapScaler, which is slow but works with any
+         * Symbian color mode.
+         * @param aQuality Scaling quality @see CBitmapScaler::TQualityAlgorithm
+         * @exception In error situation leaves with one of the system wide
+         * error codes.
+         */
+        void ScaleWithBitmapScalerL(
+            const CBitmapScaler::TQualityAlgorithm aQuality );
+
+    private:
+
+        /**
+        * Pure virtual source and target image validation method.
+        * @param "aSource" Constant reference to source image.
+        * @param "aTarget" Constant reference to target image.
+        * @exception If source or target is not valid, this method leaves
+        * with KErrNotSupported.
+        */
+        virtual void ValidateSourceTargetL(
+            const CVtImage& aSource,
+            CVtImage& aTarget ) = 0;
+
+        /**
+        * Method for validating image size.
+        * @param "aSize" Size to be validated.
+        * @param "aMinSize" Minimum allowed size. If this is not given a default
+        * size of TSize( 1, 1 ) is used.
+        * @exception If size is not valid within given parameters, this
+        * method leaves with KErrNotSupported.
+        */
+        void LeaveIfNotValidSizeL(
+            const TSize& aSize,
+            const TSize aMinSize = TSize( 1, 1 ) );
+
+    private: // from CActive
+
+        /**
+         * @see CActive::RunL
+         */
+        void RunL();
+
+        /**
+         * @see CActive::DoCancel
+         */
+        void DoCancel();
+
+    protected:
+
+        // Source for scaling
+        const CVtImage* iSource; // not owned
+
+        // Target image (will hold scaled source)
+        CVtImage* iTarget; // not owned
+
+        // Bitmap scaler instance
+        CBitmapScaler* iScaler;
+
+        // Active scheduler waiter object
+        CActiveSchedulerWait iActiveSchedulerWait;
+
+    };
+
+#endif // CVTIMAGESCALERIMPL_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerImplBilinear.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGESCALERIMPLBILINEAR_H
+#define CVTIMAGESCALERIMPLBILINEAR_H
+
+// INCLUDE FILES
+
+#include "CVtImageScalerImpl.h"
+
+// CLASS DECLARATIONS
+
+/**
+*  Bilinear image scaler implementation.
+*
+*  @lib videosource.lib
+*/
+class CVtImageScalerImplBilinear : public CVtImageScalerImpl
+    {
+    private: // from CVtImageScalerImpl
+
+        /**
+        * From CVtImageScalerImpl. Check CVtImageScalerImpl for description.
+        */
+        TInt Scale( TBool& aContinue );
+
+    private:
+
+        /**
+        * Validate given parameters.
+        */
+        void ValidateSourceTargetL(
+            const CVtImage& aSource,
+            CVtImage& aTarget );
+
+        /**
+        * Initializes internal variables for scaling.
+        */
+        void Initialize();
+
+        /**
+        * Scales images in displaymode EColor4K.
+        */
+        void Scale4K();
+
+        /**
+        * Scales images in displaymode EColor64K.
+        */
+        void Scale64K();
+
+        /**
+        * Scales images in displaymode EColor16M.
+        */
+        void Scale16M();
+
+        /**
+        * Scales images in displaymode EColor16MU.
+        */
+        void Scale16MU();
+
+        /**
+        * Scales images in displaymode EColor16MA.
+        */
+        void Scale16MA();
+
+        /**
+        * Fast scaling when target is double the source size for
+        * 4K and 64K display modes.
+        */
+        void Scale2x4K64K( TUint32 aMask );
+
+        /**
+        * Fast scaling when target is double the source size for
+        * 16M display mode.
+        */
+        void Scale2x16M();
+
+        /**
+        * Fast scaling when target is double the source size for
+        * 16MU and 16MA display modes.
+        */
+        void Scale2x16MU16MA();
+
+    private:
+
+        // Target width ratio to source width
+        TUint32 iU;
+
+        // Target height ratio to source height
+        TUint32 iV;
+    };
+
+#endif // CVTIMAGESCALERIMPLBILINEAR_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerImplNearest.h	Mon Nov 23 14:47:47 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGESCALERIMPLNEAREST_H
+#define CVTIMAGESCALERIMPLNEAREST_H
+
+// INCLUDE FILES
+
+#include "CVtImageScalerImpl.h"
+
+// CLASS DECLARATIONS
+
+/**
+*  Nearest neigbour image scaling implementation.
+*
+*  @lib videosource.lib
+*/
+class CVtImageScalerImplNearest : public CVtImageScalerImpl
+    {
+    private: // from CVtImageScalerImpl
+
+        /**
+        * From CVtImageScalerImpl. Check CVtImageScalerImpl for description.
+        */
+        TInt Scale( TBool& aContinue );
+
+    private:
+
+        /**
+        * Validate given parameters.
+        */
+        void ValidateSourceTargetL(
+            const CVtImage& aSource,
+            CVtImage& aTarget );
+
+        /**
+        * Initializes internal variables for scaling.
+        */
+        void Initialize();
+
+        /**
+        * Scales images in displaymode EColor4K.
+        */
+        void Scale4K(
+            const TUint16* aSrcPtr,
+            TUint32 aSrcPitch,
+            TUint16* aTrgPtr,
+            TUint32 aTrgWidth,
+            TUint32 aTrgHeight,
+            TUint32 aDx,
+            TUint32 aDy );
+
+        /**
+        * Scales images in displaymode EColor64K.
+        */
+        void Scale64K(
+            const TUint16* aSrcPtr,
+            TUint32 aSrcPitch,
+            TUint16* aTrgPtr,
+            TUint32 aTrgWidth,
+            TUint32 aTrgHeight,
+            TUint32 aDx,
+            TUint32 aDy );
+
+        /**
+        * Scales images in displaymode EColor16M.
+        */
+        void Scale16M(
+            const TUint8* aSrcPtr,
+            TUint32 aSrcPitch,
+            TUint8* aTrgPtr,
+            TUint32 aTrgWidth,
+            TUint32 aTrgHeight,
+            TUint32 aTrgPitch,
+            TUint32 aDx,
+            TUint32 aDy );
+
+        /**
+        * Scales images in displaymodes EColor16MU and EColor16MA.
+        */
+        void Scale16MU16MA(
+            const TUint32* aSrcPtr,
+            TUint32 aSrcPitch,
+            TUint32* aTrgPtr,
+            TUint32 aTrgWidth,
+            TUint32 aTrgHeight,
+            TUint32 aDx,
+            TUint32 aDy );
+
+        /**
+        * Fast scaling when target is double the source size for
+        * 4K and 64K display modes.
+        */
+        void Scale2x4K64K();
+
+        /**
+        * Fast scaling when target is double the source size for 16M
+        * display mode.
+        */
+        void Scale2x16M();
+
+        /**
+        * Fast scaling when target is double the source size for 16MU and 16MA
+        * display modes.
+        */
+        void Scale2x16MU16MA();
+
+    private:
+
+        // Target width ratio to source width
+        TUint32 iU;
+
+        // Target height ratio to source height
+        TUint32 iV;
+    };
+
+#endif // CVTIMAGESCALERIMPLNEAREST_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerImplWeightedAverage.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGESCALERIMPLWEIGHTEDAVERAGE_H
+#define CVTIMAGESCALERIMPLWEIGHTEDAVERAGE_H
+
+// INCLUDE FILES
+
+#include "CVtImageScalerImpl.h"
+
+// CLASS DECLARATIONS
+
+/**
+*  Weighted average scaler implementation.
+*
+*  @lib videosource.lib
+*/
+class CVtImageScalerImplWeightedAverage : public CVtImageScalerImpl
+    {
+    private: // from CVtImageScalerImpl
+
+        /**
+        * From CVtImageScalerImpl. Check CVtImageScalerImpl for description.
+        */
+        TInt Scale( TBool& aContinue );
+
+    private: // methods
+
+        /**
+        * Validate given parameters.
+        */
+        void ValidateSourceTargetL(
+            const CVtImage& aSource,
+            CVtImage& aTarget );
+
+        /**
+        * Initializes internal variables for scaling.
+        */
+        void Initialize();
+
+        /**
+        * Scales images in displaymode EColor4K.
+        */
+        void Scale4K();
+
+        /**
+        * Scales images in displaymode EColor64K.
+        */
+        void Scale64K();
+
+        /**
+        * Scales images in displaymode EColor16M.
+        */
+        void Scale16M();
+
+        /**
+        * Scales images in displaymode EColor16MU.
+        */
+        void Scale16MU();
+
+        /**
+        * Scales images in displaymode EColor16MA.
+        */
+        void Scale16MA();
+
+        /**
+        * Fast scaling when target is double the source size for
+        * 4K and 64K display modes.
+        */
+        void Scale2x4K64K( TUint32 aMask );
+
+        /**
+        * Fast scaling when target is double the source size for
+        * 16M display mode.
+        */
+        void Scale2x16M();
+
+        /**
+        * Fast scaling when target is double the source size for
+        * 16MU and 16MA display modes.
+        */
+        void Scale2x16MU16MA();
+
+    private: // data
+
+        // Target width ratio to source width
+        TUint32 iU;
+
+        // Target height ratio to source height
+        TUint32 iV;
+
+    };
+
+#endif // CVTIMAGESCALERIMPLWEIGHTEDAVERAGE_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageScalerMacros.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGESCALERMACROS_H
+#define CVTIMAGESCALERMACROS_H
+
+// MACROS
+
+#define UNPACK_4K_RED( c ) ( 0xf & ( c >> 8 ) )
+#define UNPACK_4K_GREEN( c ) ( 0xf & ( c >> 4 ) )
+#define UNPACK_4K_BLUE( c ) ( 0xf & c )
+#define PACK_4K_BGR( b, g, r ) \
+    TUint16( ( b ) | ( ( ( g ) | ( ( r ) << 4 ) ) << 4 ) )
+
+#define UNPACK_64K_RED( c ) ( c >> 11 )
+#define UNPACK_64K_GREEN( c ) ( 0x3f & ( c >> 5 ) )
+#define UNPACK_64K_BLUE( c ) ( 0x1f & c )
+#define PACK_64K_BGR( b, g, r ) \
+    TUint16( ( b ) | ( ( ( g ) | ( ( r ) << 6 ) ) << 5 ) )
+
+#define UNPACK_16MU_RED( c ) ( 0xff & ( c >> 16 ) )
+#define UNPACK_16MU_GREEN( c ) ( 0xff & ( c >> 8 ) )
+#define UNPACK_16MU_BLUE( c ) ( c & 0xff )
+#define PACK_16MU_BGR( b, g, r ) \
+    TUint32( ( ( ( ( ( 0xff << 8 ) | ( r ) ) << 8 ) | ( g ) ) << 8 ) | ( b ) )
+
+#define UNPACK_16MA_ALPHA( c ) ( 0xff & ( c >> 24 ) )
+#define UNPACK_16MA_RED( c ) ( 0xff & ( c >> 16 ) )
+#define UNPACK_16MA_GREEN( c ) ( 0xff & ( c >> 8 ) )
+#define UNPACK_16MA_BLUE( c ) ( c & 0xff )
+#define PACK_16MA_ABGR( a, b, g, r ) \
+    TUint32( ( ( ( ( ( ( a ) << 8 ) | ( r ) ) << 8 ) | ( g ) ) << 8 ) | ( b ) )
+
+#endif // CVTIMAGESCALERMACROS_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/CVtImageTransformsUids.hrh	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  Uid definition file for Display Sink subsystem
+*
+*/
+
+
+
+#ifndef __CVTIMAGETRANSFORMS_HRH__
+#define __CVTIMAGETRANSFORMS_HRH__
+
+#define KUidVtImageTransformsLibrary    0x101F8834
+#define KSharedLibraryUidDefine         0x1000008D
+
+#endif // __CVTIMAGETRANSFORMS_HRH__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/DisplaySinkUids.hrh	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  Uid definition file for Display Sink subsystem
+*
+*/
+
+
+
+#ifndef __DISPLAYSINKUIDS_HRH__
+#define __DISPLAYSINKUIDS_HRH__
+
+#define KUidDisplaySinkLibrary  0x101F8693
+#define KSharedLibraryUidDefine 0x1000008D
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/TDisplaySinkParamsDP.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* 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:  DisplaySink subsystem.
+*
+*/
+
+
+#ifndef TDISPLAYSINKPARAMSDP_H
+#define TDISPLAYSINKPARAMSDP_H
+
+// INCLUDE FILES
+
+#include "mdisplaysink.h"
+#include <posting_surface.h>
+
+// CLASS DECLARATION
+
+/**
+*  Displaysink initialization parameters for DisplaySink's Display Posting
+*  implementation.
+*
+*  @lib displaysink.lib
+*  @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( TDisplaySinkParamsDP ) : public TDisplaySinkParams
+    {
+public:
+    // Pointer's pointer to first posting buffer  that is filled by the
+    // sink.
+    CPostingSurface::TPostingBuff** iPostingBuffer1;
+
+    // Pointer's pointer to second posting buffer  that is filled by the
+    // sink.
+    CPostingSurface::TPostingBuff** iPostingBuffer2;
+
+    // Posting format to be used
+    CPostingSurface::TPostingFormat iPostingFormat;
+
+    // Frame size in pixels
+    TSize iFrameSize;
+    };
+
+#endif // TDISPLAYSINKPARAMSDP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/TDisplaySinkParamsDSA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* 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:  DisplaySink subsystem.
+*
+*/
+
+
+#ifndef TDISPLAYSINKPARAMSDSA_H
+#define TDISPLAYSINKPARAMSDSA_H
+
+// INCLUDE FILES
+
+#include "cvtimagerotator.h"
+#include "mdisplaysink.h"
+
+// CLASS DECLARATION
+
+/**
+*  Displaysink initialization parameters for DisplaySink's Direct Screen Access
+*  implementation.
+*
+*  @lib displaysink.lib
+*  @since Series 60 3.1
+*/
+NONSHARABLE_CLASS( TDisplaySinkParamsDSA ) : public TDisplaySinkParams
+    {
+public:
+
+    /**
+    * C++ constructor
+    */
+    TDisplaySinkParamsDSA();
+
+public:
+    // Handle to first bitmap that is filled by the sink. 176x144 bitmap (QCIF)
+    TInt iBitmap1Handle;
+
+    // Handle to second bitmap that is filled by the sink. 176x144 bitmap (QCIF)
+    TInt iBitmap2Handle;
+
+    // Angle to which YUV image must be rotated BEFORE it is converted into bitmap.
+    // If CVtImageRotator::ERotationNone is given, image will be converted as it
+    // is received. Also make sure that iBitmap1Handle and iBitmap2Handle contains
+    // correct dimensions AFTER rotation.
+    CVtImageRotator::TRotationAngle iRotationAngle;
+    };
+
+#include "tdisplaysinkparamsdsa.inl"
+
+#endif // TDISPLAYSINKPARAMSDSA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/TDisplaySinkParamsNGA.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* 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:  Displaysink initialization parameters for DisplaySink's NGA implementation.
+*
+*/
+
+#ifndef TDISPLAYSINKPARAMSNGA_H
+#define TDISPLAYSINKPARAMSNGA_H
+
+// INCLUDE FILES
+
+#include "mdisplaysink.h"
+#include <pixelformats.h>
+//#include <videorenderer.h>
+#include <videoframebuffer.h>
+
+// CLASS DECLARATION
+
+/**
+*  Displaysink initialization parameters for DisplaySink's NGA
+*  implementation.
+*
+*  @lib displaysink.lib
+*  @since Series 60 7.0
+*/
+NONSHARABLE_CLASS( TDisplaySinkParamsNGA ) : public TDisplaySinkParams
+    {
+public:
+    // Pointer's pointer to first posting buffer  that is filled by the
+    // sink.
+    TUint8**  iSurfaceBuffer1;    
+    //TVideoFrameBuffer** iSurfaceBuffer1;
+
+    // Pointer's pointer to second posting buffer  that is filled by the
+    // sink.
+    //TVideoFrameBuffer** iSurfaceBuffer2;
+    TUint8**  iSurfaceBuffer2;
+
+    // Posting format to be used
+    TUidPixelFormat iSurfaceFormat;
+
+    // Frame size in pixels
+    TSize iFrameSize;
+    };
+
+#endif // TDISPLAYSINKPARAMSNGA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/VtImageConverterUids.hrh	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  Uid definition file for Display Sink subsystem
+*
+*/
+
+
+
+#ifndef __VTIMAGECONVERTERUIDS_HRH__
+#define __VTIMAGECONVERTERUIDS_HRH__
+
+#define KUidVtImageConverterLibrary 0x101F86B5
+#define KSharedLibraryUidDefine     0x1000008D
+
+#endif // __VTIMAGECONVERTERUIDS_HRH__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/cvtimage.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGE_H
+#define CVTIMAGE_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <gdi.h>
+
+// CLASS DECLARATIONS
+
+/**
+*  Abstract base class for VS images.
+*
+*  @lib videosource.lib
+*/
+class CVtImage : public CBase
+	{
+	public:
+        /**
+        * Enumeration for supported image types.
+        */
+        enum TVtImageType
+            {
+            /**
+            * CFbsBitmap image.
+            */
+            EVtImageBitmap,
+
+            /**
+            * YUV 420 planar image where all Y samples are found first in memory as an
+            * array of unsigned char (possibly with a larger stride for memory alignment),
+            * followed immediately by all Cr (U) samples (with half the stride of the Y
+            * lines, and half the number of lines), then followed immediately by all Cb
+            * (V) samples in a similar fashion.
+            */
+            EVtImageIYUV
+            };
+
+        /**
+        * Vt display modes. Used for identifying image's data format.
+        */
+        enum TVtDisplayMode
+            {
+            /**
+            * Unsupported display mode.
+            */
+            EVtColorNone,
+
+            /**
+            * 4096 colour display mode (12 bpp).
+            */
+            EVtColor4K,
+
+            /**
+            * 2^16 colour display mode (16 bpp).
+            */
+            EVtColor64K,
+
+            /**
+            * True colour display mode (24 bpp).
+            */
+            EVtColor16M,
+
+            /**
+            * True colour display mode (32 bpp).
+            */
+            EVtColor16MU,
+
+            /**
+            * True colour display mode with alpha (32 bpp).
+            */
+            EVtColor16MA,
+
+            /**
+            * YUV 420 planar display mode.
+            */
+            EVtColorIYUV
+            };
+
+		/**
+        * Pure virtual function to check whether bitmap heap needs to be locked
+        * for this image type.
+        * @return Returns ETrue if bitmap heap lock is required, EFalse
+        * otherwise.
+        */
+		virtual TBool NeedHeapLock() const = 0;
+
+		/**
+        * Pure virtual function to get displaymode from image.
+        * @return Returns image's displaymode.
+        */
+		virtual TVtDisplayMode DisplayMode() const = 0;
+
+		/**
+        * Pure virtual function to get size of the image in pixels
+        * @return Returns size of the image in pixels.
+        */
+		virtual TSize Size() const = 0;
+
+		/**
+        * Pure virtual function to get how many bytes this image has per
+        * scaline.
+        * @return Returns number of bytes per scanline.
+        */
+		virtual TInt BytesPerRow() const = 0;
+
+		/**
+        * Pure virtual function to get pointer to image data.
+        * @return Returns pointer to image data.
+        */
+		virtual TUint32* DataAddress() const = 0;
+
+		/**
+        * Pure virtual function to get pointer to image data at defined line.
+        * If aLine is lower than zero then line zero is returned, also if aLine
+        * is greater than height of the image minus 1 ( height - 1 ) then line
+        * number ( height - 1 ) is returned.
+        * @param "aLine" Number of vertical line for which pointer is wanted.
+		* @return Returns pointer to the beginning of the requested scanline.
+        */
+        virtual TUint32* LineAddress( TInt aLine ) const = 0;
+
+        /**
+        * Method for getting image type.
+        * @return Returns type of the image.
+        */
+		IMPORT_C TVtImageType Type() const;
+
+    public: // static methods
+
+		/**
+        * Converts given TDisplayMode to corresponding TVtDisplayMode.
+        * @param "aMode" Display mode as TDisplayMode.
+		* @return Returns mode as TVtDisplayMode.
+        */
+        static TVtDisplayMode DisplayModeToVtDisplayMode( TDisplayMode aMode );
+
+    protected:
+
+		/**
+        * C++ constructor.
+        */
+        CVtImage( TVtImageType aType );
+
+    private:
+
+        // Type of the image.
+        TVtImageType iType;
+	};
+
+#endif // CVTIMAGE_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/cvtimageconverter.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* 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:    Image conversion library for VideoTelephony.
+*
+*/
+
+
+
+
+#ifndef CVTIMAGECONVERTER_INL
+#define CVTIMAGECONVERTER_INL
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SourceSize() const
+// Returns source size in pixels.
+// -----------------------------------------------------------------------------
+//
+inline const TSize& CVTYUVFbsBitmapConverter::SourceSize() const
+    {
+    return iSourceSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SourceSize()
+// Returns source size in pixels.
+// -----------------------------------------------------------------------------
+//
+inline TSize& CVTYUVFbsBitmapConverter::SourceSize()
+    {
+    return iSourceSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::DestinationSize() const
+// Returns destination size in pixels.
+// -----------------------------------------------------------------------------
+//
+inline const TSize& CVTYUVFbsBitmapConverter::DestinationSize() const
+    {
+    return iDestinationSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::DestinationSize()
+// Returns destination size in pixels.
+// -----------------------------------------------------------------------------
+//
+inline TSize& CVTYUVFbsBitmapConverter::DestinationSize()
+    {
+    return iDestinationSize;
+    }
+
+#endif CVTIMAGECONVERTER_INL
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/cvtimagerotator.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,245 @@
+/*
+* 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:    Image Transforms subsystem.
+*
+*/
+
+
+
+
+
+#ifndef CVTIMAGEROTATOR_H
+#define CVTIMAGEROTATOR_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+class CVtImage;
+class CFbsBitmap;
+class CVtImageRotatorImpl;
+
+// CLASS DECLARATIONS
+
+/**
+*  Image rotator observer interface.
+*
+*  @lib videosource.lib
+*/
+class MVtImageRotatorObserver
+    {
+    public:
+        /**
+        * Callback method that is called by CVtImageRotator when rotation
+        * process has been finished.
+        * @param "aError" KErrNone if the rotation was done successfully, one
+        * of the system wide error codes otherwise.
+        * @return Pointer to newly created instance.
+        */
+        virtual void RotationFinished( TInt aError ) = 0;
+    };
+
+/**
+*  Image rotator.
+*
+*  @lib videosource.lib
+*/
+class CVtImageRotator : public CActive
+    {
+    public:
+        /**
+        * An enumeration within the CVtImageRotator namespace.
+        * It provides a set of panic codes that may happen during
+        * rotation process.
+        */
+        enum TPanics
+            {
+            /**
+            * RotateL() is called while previous rotation process
+            * has not yet been finished.
+            */
+            EBusy = 1
+            };
+
+        /**
+        * An enumeration within the CVtImageRotator namespace.
+        * It provides a set of supported rotation and mirror angles.
+        */
+        enum TRotationAngle
+            {
+            /**
+            * Uninitialized place holder. Giving this rotation angle
+            * to RotateL() will make RotateL() leave with error code
+            * KErrNotSupported.
+            */
+            ERotationNone = -1,
+
+            /**
+            * Rotates image 90 degrees in a clockwise direction.
+            */
+            E90DegreesClockwise,
+
+            /**
+            * Rotates image 180 degrees in a clockwise direction.
+            * (flip & mirror)
+            */
+            E180DegreesClockwise,
+
+            /**
+            * Rotates image 270 degrees in a clockwise direction.
+            */
+            E270DegreesClockwise,
+
+            /**
+            * Mirrors the bitmap around the horizontal axis.
+            */
+            EMirrorHorizontalAxis,
+
+            /**
+            * Flips the image around the vertical axis.
+            */
+            EFlipVerticalAxis,
+            };
+
+    public:
+
+        /**
+        * Creates new instance of CVtImageRotator.
+        * @param "aObserver" Reference to instance observer.
+        * @param "aPriority" Active object priority.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        * @return Pointer to newly created instance.
+        */
+        IMPORT_C static CVtImageRotator* NewL(
+            MVtImageRotatorObserver& aObserver,
+            TPriority aPriority = EPriorityLow );
+
+        /**
+        * C++ destructor.
+        */
+        IMPORT_C ~CVtImageRotator();
+
+        /**
+        * Rotates image to given angle.
+        * @param "aSource" Source image that will be rotated.
+        * @param "aTarget" Target image that will hold the rotated image.
+        * @param "aAngle" Rotation angle.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        IMPORT_C void RotateL( const CVtImage& aSource, CVtImage& aTarget,
+            const TRotationAngle& aAngle );
+
+        /**
+        * Rotates image to given angle. Possible error during initialization is
+        * returned via MVtImageRotatorObserver.
+        * @param "aSource" Source image that will be rotated.
+        * @param "aTarget" Target image that will hold the rotated image.
+        * @param "aAngle" Rotation angle.
+        */
+        IMPORT_C void Rotate( const CVtImage& aSource, CVtImage& aTarget,
+            const TRotationAngle& aAngle );
+
+    private: // internal
+
+        /**
+        * C++ default constructor.
+        */
+        CVtImageRotator();
+
+        /**
+        * C++ constructor.
+        * @param "aObserver" Reference to observer.
+        * @param "aPriority" Active object priority.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        CVtImageRotator( MVtImageRotatorObserver& aObserver, TPriority aPriority );
+
+        /**
+        * Second phase constructor.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        void ConstructL();
+
+        /**
+        * Creates new instance of rotator implementation if needed.
+        * @param "aAngle" Used rotation angle.
+        * @exception In error situation leaves with one of the system wide
+        * error codes.
+        */
+        void CreateRotatorL( const TRotationAngle& aAngle );
+
+        /**
+        * Sets iStatus to KRequestPending and calls CActive::SetActive().
+        */
+        void Activate();
+
+        /**
+        * Signals this instance AO with given error code.
+        * @param "aError" Signalling error code.
+        */
+        void Signal( TInt aError );
+
+    private: // from CActive
+
+        /**
+        * This is defined in CActive. Check CActive for description.
+        */
+        void RunL();
+
+        /**
+        * This is defined in CActive. Check CActive for description.
+        */
+        void DoCancel();
+
+        /**
+        * Rotate method called by the CAsyncCallBack.
+        */
+        static TInt StaticRotate( TAny* aPtr );
+
+        /**
+        * Rotate method called by the StaticScale.
+        */
+        void DoRotate();
+
+    private:
+
+        // Scaling observer
+        MVtImageRotatorObserver& iObserver;
+
+        // Bitmap that will be used for locking global bitmap heap
+        CFbsBitmap* iHeapLock; // owned
+
+        // Rotator implementation
+        CVtImageRotatorImpl* iRotatorImpl; // owned
+
+        // Asynccallback instance
+        CAsyncCallBack* iAsyncCallBack; // owned
+
+        // This is set to ETrue in DoCancel() method, and when CAsyncCallBack
+        // gets executed, iCancelled is checked whether scaling should be done
+        // or not.
+        TBool iCancelled;
+    };
+
+#endif // CVTIMAGEROTATOR_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/mdisplaysink.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,199 @@
+/*
+* 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:  DisplaySink subsystem.
+*
+*/
+
+
+#ifndef MDISPLAYSINK_H
+#define MDISPLAYSINK_H
+
+//  INCLUDE FILES
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+class MVTVideoSink;
+
+/**
+*  MDisplaySinkObserver
+*
+*  Sink observer API. Currently only frame size changes are reported using
+*  this IF.
+*
+*  @lib DisplaySink.lib
+*/
+class MDisplaySinkObserver
+    {
+public:
+    /**
+    * When incoming video frame size changes, this callback will be called.
+    * @param "aFrom" Current frame size.
+    * @param "aTo" New frame size.
+    * @return KErrNone if successful, one of the system wide error codes
+    * @exception May leave with one of the system wide error codes.
+    * otherwise.
+    */
+    virtual void VideoFrameSizeChangedL(
+        const TSize& aFrom,
+        const TSize& aTo ) = 0;
+    };
+
+/**
+*  Input parameters for Display Sink
+*
+*  @lib DisplaySink.lib
+*/
+class TDisplaySinkParams
+    {
+public:
+
+    /**
+    * Enumeration for limiting frame rate.
+    */
+    enum TFrameRateLimit
+        {
+        /** Don't limit frame rate (default) */
+        EFrameRateLimitNone = 0,
+        /** Limit frame rate to 1.0 frames per second */
+        EFrameRateLimit1_0 = 1000,
+        /** Limit frame rate to 2.5 frames per second */
+        EFrameRateLimit2_5 = 400,
+        /** Limit frame rate to 5.0 frames per second */
+        EFrameRateLimit5_0 = 200,
+        /** Limit frame rate to 7.5 frames per second */
+        EFrameRateLimit7_5 = 133,
+        /** Limit frame rate to 10.0 frames per second */
+        EFrameRateLimit10_0 = 100,
+        /** Limit frame rate to 12.5 frames per second */
+        EFrameRateLimit12_5 = 80,
+        /** Limit frame rate to 15.0 frames per second */
+        EFrameRateLimit15_0 = 67,
+        };
+
+	/**
+	* Flags for selecting correct type sink.
+	*/
+	enum TFlags
+		{
+		/** Create instance of DSA version of sink */
+		EDisplaySinkDSA = ( 1 << 0 ),
+		/** Create instance of DP version of sink */
+		EDisplaySinkDP = ( 1 << 1 ),
+		/** Create instance of NGA version of sink */
+		EDisplaySinkNGA = ( 1 << 2 )
+		};
+
+public:        // Data
+
+    /**
+    * C++ constructor for initializing some of the variables.
+    */
+    IMPORT_C TDisplaySinkParams();
+
+    // Thread id that gets notified by sink
+    TThreadId iThreadId;
+
+    // Pointer to iStatus member of the Active Object to notify after video
+    // frame is converted
+    TRequestStatus* iRequestStatusPtr;
+
+    // Pointer to Display Sink observer interface
+    MDisplaySinkObserver* iObserver;
+
+    // Frame rate limitation
+    TFrameRateLimit iFrameRateLimit;
+
+    // Sink flags
+    TUint32 iFlags;
+    };
+
+/**
+*  MDisplaySink
+*
+*  @lib DisplaySink.lib
+*/
+class MDisplaySink
+    {
+public: // data
+
+    // Enumeration for the bitmaps.
+    enum TBitmapNo
+        {
+        EFirstBitmap = 0,
+        ESecondBitmap
+        };
+
+public: // new methods
+
+    /**
+    * Deletes instance and frees all memory.
+    */
+    virtual void Destroy() = 0;
+
+    /**
+    * Mark the bitmap available for use.
+    * @param "aBitmapNo" One of the enumerated TBitmapNo values.
+    */
+    virtual void SetBitmapAvailable( TBitmapNo aBitmapNo ) = 0;
+
+    /**
+    * Cancels sink so that it does not convert bitmaps even it receives data.
+    */
+    virtual void Release() = 0;
+
+    /**
+    * Updates display sink parameters, e.g. when display mode changes.
+    * @param "aParams" Structure that contains new bitmap handles.
+    * @param "aUpdated" Reference to boolean variable that will be set to
+    * ETrue when display sink parameter update has been completed.
+    * @exception May leave with one of the system wide error codes (e.g. in
+    * out of memory situaton).
+    */
+    virtual void UpdateSinkParamsL( const TDisplaySinkParams& aParams,
+        TBool& aUpdated ) = 0;
+
+    /**
+    * Pauses sending of remote video to VT engine.
+    */
+    virtual void Pause() = 0;
+
+    /**
+    * Resumes sending of remote video to VT engine.
+    */
+    virtual void Resume() = 0;
+
+    /**
+    * Operator returns this instance .
+    */
+    virtual operator MVTVideoSink&() = 0;
+
+    /**
+    * This method is called by the VT engine when engine has finished handling
+    * of previous frame and is ready to handle a new one.
+    */
+    virtual void NextFrame() = 0;
+
+    };
+
+/**
+* Creates instance of displaysink.
+*/
+IMPORT_C MDisplaySink* CreateSinkL( TDisplaySinkParams& aParams,
+    const TDesC8& aInitData );
+
+#endif // MDISPLAYSINK_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/tdisplaysinkparamsdsa.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* 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:  DisplaySink subsystem.
+*
+*/
+
+
+#ifndef TDISPLAYSINKPARAMSDSA_INL
+#define TDISPLAYSINKPARAMSDSA_INL
+
+// ====================== TDisplaySinkParamsDSA ==========================
+
+inline TDisplaySinkParamsDSA::TDisplaySinkParamsDSA() : TDisplaySinkParams()
+    {
+    Mem::FillZ( this, sizeof( TDisplaySinkParamsDSA ) );
+    iRotationAngle = CVtImageRotator::ERotationNone;
+    }
+
+#endif TDISPLAYSINKPARAMSDSA_INL
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/inc/vtyuvconverter.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005-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:  YUV format transcoder.
+*
+*/
+
+
+#ifndef TVTYUVCONVERTER_H
+#define TVTYUVCONVERTER_H
+
+#include <e32base.h>
+
+/**
+ *  Yuv format transcoder.
+ *
+ *  Implements conversion between different YUV formats.
+ *
+ *  @lib VTImageConverter.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( VtYuvConverter )
+    {
+public:
+
+    /**
+     * Converts from 4:2:0 planar source image to 4:2:2 interleaved image.
+     *
+     * @since S60 v3.1
+     * @param aSource Constant descriptor containing source image data.
+     * @param aSize Size of the image in pixels.
+     * @param aTarget Modifiable descriptor for target image data.
+     * @param aStide Number of bytes per scanline in target buffer.
+     * @return KErrNone if conversion was successful, KErrUnderflow if result
+     * does not fit in target buffer or KErrArgument if source buffer's size
+     * does not match with the given source size in pixels.
+     */
+    static TInt ConvertFrom420PlanarTo422Interleaved(
+        const TDesC8& aSource,
+        const TSize& aSize,
+        TDes8& aTarget,
+        TInt aStride );
+
+private:
+
+    /**
+     * Constructor.
+     */
+    VtYuvConverter();
+
+    /**
+     * Copy constructor.
+     */
+    VtYuvConverter( const VtYuvConverter& );
+
+    /**
+     * Returns image size in bytes for 420 planar image that has given pixel
+     * size.
+     */
+    static TInt ByteSize420Planar( const TSize& aSizeInPixels );
+
+    /**
+     * Returns image size in bytes for 422 interleaved image that has given
+     * pixel size.
+     */
+    static TInt ByteSize422Interleaved( const TSize& aSizeInPixels );
+    };
+
+#endif // TVTYUVCONVERTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/rom/DisplaySink.iby	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2004-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 DisplaySink
+*
+*
+*/
+
+
+#ifndef __DISPLAYSINK_IBY__
+#define __DISPLAYSINK_IBY__
+
+#ifdef __CS_VIDEO_TELEPHONY
+
+file=ABI_DIR\BUILD_DIR\VTImageConverter.dll	SHARED_LIB_DIR\VTImageConverter.dll
+file=ABI_DIR\BUILD_DIR\DisplaySink.dll	 	SHARED_LIB_DIR\DisplaySink.dll
+file=ABI_DIR\BUILD_DIR\VtImageTransforms.dll	SHARED_LIB_DIR\VtImageTransforms.dll
+data=ZSYSTEM\install\displaysink_stub.sis  system\install\displaysink_stub.sis
+
+#endif
+
+#endif  //__DISPLAYSINK_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CDisplaySink.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1029 @@
+/*
+* 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:  Display Sink subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CDisplaySink.h"
+#include "CDisplaySinkDP.h"
+#include "CDisplaySinkDSA.h"
+#include "CDisplaySinkNGA.h"
+#include <mmffourcc.h>
+#include <featmgr.h>
+
+// CONSTANTS
+
+// MACROS
+
+#ifdef _DEBUG
+    #include <e32debug.h>
+    #define PRINT RDebug::Print
+    #define _IFDBG(a) a
+#else
+    #define PRINT
+    #define _IFDBG(a)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================= CVtFrameQueue =================================
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::CVtFrameQueue
+// -----------------------------------------------------------------------------
+//
+CVtFrameQueue::CVtFrameQueue() : CActive( EPriorityNormal )
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::CVtFrameQueue<" ) ));
+    _IFDBG(PRINT( _L( "CVtFrameQueue::CVtFrameQueue>" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::ThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CVtFrameQueue::ThreadLogon()
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogon<" ) ));
+    if ( !IsAdded() )
+        {
+        CActiveScheduler::Add( this );
+        }
+    TInt result( iThread.Open( RThread().Id() ) );
+    _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogon %d >" ), result ));
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::SinkStoppedL
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::SinkStoppedL()
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::SinkStoppedL<" ) ));
+    DoReleaseBufferL( iBuffer );
+    DoReleaseBufferL( iReleaseBuffer );
+    _IFDBG(PRINT( _L( "CVtFrameQueue::SinkStoppedL>" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::ThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::ThreadLogoff()
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogoff<" ) ));
+    if ( IsAdded() )
+        {
+        Deque();
+        }
+    _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogoff>" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::Store
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::Store( MVTVideoSource& aSupplier,
+    CMMFDataBuffer* aBuffer,
+    TSize aFrameSize, 
+    TPtr8& aPtr )
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::Store<" ) ));
+    iSupplier = &aSupplier;
+    iBuffer = aBuffer;
+    iFrameSize = aFrameSize;
+    iPtr = &aPtr;
+    _IFDBG(PRINT( _L( "CVtFrameQueue::Store>" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::IsStored
+// -----------------------------------------------------------------------------
+//
+TBool CVtFrameQueue::IsStored() const
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::IsStored<" ) ));
+    _IFDBG(PRINT( _L( "CVtFrameQueue::IsStored %d>" ),
+        ( iBuffer != NULL ) ));
+    return ( iBuffer != NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::Buffer
+// -----------------------------------------------------------------------------
+//
+TVtMMFDataBuffer CVtFrameQueue::Buffer()
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::Buffer<" ) ));
+    _IFDBG(PRINT( _L( "CVtFrameQueue::Buffer %d>" ),
+        reinterpret_cast< TUint >( iBuffer ) ));
+    return TVtMMFDataBuffer(iBuffer, iFrameSize, *iPtr);
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::Release
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::Release()
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::Release<" ) ));
+    if ( !IsActive() && IsStored() )
+        {
+        iReleaseBuffer = iBuffer;
+        iBuffer = NULL;
+        iStatus = KRequestPending;
+        TRequestStatus* pStatus = &iStatus;
+        SetActive();
+        iThread.RequestComplete( pStatus, KErrNone );
+        _IFDBG(PRINT( _L( "CVtFrameQueue::Release -done-" ) ));
+        }
+    _IFDBG(PRINT( _L( "CVtFrameQueue::Release>" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::RunL()
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::RunL<" ) ));
+    DoReleaseBufferL( iReleaseBuffer );
+    _IFDBG(PRINT( _L( "CVtFrameQueue::RunL>" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::DoReleaseBufferL
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::DoReleaseBufferL( CMMFDataBuffer*& aBuffer )
+    {
+    _IFDBG(PRINT( _L( "CVtFrameQueue::DoReleaseBufferL<" ) ));
+    if ( aBuffer && iSupplier )
+        {
+        iSupplier->BufferEmptiedL( aBuffer );
+        aBuffer = NULL;
+        }
+    _IFDBG(PRINT( _L( "CVtFrameQueue::DoReleaseBufferL>" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtFrameQueue::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtFrameQueue::DoCancel()
+    {
+    // nothing to do
+    }
+
+// ============================ CVtCallback =================================
+
+// -----------------------------------------------------------------------------
+// CVtCallback::CVtCallback( MDisplaySinkObserver& aObserver )
+// -----------------------------------------------------------------------------
+//
+CVtCallback::CVtCallback( MDisplaySinkObserver& aObserver )
+: CActive( EPriorityStandard ), iObserver( &aObserver )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::CVtCallback()<"), RThread().Id().operator TUint()));
+    CActiveScheduler::Add( this );
+    iOwnThreadId = RThread().Id();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::CVtCallback()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::~CVtCallback()
+// -----------------------------------------------------------------------------
+//
+CVtCallback::~CVtCallback()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::VideoFrameSizeChangedL( const TSize& aFrom, const TSize& aTo )
+// -----------------------------------------------------------------------------
+//
+void CVtCallback::VideoFrameSizeChangedL( const TSize& aFrom, const TSize& aTo )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::VideoFrameSizeChangedL()<"), RThread().Id().operator TUint()));
+    iCallBackType = EVideoFrameSizeChanged;
+    iFrom = aFrom;
+    iTo = aTo;
+    IssueCallbackL();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::VideoFrameSizeChangedL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::Result() const
+// -----------------------------------------------------------------------------
+//
+TInt CVtCallback::Result() const
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Result()<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Result()>"), RThread().Id().operator TUint()));
+    return iResult;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::Completed() const
+// -----------------------------------------------------------------------------
+//
+TBool CVtCallback::Completed() const
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Completed()<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Completed()>"), RThread().Id().operator TUint()));
+    return iCompleted;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::IssueCallbackL()
+// -----------------------------------------------------------------------------
+//
+void CVtCallback::IssueCallbackL()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::IssueCallbackL()<"), RThread().Id().operator TUint()));
+    iCompleted = EFalse;
+    TRequestStatus* pStatus = &iStatus;
+    RThread thread;
+    if( thread.Id() == iOwnThreadId )
+        {
+        SetActive();
+        User::RequestComplete( pStatus, KErrNone );
+        }
+    else
+        {
+        User::LeaveIfError( thread.Open( iOwnThreadId ) );
+        SetActive();
+        *pStatus = KRequestPending;
+        thread.RequestComplete( pStatus, KErrNone );
+        thread.Close();
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::IssueCallbackL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::RunL()
+// -----------------------------------------------------------------------------
+//
+void CVtCallback::RunL()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::RunL()<"), RThread().Id().operator TUint()));
+
+    iResult = KErrNone;
+
+    switch( iCallBackType )
+        {
+        case EVideoFrameSizeChanged:
+            iObserver->VideoFrameSizeChangedL( iFrom, iTo );
+            break;
+
+        default:
+            User::Leave( KErrArgument );
+        }
+
+    iCompleted = ETrue;
+
+    _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::RunL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CVtCallback::DoCancel()
+    {
+    // do nothing!
+    }
+
+// -----------------------------------------------------------------------------
+// CVtCallback::RunError( TInt aError )
+// -----------------------------------------------------------------------------
+//
+TInt CVtCallback::RunError( TInt aError )
+    {
+    iCompleted = ETrue;
+    iResult = aError;
+    return KErrNone;
+    }
+
+// ========================== TDisplaySinkParams ===============================
+
+// -----------------------------------------------------------------------------
+// TDisplaySinkParams::TDisplaySinkParams
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TDisplaySinkParams::TDisplaySinkParams() :
+    iFrameRateLimit( EFrameRateLimitNone )
+    {
+    }
+
+
+// ============================ CDisplaySink ===================================
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::~CDisplaySink
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::~CDisplaySink()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::~CDisplaySink()<"), RThread().Id().operator TUint()));
+	delete iVideoFrameQueue;
+	iBitmapCS.Close();
+    delete iVTSignaller;
+    iVTMimeTypes.Reset();
+	iVTMimeTypes.Close();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::~CDisplaySink()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::ConstructL( TDisplaySinkParams& aParams,
+    const TDesC8& aInitData )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ConstructL()<"), RThread().Id().operator TUint()));
+    iDSFlags = aParams.iFlags;
+    iYuv420PlanarDesc.Delete( 0, iYuv420PlanarDesc.Length() );
+    iYuv420PlanarDesc.Append( KVtVideoMIMETypeYUV420 );
+    User::LeaveIfError( iVTMimeTypes.Append( &iYuv420PlanarDesc ) );
+    iVideoFrameQueue = new ( ELeave ) CVtFrameQueue();
+    iVTSignaller = new ( ELeave ) CVtCallback( *aParams.iObserver );
+	BitmapEntry( EFirstBitmap ).iIsFree = EFalse;
+	BitmapEntry( ESecondBitmap ).iIsFree = EFalse;
+	iThreadId = aParams.iThreadId;
+	iRequestStatusPtr = aParams.iRequestStatusPtr;
+    iFrameSize = QCIF;
+    SetFrameRateLimit( aParams.iFrameRateLimit );
+    User::LeaveIfError( iBitmapCS.CreateLocal() );
+	BaseConstructL( aParams, aInitData );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ConstructL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::Destroy
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::Destroy()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Destroy()<"), RThread().Id().operator TUint()));
+	delete this;
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Destroy()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SetBitmapAvailable( TBitmapNo aBitmapNo )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SetBitmapAvailable( TBitmapNo aBitmapNo )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetBitmapAvailable()<"), RThread().Id().operator TUint()));
+	iBitmapCS.Wait();
+    BitmapEntry( aBitmapNo ).iIsFree = ETrue;
+    BaseSetBitmapAvailable( aBitmapNo );
+    iBitmapCS.Signal();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetBitmapAvailable()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::Release
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::Release()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Release()<"), RThread().Id().operator TUint()));
+	iBitmapCS.Wait();
+	if( !iReleased  )
+		{
+		iReleased = ETrue;
+		if( iRequestStatusPtr != NULL &&
+		    (*iRequestStatusPtr) == KRequestPending )
+			{
+			RThread thread;
+			TInt err = thread.Open( iThreadId );
+			if( err == KErrNone )
+				{
+				*iRequestStatusPtr = KRequestPending;
+				TRequestStatus* statusP = iRequestStatusPtr;
+				thread.RequestComplete( statusP, KErrCancel );
+    			thread.Close();
+				}
+			}
+		}
+	iVideoFrameQueue->Release();
+	iBitmapCS.Signal();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Release()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::UpdateSinkParamsL( const TDisplaySinkParams& aParams,
+//  TBool& aUpdated )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::UpdateSinkParamsL(
+    const TDisplaySinkParams& aParams, TBool& aUpdated )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::UpdateSinkParamsL()<"), RThread().Id().operator TUint()));
+	// This modification was requested by the VT engine team
+	iReleased = EFalse;
+	// This modification was requested by the VT engine team
+    iBitmapCS.Wait();
+    BaseUpdateSinkParamsL( aParams );
+    aUpdated = EFalse;
+    iParamsUpdated = &aUpdated;
+    iDSFlags = aParams.iFlags;
+    BitmapEntry( EFirstBitmap ).iIsFree = EFalse;
+	BitmapEntry( ESecondBitmap ).iIsFree = EFalse;
+	iVideoFrameQueue->Release();
+    iBitmapCS.Signal();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::UpdateSinkParamsL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::Pause()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::Pause()
+    {
+    iBitmapCS.Wait();
+    iPaused = ETrue;
+    iVideoFrameQueue->Release();
+    iBitmapCS.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::Resume()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::Resume()
+    {
+    iBitmapCS.Wait();
+    iPaused = EFalse;
+    iBitmapCS.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::operator MVTVideoSink&()
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::operator MVTVideoSink&()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::operator MVTVideoSink&()<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::operator MVTVideoSink&()>"), RThread().Id().operator TUint()));
+    return *this;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::NextFrame
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::NextFrame()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::NextFrame()<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::NextFrame()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::GetMultimediaTypesL() const
+// -----------------------------------------------------------------------------
+//
+const RArray<TDesC8* >& CDisplaySink::GetMultimediaTypesL() const
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetMultimediaTypeL()<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetMultimediaTypeL()>"), RThread().Id().operator TUint()));
+	return iVTMimeTypes;
+	}
+
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SetFormatL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SetFormatL( const TDesC8& aFormat )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFormatL()<"), RThread().Id().operator TUint()));
+	if ( aFormat != KVtVideoMIMETypeYUV420 )
+		{
+		User::Leave( KErrNotSupported );
+		}
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFormatL()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SetVideoFrameSizeL( const TSize& aSize )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+    if ( iInitFlags & ESinkThreadLogonCalled )
+        {
+        SinkThreadLogonL();
+        }
+    if ( iInitFlags & EFbsSessionConnected )
+        {
+        TSize size( aSize );
+        BaseSetVideoFrameSizeL( aSize );
+	    iFrameSize = aSize;
+	    }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::GetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::GetVideoFrameSizeL( TSize& aSize ) const
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+	aSize = iFrameSize;
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::EmptyBufferL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::EmptyBufferL(
+    TVtMMFDataBuffer aDataBuffer,
+    MVTVideoSource* aSupplier,
+    TMediaId /*aMediaId*/ )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()<"), RThread().Id().operator TUint()));
+    if ( aDataBuffer.GetMMFBuffer() == NULL || aSupplier == NULL )
+		{
+		User::Leave( KErrArgument );
+		}
+    if ( iReleased )
+        {
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): sink released, just return buffer"), RThread().Id().operator TUint()));
+        aSupplier->BufferEmptiedL( aDataBuffer.GetMMFBuffer() );
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()>"), RThread().Id().operator TUint()));
+        return;
+        }
+    else if ( iInitFlags & ESinkThreadLogonCalled )
+        {
+        TRAPD( result, SinkThreadLogonL() );
+        if ( result != KErrNone )
+            {
+        	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): SinkThreadLogonL failed %d"), RThread().Id().operator TUint(), result));
+            aSupplier->BufferEmptiedL( aDataBuffer.GetMMFBuffer() );
+            User::Leave( result );
+            }
+        }
+	if ( aDataBuffer.GetMMFBuffer()->Type() != KVTUidYUVFrameBuffer )
+        {
+		User::Leave( KErrArgument );
+		}
+	if ( iState != EPlaying )
+		{
+		User::Leave( KErrNotReady );
+		}
+    iBitmapCS.Wait();
+
+    CleanupSignalPushL( iBitmapCS );
+    iBuffer = aDataBuffer.GetMMFBuffer();
+	iSupplier = aSupplier;
+    if ( IsOkToSendFrame() )
+        {
+        // Waiting for frame size update?
+        if ( iWaitingForUpdate )
+            {
+            // Update completed?
+            if ( iVTSignaller->Completed() )
+                {
+                // YES: If it failed then Leave
+                if ( iVTSignaller->Result() != KErrNone )
+                    {
+                    iSupplier->BufferEmptiedL( iBuffer );
+                    User::Leave( iVTSignaller->Result() );
+                    }
+                }
+            else
+                {
+                // NO: Report buffer emptied and return
+                iSupplier->BufferEmptiedL( iBuffer );
+                CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+                return;
+                }
+            }
+
+        // Is param update pending?
+        if ( iParamsUpdated )
+            {
+            // YES: set new params
+            BaseDoUpdateParamsL();
+            *iParamsUpdated = ETrue;
+            iParamsUpdated = 0;
+            iWaitingForUpdate = EFalse;
+           	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): params update finished"), RThread().Id().operator TUint()));
+            }
+
+        // Update YUV data descriptor size based on resolution info.
+        TSize size( aDataBuffer.GetFrameSize() );
+        TInt length( ( size.iWidth * size.iHeight * 12 ) / 8 );
+        aDataBuffer.Data().Set( const_cast<TUint8*>( aDataBuffer.Data().Ptr() ), length, length );
+        // Expected frame size same as received size?
+        if ( !BaseSizesMatch( size ) )
+            {
+            if ( !iWaitingForUpdate )
+                {
+                iVTSignaller->VideoFrameSizeChangedL( iExpectedFrameSize,
+                    aDataBuffer.GetFrameSize() );
+                BaseVideoFrameSizeChangedL( aDataBuffer.GetFrameSize() );
+                iWaitingForUpdate = ETrue;
+                }
+            CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+            iSupplier->BufferEmptiedL( iBuffer );
+            return;
+            }
+        // All validation done, now it is ok to do implementation specific
+        // empty buffer.
+        BaseEmptyBufferL( aDataBuffer );
+
+// debugging
+// debugging
+// debugging
+
+        //iFC.PrintStatus();
+
+// debugging
+// debugging
+// debugging
+
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()>"), RThread().Id().operator TUint()));
+        // No CleanupStack::PopAndDestroy() here, because cleanup is done in
+        // BaseEmptyBufferL(). Reason behind this decission is that certain
+        // things have to be handled either before or after cleanup and thus
+        // single cleanup here is not enough.
+        return;
+        }
+    else
+        {
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): dropping frame %d < %d"), RThread().Id().operator TUint(), iMilliSecondsSinceLastFrame, iFrameRateInterval ));
+        iSupplier->BufferEmptiedL( iBuffer );
+        }
+    CleanupStack::PopAndDestroy(); // iBitmapCS.Signal()
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::BufferFilledL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::BufferFilledL( CMMFBuffer* /*aBuffer*/ )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::BufferFilledL()<"), RThread().Id().operator TUint()));
+	User::Leave( KErrNotSupported );
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::BufferFilledL()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::CanCreateSinkBuffer
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySink::CanCreateSinkBuffer()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CanCreateSinkBuffer()<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CanCreateSinkBuffer()>"), RThread().Id().operator TUint()));
+	return EFalse;
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::CreateSinkBufferL
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CDisplaySink::CreateSinkBufferL(
+    TMediaId /*aMediaId*/,
+    TBool& /*aReference*/ )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CreateSinkBufferL()<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CreateSinkBufferL()>"), RThread().Id().operator TUint()));
+	return NULL;
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkThreadLogon( MAsyncEventHandler& /*aEventHandler*/ )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogon()<"), RThread().Id().operator TUint()));
+    iInitFlags |= ESinkThreadLogonCalled;
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogon()>"), RThread().Id().operator TUint()));
+	return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkThreadLogonL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SinkThreadLogonL()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonL()<"), RThread().Id().operator TUint()));
+    TInt result( FbsStartup() );
+    if ( result == KErrNone )
+        {
+        CleanupStack::PushL( TCleanupItem( &SinkThreadLogonCleanup, this ) );
+        FbsConnectL();
+        ThreadOpenL();
+        User::LeaveIfError( iVideoFrameQueue->ThreadLogon() );
+        BaseSinkThreadLogonL();
+        iInitFlags &= ~ESinkThreadLogonCalled;
+        CleanupStack::Pop(); // TCleanupItem( &SinkThreadLogonCleanup, this )
+        }
+    User::LeaveIfError( result );
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonL()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SinkThreadLogoff()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogoff()<"), RThread().Id().operator TUint()));
+	BaseSinkThreadLogoff();
+	iVideoFrameQueue->ThreadLogoff();
+    ThreadClose();
+    FbsDisconnect();
+    iInitFlags = 0;
+    iExpectedFrameSize = TSize();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogoff()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkPrimeL
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkPrimeL()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPrimeL()<"), RThread().Id().operator TUint()));
+	if ( iState != EStopped )
+		{
+		return KErrNone;
+		}
+    iState = EPrimed;
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPrimeL()>"), RThread().Id().operator TUint()));
+	return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkPlayL
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkPlayL()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPlayL()<"), RThread().Id().operator TUint()));
+	if ( iState != EPrimed )
+		{
+		User::Leave( KErrNotReady );
+		}
+    ResetFrameRateLimitter();
+	iState = EPlaying;
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPlayL()>"), RThread().Id().operator TUint()));
+	return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkPauseL
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkPauseL()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPauseL()<"), RThread().Id().operator TUint()));
+	if ( iState != EPlaying )
+		{
+		return KErrNone;
+		}
+	iState = EPrimed;
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPauseL()>"), RThread().Id().operator TUint()));
+	return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkStopL
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySink::SinkStopL()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkStopL()<"), RThread().Id().operator TUint()));
+	if ( iState == EStopped )
+		{
+		return KErrNone;
+		}
+    iBitmapCS.Wait();
+    iVideoFrameQueue->SinkStoppedL();
+    iBitmapCS.Signal();
+    iState = EStopped;
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkStopL()>"), RThread().Id().operator TUint()));
+	return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::CDisplaySink
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::CDisplaySink() : MVTVideoSink( KNullUid ),
+    iSinkFourCC( 0 ), iState( EStopped )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Ctor()<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Ctor()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SetFrameRateLimit(
+//  TDisplaySinkParams::TFrameRateLimit aFrameRateLimit )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SetFrameRateLimit(
+    TDisplaySinkParams::TFrameRateLimit aFrameRateLimit )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFrameRateLimit()<"), RThread().Id().operator TUint()));
+    iFrameRateInterval = TInt( aFrameRateLimit );
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFrameRateLimit()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::ResetFrameRateLimitter()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::ResetFrameRateLimitter()
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ResetFrameRateLimitter()<"), RThread().Id().operator TUint()));
+    iMilliSecondsSinceLastFrame = 0;
+    iLastFrameTime = Time::NullTTime();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ResetFrameRateLimitter()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::BufferFilledL
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySink::IsOkToSendFrame()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::IsOkToSendFrame()<"), RThread().Id().operator TUint()));
+    TBool isOkToSendFrame( EFalse );
+    if( iPaused )
+        {
+        // nothing to do here because  okToSendFrame defaults to EFalse
+        }
+    else if( iFrameRateInterval == TDisplaySinkParams::EFrameRateLimitNone )
+        {
+        // If no limitation is set -> send frame
+        isOkToSendFrame = ETrue;
+        }
+    else if( iLastFrameTime == Time::NullTTime() )
+        {
+        // EmptyBufferL() is being called the first time after SinkPlayL() ->
+        // send frame
+        iLastFrameTime.HomeTime();
+        isOkToSendFrame = ETrue;
+        }
+    else
+        {
+        // Check if enough time has passed since previous frame sent
+        TTime now;
+        now.HomeTime();
+        TTimeIntervalMicroSeconds interval(
+            now.MicroSecondsFrom( iLastFrameTime ) );
+        iMilliSecondsSinceLastFrame += I64INT( interval.Int64() ) / 1000;
+        iLastFrameTime = now;
+        if( iMilliSecondsSinceLastFrame >= iFrameRateInterval )
+            {
+            // Enough time passed -> send frame
+        	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::IsOkToSendFrame(): sending frame %d >= %d"), RThread().Id().operator TUint(), iMilliSecondsSinceLastFrame, iFrameRateInterval ));
+            isOkToSendFrame = ETrue;
+            while( iMilliSecondsSinceLastFrame >= iFrameRateInterval )
+                {
+                iMilliSecondsSinceLastFrame -= iFrameRateInterval;
+                }
+            }
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::IsOkToSendFrame() %d>"), RThread().Id().operator TUint(), isOkToSendFrame));
+    return isOkToSendFrame;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::FbsConnectL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::FbsConnectL()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsConnectL()<"), RThread().Id().operator TUint()));
+    if ( !( iInitFlags & EFbsSessionConnected ) )
+        {
+        User::LeaveIfError( RFbsSession::Connect() );
+        iInitFlags |= EFbsSessionConnected;
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsConnectL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::ThreadOpenL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::ThreadOpenL()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadOpenL()<"), RThread().Id().operator TUint()));
+    if ( !( iInitFlags & EThreadOpened ) )
+        {
+        User::LeaveIfError( iThread.Open( iThreadId ) );
+        iInitFlags |= EThreadOpened;
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadOpenL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::FbsDisconnect
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::FbsDisconnect()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsDisconnect()<"), RThread().Id().operator TUint()));
+    if ( iInitFlags & EFbsSessionConnected )
+        {
+        RFbsSession::Disconnect();
+        iInitFlags &= ~EFbsSessionConnected;
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsDisconnect()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::ThreadClose
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::ThreadClose()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadClose()<"), RThread().Id().operator TUint()));
+    if ( iInitFlags & EThreadOpened )
+        {
+        iThread.Close();
+        iInitFlags &= ~EThreadOpened;
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadClose()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySink::SinkThreadLogonCleanup
+// -----------------------------------------------------------------------------
+//
+void CDisplaySink::SinkThreadLogonCleanup( TAny* aPtr )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonCleanup()<"), RThread().Id().operator TUint()));
+	CDisplaySink* self = reinterpret_cast< CDisplaySink* >( aPtr );
+	self->iVideoFrameQueue->ThreadLogoff();
+	self->ThreadClose();
+	self->FbsDisconnect();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonCleanup()>"), RThread().Id().operator TUint()));
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+// -----------------------------------------------------------------------------
+// CreateSinkL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MDisplaySink* CreateSinkL( TDisplaySinkParams& aParams,
+    const TDesC8& aInitData )
+    {
+    MDisplaySink* sink = NULL;
+    if (aParams.iFlags & TDisplaySinkParams::EDisplaySinkNGA)
+        {
+        sink = CDisplaySinkNGA::NewL( aParams, aInitData );
+        }
+    else if ( FeatureManager::FeatureSupported( KFeatureIdDisplayPost ) &&
+    	 ( aParams.iFlags & TDisplaySinkParams::EDisplaySinkDP ) )
+	    {
+        sink = CDisplaySinkDP::NewL( aParams, aInitData );
+	    }
+        else
+	    {
+        sink = CDisplaySinkDSA::NewL( aParams, aInitData );
+	    }
+    return sink;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CDisplaySinkDP.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,309 @@
+/*
+* 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:  Display Sink subsystem for Display Posting.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CDisplaySinkDP.h"
+#include "vtyuvconverter.h"
+
+// MACROS
+
+#ifdef _DEBUG
+    #include <e32debug.h>
+    #define PRINT RDebug::Print
+    #define _IFDBG(a) a
+#else
+    #define PRINT
+    #define _IFDBG(a)
+#endif
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDP* CDisplaySinkDP::NewL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::NewL()<"), RThread().Id().operator TUint()));
+    CDisplaySinkDP* self = new ( ELeave ) CDisplaySinkDP();
+    CleanupStack::PushL( self );
+    self->ConstructL( aParams, aInitData );
+    CleanupStack::Pop(); // self
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::NewL()>"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::CDisplaySinkDP
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDP::CDisplaySinkDP()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::Ctor<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::Ctor>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::~CDisplaySinkDP
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDP::~CDisplaySinkDP()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::~<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::~>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseConstructL( TDisplaySinkParams& aParams,
+    const TDesC8& )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConstructL()<"), RThread().Id().operator TUint()));
+    iNewParams = static_cast< const TDisplaySinkParamsDP& >( aParams );
+	if ( !iNewParams.iPostingBuffer1 || !iNewParams.iPostingBuffer2 )
+	    {
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConstructL() posting buffer is NULL!")));
+	    User::Leave( KErrArgument );
+	    }
+    iBitmapTable[EFirstBitmap].iBuffer = iNewParams.iPostingBuffer1;
+	iBitmapTable[ESecondBitmap].iBuffer = iNewParams.iPostingBuffer2;
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConstructL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseConvert
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkDP::BaseConvert( const TVtMMFDataBuffer& aBuffer )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert()<"), RThread().Id().operator TUint()));
+
+    TBool consumed( ETrue );
+    TBitmapNo bitmapNo( iBitmapTable[ EFirstBitmap ].iIsFree ? EFirstBitmap : ESecondBitmap );
+    if ( iBitmapTable[ bitmapNo ].iIsFree &&
+         !iReleased &&
+         ( *iRequestStatusPtr == KRequestPending ) )
+		{
+        CPostingSurface::TPostingBuff* postingBuffer =
+            *iBitmapTable[ bitmapNo ].iBuffer;
+
+        TInt bufferLength(
+            postingBuffer->GetSize().iHeight * postingBuffer->GetStride() );
+
+        TPtr8 ptrBuffer(
+            static_cast< TUint8* >( postingBuffer->GetBuffer() ),
+            bufferLength,
+            bufferLength
+            );
+
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert(): buffer %d: $%x %d bytes"), RThread().Id().operator TUint(), bitmapNo, postingBuffer->GetBuffer(), bufferLength));
+
+        // Determine wether to convert or copy (420 will be just copied)
+        if ( iNewParams.iPostingFormat ==
+             CPostingSurface::EYuv422LeBt601Range0 )
+            {
+            _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert(): converting to 422"), RThread().Id().operator TUint()));
+            VtYuvConverter::ConvertFrom420PlanarTo422Interleaved(
+                aBuffer.Data(),
+                aBuffer.GetFrameSize(),
+                ptrBuffer,
+                postingBuffer->GetStride() );
+            }
+        else
+            {
+            _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert(): copying as 420"), RThread().Id().operator TUint()));
+            ptrBuffer = aBuffer.Data();
+            }
+
+		iBitmapTable[ bitmapNo ].iIsFree = EFalse;
+		TRequestStatus* statusP = iRequestStatusPtr;
+		iThread.RequestComplete( statusP, bitmapNo );
+		}
+    else
+        {
+        consumed = EFalse;
+    	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert(): could not find free buffer"), RThread().Id().operator TUint()));
+        }
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseConvert()>"), RThread().Id().operator TUint()));
+    return consumed;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSinkThreadLogonL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseSinkThreadLogonL()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSinkThreadLogonL()<"), RThread().Id().operator TUint()));
+    UpdateExpectedFrameSizeL();
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSinkThreadLogonL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSinkThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseSinkThreadLogoff()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSinkThreadLogoff()<"), RThread().Id().operator TUint()));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSinkThreadLogoff()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseUpdateSinkParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseUpdateSinkParamsL()<"), RThread().Id().operator TUint()));
+    iNewParams = static_cast< const TDisplaySinkParamsDP& >( aParams );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseUpdateSinkParamsL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseDoUpdateParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseDoUpdateParamsL()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseDoUpdateParamsL()<"), RThread().Id().operator TUint()));
+    iBitmapTable[ EFirstBitmap ].iBuffer = iNewParams.iPostingBuffer1;
+    iBitmapTable[ ESecondBitmap ].iBuffer = iNewParams.iPostingBuffer2;
+    UpdateExpectedFrameSizeL();
+    if( iNewParams.iFrameRateLimit != iFrameRateInterval )
+        {
+        SetFrameRateLimit( iNewParams.iFrameRateLimit );
+        ResetFrameRateLimitter();
+        }
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseDoUpdateParamsL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseSetVideoFrameSizeL( const TSize& )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSizesMatch
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkDP::BaseSizesMatch( const TSize& aSize )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSizesMatch()<"), RThread().Id().operator TUint()));
+    TBool sizesMatch( iExpectedFrameSize == aSize );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSizesMatch() %d>"), RThread().Id().operator TUint(), sizesMatch));
+    return sizesMatch;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BitmapEntry
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::TBitmapEntry& CDisplaySinkDP::BitmapEntry( TInt aIndex )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BitmapEntry(%d)<"), RThread().Id().operator TUint(), aIndex));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BitmapEntry()>"), RThread().Id().operator TUint()));
+    return iBitmapTable[ aIndex ];
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseEmptyBufferL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseEmptyBufferL()<"), RThread().Id().operator TUint()));
+    if ( BaseConvert( aVTMMFBuffer ) )
+        {
+        CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+        iSupplier->BufferEmptiedL( iBuffer );
+        }
+    else
+        {
+        if ( iVideoFrameQueue->IsStored() || !IsOkToSendFrame() )
+            {
+            CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+            iSupplier->BufferEmptiedL( iBuffer );
+            }
+        else
+            {
+            iVideoFrameQueue->Store( *iSupplier, static_cast<CMMFDataBuffer*>(aVTMMFBuffer.GetMMFBuffer()), aVTMMFBuffer.GetFrameSize(), aVTMMFBuffer.Data() );
+            CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+            }
+        }
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseEmptyBufferL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseSetBitmapAvailable( TBitmapNo aBitmapNo )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseSetBitmapAvailable( TBitmapNo )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSetBitmapAvailable()<"), RThread().Id().operator TUint()));
+	NextFrame();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseSetBitmapAvailable()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::BaseVideoFrameSizeChangedL( const TSize& )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::BaseVideoFrameSizeChangedL( const TSize& )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseVideoFrameSizeChangedL()<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::BaseVideoFrameSizeChangedL()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::NextFrame
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::NextFrame()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::NextFrame()<"), RThread().Id().operator TUint()));
+    if ( iVideoFrameQueue->IsStored() )
+        {
+        if ( IsOkToSendFrame() )
+        	{
+        	BaseConvert( iVideoFrameQueue->Buffer() );
+        	}
+        iVideoFrameQueue->Release();
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::NextFrame()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::UpdateExpectedFrameSizeL()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDP::UpdateExpectedFrameSizeL()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::UpdateExpectedFrameSizeL()<"), RThread().Id().operator TUint()));
+    iExpectedFrameSize = iNewParams.iFrameSize;
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDP::UpdateExpectedFrameSizeL()>"), RThread().Id().operator TUint()));
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CDisplaySinkDSA.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,464 @@
+/*
+* 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:  Display Sink subsystem for Direct Screen Access.
+*
+*/
+
+
+// INCLUDES
+
+#include <cvtimageconverter.h>
+#include <cvtimageiyuv.h>
+#include "CDisplaySinkDSA.h"
+#include "TDisplaySinkParamsDSA.h"
+
+// MACROS
+
+#ifdef _DEBUG
+    #include <e32debug.h>
+    #define PRINT RDebug::Print
+    #define _IFDBG(a) a
+#else
+    #define PRINT
+    #define _IFDBG(a)
+#endif
+
+// ======================== CDisplaySinkDSA ==============================
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDSA* CDisplaySinkDSA::NewL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::NewL()<"), RThread().Id().operator TUint()));
+    CDisplaySinkDSA* self = new ( ELeave ) CDisplaySinkDSA();
+    CleanupStack::PushL( self );
+    self->ConstructL( aParams, aInitData );
+    CleanupStack::Pop(); // self
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::NewL()>"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::CDisplaySinkDSA
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDSA::CDisplaySinkDSA()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::Ctor<"), RThread().Id().operator TUint()));
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::Ctor>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::~CDisplaySinkDSA
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkDSA::~CDisplaySinkDSA()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::~<"), RThread().Id().operator TUint()));
+    delete iRotator;
+    delete iYUVBitmapConverterVT;
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::~>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseConstructL( TDisplaySinkParams& aParams,
+    const TDesC8& )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConstructL()<"), RThread().Id().operator TUint()));
+	iNewParams = static_cast< TDisplaySinkParamsDSA& > ( aParams );
+	if ( !iNewParams.iBitmap1Handle || !iNewParams.iBitmap2Handle )
+	    {
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConstructL() bitmap handle NULL!") ));
+	    User::Leave( KErrArgument );
+	    }
+    iBitmapTable[EFirstBitmap].iHandle = iNewParams.iBitmap1Handle;
+	iBitmapTable[ESecondBitmap].iHandle = iNewParams.iBitmap2Handle;
+    iRotator = CVtImageRotator::NewL( *this );
+    iRotationAngle = iNewParams.iRotationAngle;
+    iYUVBitmapConverterVT = CVTIYUVFbsBitmapConverter::NewL(
+        QCIF, iBitmapTable[EFirstBitmap].iHandle );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConstructL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseConvert
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkDSA::BaseConvert( const TVtMMFDataBuffer& aBuffer )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConvert()<"), RThread().Id().operator TUint()));
+    TBool converted( EFalse );
+    TRAPD( err, ConvertL( aBuffer.Data(), converted ) );
+    if ( err != KErrNone )
+        {
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConvert() err=%d"), RThread().Id().operator TUint(), err));
+        converted = EFalse;
+        }
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseConvert() %d>"), RThread().Id().operator TUint(), converted));
+    return converted;
+    }
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSinkThreadLogonL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseSinkThreadLogonL()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogonL()<"), RThread().Id().operator TUint()));
+    CVTYUVFbsBitmapConverter* converter1 =
+	    CVTIYUVFbsBitmapConverter::NewL(
+	        QCIF,
+	        iBitmapTable[EFirstBitmap].iHandle );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogonL() 1"), RThread().Id().operator TUint()));
+	CleanupStack::PushL( converter1 );
+    CVTYUVFbsBitmapConverter* converter2 =
+	    CVTIYUVFbsBitmapConverter::NewL(
+	        QCIF,
+	        iBitmapTable[ESecondBitmap].iHandle );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogonL() 2"), RThread().Id().operator TUint()));
+	CleanupStack::PushL( converter2 );
+    CleanupStack::Pop( 2 ); // converter1, converter2
+    iYUVBitmapConverter1 = converter1;
+	iYUVBitmapConverter2 = converter2;
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogonL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSinkThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseSinkThreadLogoff()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogoff()<"), RThread().Id().operator TUint()));
+	delete iYUVBitmapConverter1;
+	delete iYUVBitmapConverter2;
+    delete iSourceImg; iSourceImg = 0;
+    delete iTargetImg; iTargetImg = 0;
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSinkThreadLogoff()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseUpdateSinkParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseUpdateSinkParamsL()<"), RThread().Id().operator TUint()));
+    iNewParams = static_cast< const TDisplaySinkParamsDSA& >( aParams );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseUpdateSinkParamsL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseDoUpdateParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseDoUpdateParamsL()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseDoUpdateParamsL()<"), RThread().Id().operator TUint()));
+    iRotationAngle = iNewParams.iRotationAngle;
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseDoUpdateParamsL() handle1=%d"), RThread().Id().operator TUint(), iNewParams.iBitmap1Handle));
+    iBitmapTable[ EFirstBitmap ].iHandle = iNewParams.iBitmap1Handle;
+    iBitmapTable[ EFirstBitmap ].iIsFree = ETrue;
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseDoUpdateParamsL() handle2=%d"), RThread().Id().operator TUint(), iNewParams.iBitmap2Handle));
+    iBitmapTable[ ESecondBitmap ].iHandle = iNewParams.iBitmap2Handle;
+    iBitmapTable[ ESecondBitmap ].iIsFree = EFalse;
+    UpdateExpectedFrameSizeL();
+    iYUVBitmapConverter1->SetSourceSizeL( iExpectedFrameSize );
+    iYUVBitmapConverter1->SetDestinationL( iNewParams.iBitmap1Handle );
+    iYUVBitmapConverter2->SetSourceSizeL( iExpectedFrameSize );
+    iYUVBitmapConverter2->SetDestinationL( iNewParams.iBitmap2Handle );
+    if( iNewParams.iFrameRateLimit != iFrameRateInterval )
+        {
+        SetFrameRateLimit( iNewParams.iFrameRateLimit );
+        ResetFrameRateLimitter();
+        }
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseDoUpdateParamsL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseSetVideoFrameSizeL( const TSize& aSize )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+    TSize size( aSize );
+    if( ( iRotationAngle == CVtImageRotator::E90DegreesClockwise ) ||
+        ( iRotationAngle == CVtImageRotator::E270DegreesClockwise ) )
+        {
+        size = TSize( aSize.iHeight, aSize.iWidth );
+        }
+    iYUVBitmapConverter1->SetSourceSizeL( size );
+    iYUVBitmapConverter2->SetSourceSizeL( size );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSizesMatch
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkDSA::BaseSizesMatch( const TSize& aSize )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSizesMatch()<"), RThread().Id().operator TUint()));
+    TBool sizesMatch( iExpectedFrameSize == aSize );
+    TBool rotateChangesDimension(
+        ( iRotationAngle == CVtImageRotator::E90DegreesClockwise ) ||
+        ( iRotationAngle == CVtImageRotator::E270DegreesClockwise ) );
+    if( rotateChangesDimension )
+        {
+        sizesMatch =
+            ( iExpectedFrameSize.iWidth == aSize.iHeight ) &&
+            ( iExpectedFrameSize.iHeight == aSize.iWidth );
+        }
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSizesMatch() %d>"), RThread().Id().operator TUint(), sizesMatch));
+    return sizesMatch;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BitmapEntry
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::TBitmapEntry& CDisplaySinkDSA::BitmapEntry( TInt aIndex )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BitmapEntry(%d)<"), RThread().Id().operator TUint(), aIndex));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BitmapEntry()>"), RThread().Id().operator TUint()));
+    return iBitmapTable[ aIndex ];
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseEmptyBufferL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseEmptyBufferL()<"), RThread().Id().operator TUint()));
+    if( iRotationAngle != CVtImageRotator::ERotationNone )
+        {
+        TSize size( aVTMMFBuffer.GetFrameSize() );
+        TInt length( ( size.iWidth * size.iHeight * 12 ) / 8 );
+        // Modifiable pointer descriptor needed, we don't want a copy of image!
+        TPtr8 ptrData( const_cast< TUint8* >(
+            aVTMMFBuffer.Data().Ptr() ), length, length );
+
+        if( iSourceImg == 0 )
+            {
+            // If source image is not created -> create it
+            iSourceImg = CVtImageIYUV::NewL( size, ptrData );
+            }
+        else
+            {
+            // otherwise just update the data
+            if( iSourceImg->Size() == size )
+                {
+                iSourceImg->SetImageL( ptrData );
+                }
+            else
+                {
+                delete iSourceImg; iSourceImg = 0;
+                iSourceImg = CVtImageIYUV::NewL( size, ptrData );
+                }
+            }
+        iRotator->RotateL( *iSourceImg, *iTargetImg, iRotationAngle );
+        CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+        }
+    else
+        {
+        if ( BaseConvert( aVTMMFBuffer ) )
+            {
+            CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+            iSupplier->BufferEmptiedL( iBuffer );
+            }
+        else
+            {
+            if ( iVideoFrameQueue->IsStored() || !IsOkToSendFrame() )
+                {
+                CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+                iSupplier->BufferEmptiedL( iBuffer );
+                }
+            else
+                {
+                iVideoFrameQueue->Store( *iSupplier, static_cast<CMMFDataBuffer*>(aVTMMFBuffer.GetMMFBuffer()),  aVTMMFBuffer.GetFrameSize(), aVTMMFBuffer.Data());
+                CleanupStack::PopAndDestroy();
+                }
+            }
+        }
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseEmptyBufferL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseSetBitmapAvailable( TBitmapNo aBitmapNo )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseSetBitmapAvailable( TBitmapNo aBitmapNo )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable()<"), RThread().Id().operator TUint()));
+    if ( iVideoFrameQueue->IsStored() )
+        {
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable() buffer pending"), RThread().Id().operator TUint()));
+        if ( !iReleased && ( *iRequestStatusPtr == KRequestPending ) && IsOkToSendFrame() )
+    		{
+            TRAPD( result, {
+                iYUVBitmapConverterVT->SetDestinationL(
+                    iBitmapTable[ aBitmapNo ].iHandle );
+                iYUVBitmapConverterVT->SetSourceL(
+	                iVideoFrameQueue->Buffer().Data() );
+                iYUVBitmapConverterVT->ProcessL();
+                } );
+            if ( result == KErrNone )
+                {
+                _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable() conversion succeeded!"), RThread().Id().operator TUint()));
+        		iBitmapTable[ aBitmapNo ].iIsFree = EFalse;
+        		TRequestStatus* statusP = iRequestStatusPtr;
+        		iThread.RequestComplete( statusP, aBitmapNo );
+        	    }
+        	else
+        	    {
+                _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable() conversion failed!"), RThread().Id().operator TUint()));
+        	    // Drop frame
+        	    }
+    		}
+        else
+            {
+            _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable() dropping frame"), RThread().Id().operator TUint()));
+            // Drop frame
+            }
+        iVideoFrameQueue->Release();
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseSetBitmapAvailable()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::BaseVideoFrameSizeChangedL( const TSize& aNewSize )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::BaseVideoFrameSizeChangedL( const TSize& aNewSize )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseVideoFrameSizeChangedL()<"), RThread().Id().operator TUint()));
+	iYUVBitmapConverterVT->SetSourceSizeL( aNewSize );
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::BaseVideoFrameSizeChangedL()>"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::UpdateExpectedFrameSizeL()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::UpdateExpectedFrameSizeL()
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::UpdateExpectedFrameSizeL()<"), RThread().Id().operator TUint()));
+    CFbsBitmap* bm = new ( ELeave ) CFbsBitmap();
+    CleanupStack::PushL( bm );
+    User::LeaveIfError( bm->Duplicate( iBitmapTable[ EFirstBitmap ].iHandle ) );
+    iExpectedFrameSize = bm->SizeInPixels();
+    User::LeaveIfError( bm->Duplicate( iBitmapTable[ ESecondBitmap ].iHandle ) );
+    if( iExpectedFrameSize != bm->SizeInPixels() )
+        {
+    	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::UpdateExpectedFrameSizeL(): EFirstBitmap size is different from ESecondBitmap size -> Leave()"), RThread().Id().operator TUint()));
+        User::Leave( KErrNotSupported );
+        }
+    CleanupStack::PopAndDestroy(); // bm
+    delete iTargetImg; iTargetImg = 0;
+    iTargetImg = CVtImageIYUV::NewL( iExpectedFrameSize );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::UpdateExpectedFrameSizeL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::RotationFinished( TInt aError )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::RotationFinished( TInt aError )
+    {
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::RotationFinished()<"), RThread().Id().operator TUint()));
+    // Rotation finished .. do something
+    if( aError == KErrNone )
+        {
+        iBitmapCS.Wait();
+        TBool converted( EFalse );
+        TRAP( aError, ConvertL( iTargetImg->Image(), converted ) );
+        iBitmapCS.Signal();
+        TRAPD( aError2, iSupplier->BufferEmptiedL( iBuffer ) );
+        if( ( aError != KErrNone ) || ( aError2 != KErrNone  ) )
+            {
+            *iRequestStatusPtr = KRequestPending;
+		    TRequestStatus* statusP = iRequestStatusPtr;
+		    iThread.RequestComplete( statusP, aError );
+            }
+        }
+    else
+        {
+        *iRequestStatusPtr = KRequestPending;
+		TRequestStatus* statusP = iRequestStatusPtr;
+		iThread.RequestComplete( statusP, aError );
+        }
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::RotationFinished()>"), RThread().Id().operator TUint()));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::ConvertL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::ConvertL( const TPtrC8& aBuffer, TBool& aConverted )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::ConvertL()<"), RThread().Id().operator TUint()));
+    TBitmapNo bitmapNo( iBitmapTable[ EFirstBitmap ].iIsFree ? EFirstBitmap : ESecondBitmap );
+    if ( iBitmapTable[ bitmapNo ].iIsFree &&
+         !iReleased &&
+         ( *iRequestStatusPtr == KRequestPending ) )
+		{
+		DoConvertL( aBuffer, bitmapNo );
+    	aConverted = ETrue;
+		iBitmapTable[ bitmapNo ].iIsFree = EFalse;
+		TRequestStatus* statusP = iRequestStatusPtr;
+		iThread.RequestComplete( statusP, bitmapNo );
+		}
+    else
+        {
+    	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::ConvertL(): could not find free bitmap"), RThread().Id().operator TUint()));
+    	aConverted = EFalse;
+        }
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::ConvertL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDSA::DoConvert
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkDSA::DoConvertL( const TPtrC8& aBuffer, TBitmapNo aBitmapNo )
+	{
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::DoConvertL()<"), RThread().Id().operator TUint()));
+	CVTYUVFbsBitmapConverter* c = 0;
+	switch( aBitmapNo )
+		{
+		case EFirstBitmap:
+			c = iYUVBitmapConverter1;
+			break;
+
+		case ESecondBitmap:
+			c = iYUVBitmapConverter2;
+			break;
+
+        default:
+            User::Leave( KErrArgument );
+		};
+	c->SetSourceL( aBuffer );
+	c->ProcessL();
+	_IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkDSA::DoConvertL()>"), RThread().Id().operator TUint()));
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CDisplaySinkNGA.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,818 @@
+/*
+* 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:  Class for CDisplaySinkNGA.
+*
+*/
+
+// INCLUDE FILES
+
+#include "CDisplaySinkNGA.h"
+
+// MACROS
+
+#ifdef _DEBUG
+    #include <e32debug.h>
+    #define PRINT RDebug::Print
+    #define _IFDBG(a) a
+#else
+    #define PRINT
+    #define _IFDBG(a)
+#endif
+
+ static const TUint8 NGA_COFF_TBL_64K[ 220 ]=
+    {
+    0xe9,0x66,0x01,0x00,    // KRedCrFactor
+    0x1a,0x58,0x00,0x00,    // KGreenCbFactor
+    0xd2,0xb6,0x00,0x00,    // KGreenCrFactor
+    0xa2,0xc5,0x01,0x00,    // KBlueCbFactor
+
+    0x00,0x00,0x00,0x00,    // 5-bit
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x01,0x02,0x03,
+    0x04,0x05,0x06,0x07,
+    0x08,0x09,0x0a,0x0b,
+    0x0c,0x0d,0x0e,0x0f,
+    0x10,0x11,0x12,0x13,
+    0x14,0x15,0x16,0x17,
+    0x18,0x19,0x1a,0x1b,
+    0x1c,0x1d,0x1e,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+
+    0x00,0x00,0x00,0x00,    // 6-bit
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x01,0x02,0x03,
+    0x04,0x05,0x06,0x07,
+    0x08,0x09,0x0a,0x0b,
+    0x0c,0x0d,0x0e,0x0f,
+    0x10,0x11,0x12,0x13,
+    0x14,0x15,0x16,0x17,
+    0x18,0x19,0x1a,0x1b,
+    0x1c,0x1d,0x1e,0x1f,
+    0x20,0x21,0x22,0x23,
+    0x24,0x25,0x26,0x27,
+    0x28,0x29,0x2a,0x2b,
+    0x2c,0x2d,0x2e,0x2f,
+    0x30,0x31,0x32,0x33,
+    0x34,0x35,0x36,0x37,
+    0x38,0x39,0x3a,0x3b,
+    0x3c,0x3d,0x3e,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f
+    };
+
+ 
+ const TUint8 NGA_COFF_TBL_16M[ 528 ] =
+     {
+     0xe9,0x66,0x01,0x00,    // KRedCrFactor
+     0x1a,0x58,0x00,0x00,    // KGreenCbFactor
+     0xd2,0xb6,0x00,0x00,    // KGreenCrFactor
+     0xa2,0xc5,0x01,0x00,    // KBlueCbFactor
+
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+     0x00,0x00,0x00,0x00,
+
+     0x00,0x01,0x02,0x03,    // 8-bit
+     0x04,0x05,0x06,0x07,
+     0x08,0x09,0x0a,0x0b,
+     0x0c,0x0d,0x0e,0x0f,
+
+     0x10,0x11,0x12,0x13,
+     0x14,0x15,0x16,0x17,
+     0x18,0x19,0x1a,0x1b,
+     0x1c,0x1d,0x1e,0x1f,
+
+     0x20,0x21,0x22,0x23,
+     0x24,0x25,0x26,0x27,
+     0x28,0x29,0x2a,0x2b,
+     0x2c,0x2d,0x2e,0x2f,
+
+     0x30,0x31,0x32,0x33,
+     0x34,0x35,0x36,0x37,
+     0x38,0x39,0x3a,0x3b,
+     0x3c,0x3d,0x3e,0x3f,
+
+     0x40,0x41,0x42,0x43,
+     0x44,0x45,0x46,0x47,
+     0x48,0x49,0x4a,0x4b,
+     0x4c,0x4d,0x4e,0x4f,
+
+     0x50,0x51,0x52,0x53,
+     0x54,0x55,0x56,0x57,
+     0x58,0x59,0x5a,0x5b,
+     0x5c,0x5d,0x5e,0x5f,
+
+     0x60,0x61,0x62,0x63,
+     0x64,0x65,0x66,0x67,
+     0x68,0x69,0x6a,0x6b,
+     0x6c,0x6d,0x6e,0x6f,
+
+     0x70,0x71,0x72,0x73,
+     0x74,0x75,0x76,0x77,
+     0x78,0x79,0x7a,0x7b,
+     0x7c,0x7d,0x7e,0x7f,
+
+     0x80,0x81,0x82,0x83,
+     0x84,0x85,0x86,0x87,
+     0x88,0x89,0x8a,0x8b,
+     0x8c,0x8d,0x8e,0x8f,
+
+     0x90,0x91,0x92,0x93,
+     0x94,0x95,0x96,0x97,
+     0x98,0x99,0x9a,0x9b,
+     0x9c,0x9d,0x9e,0x9f,
+
+     0xa0,0xa1,0xa2,0xa3,
+     0xa4,0xa5,0xa6,0xa7,
+     0xa8,0xa9,0xaa,0xab,
+     0xac,0xad,0xae,0xaf,
+
+     0xb0,0xb1,0xb2,0xb3,
+     0xb4,0xb5,0xb6,0xb7,
+     0xb8,0xb9,0xba,0xbb,
+     0xbc,0xbd,0xbe,0xbf,
+
+     0xc0,0xc1,0xc2,0xc3,
+     0xc4,0xc5,0xc6,0xc7,
+     0xc8,0xc9,0xca,0xcb,
+     0xcc,0xcd,0xce,0xcf,
+
+     0xd0,0xd1,0xd2,0xd3,
+     0xd4,0xd5,0xd6,0xd7,
+     0xd8,0xd9,0xda,0xdb,
+     0xdc,0xdd,0xde,0xdf,
+
+     0xe0,0xe1,0xe2,0xe3,
+     0xe4,0xe5,0xe6,0xe7,
+     0xe8,0xe9,0xea,0xeb,
+     0xec,0xed,0xee,0xef,
+
+     0xf0,0xf1,0xf2,0xf3,
+     0xf4,0xf5,0xf6,0xf7,
+     0xf8,0xf9,0xfa,0xfb,
+     0xfc,0xfd,0xfe,0xff,
+
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff,
+     0xff,0xff,0xff,0xff
+     };
+
+
+ void ConvertFrom420PlanarToRGB_565(
+         const TDesC8& aSource,
+         const TSize& aSize,
+         TDes8& aTarget,
+         TInt aStride )
+     {
+     TInt height( aSize.iHeight >> 1 );
+     TInt width( aSize.iWidth );
+
+     TInt ySize = aSize.iWidth * aSize.iHeight;
+     TInt ySizeDiv4 = ( ySize >> 2 );
+
+     const TUint32* y1 = reinterpret_cast< const TUint32* >( aSource.Mid( 0, ySize ).Ptr() );
+     const TUint32* u = reinterpret_cast< const TUint32* >( aSource.Mid( ySize, ySizeDiv4 ).Ptr() );
+     const TUint32* v = reinterpret_cast< const TUint32* >( aSource.Mid( ySize + ySizeDiv4, ySizeDiv4 ).Ptr() );    
+     
+     TUint32 uintsPerDestRow = aStride >> 2;
+     
+     const TUint32* TargetPtr =  reinterpret_cast< const TUint32* >( aTarget.Ptr() );
+     
+     TUint32* d1 = const_cast< TUint32* >( TargetPtr );    
+     
+     TUint32 ywidth = width >> 2;
+
+     width >>= 3;
+
+     TInt32 cb;
+     TInt32 cr;
+     TInt32 greenCbCr;
+     TInt32 yy;
+     TInt32 red;
+     TInt32 green;
+     TInt32 blue;
+     TUint32 r1;
+     const TUint8* clip = NGA_COFF_TBL_64K + 40;
+
+     for( TInt y = 0; y < height; y++ )
+         {
+         for( TInt x = 0; x < width; x++ )
+             {
+             TUint32 u1 = *u++;
+             TUint32 v1 = *v++;
+
+             for( TInt c2 = 0; c2 < 2; c2++ )
+                 {
+                 TUint32 yy2 = y1[ ywidth ];
+                 TUint32 yy1 = *y1++;
+
+                 for( TInt c = 0; c < 2; c++ )
+                     {
+                     cb = TInt32( u1 & 0xff ) - 128;
+                     u1 >>= 8;
+                     cr = TInt32( v1 & 0xff ) - 128;
+                     v1 >>= 8;
+
+                     greenCbCr =
+                         (
+                         cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+                         cb * *reinterpret_cast< const TInt32* >( clip - 36 )
+                         ) >> 16;
+                     cr =
+                         (
+                         cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+                         ) >> 16;
+                     cb =
+                         (
+                         cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+                         ) >> 16;
+
+                     // lower left
+                     yy = ( yy2 & 0xff );
+                     yy2 >>= 8;
+
+                     red = yy + cr;
+                     green = yy - greenCbCr;
+                     blue = yy + cb;
+
+                     red = clip[ red >> 4 ];
+                     green = clip[ green >> 4 ];
+                     blue = clip[ blue >> 4 ];
+
+                     // RGB_444
+                     r1 = green | ( red << 4 );
+                     r1 = blue | ( r1 << 4 );
+
+                     // lower right
+                     yy = ( yy2 & 0xff );
+                     yy2 >>= 8;
+
+                     red = yy + cr;
+                     green = yy - greenCbCr;
+                     blue = yy + cb;
+
+                     red = clip[ red >> 4 ];
+                     green = clip[ green >> 4 ];
+                     blue = clip[ blue >> 4 ];
+
+                     // RGB_444
+                     r1 |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+                     d1[ uintsPerDestRow ] = r1;
+
+                     // upper left
+                     yy = ( yy1 & 0xff );
+                     yy1 >>= 8;
+
+                     red = yy + cr;
+                     green = yy - greenCbCr;
+                     blue = yy + cb;
+
+                     red = clip[ red >> 4 ];
+                     green = clip[ green >> 4 ];
+                     blue = clip[ blue >> 4 ];
+
+                     // RGB_444
+                     r1 = green | ( red << 4 );
+                     r1 = blue | ( r1 << 4 );
+
+                     // upper right
+                     yy = ( yy1 & 0xff );
+                     yy1 >>= 8;
+
+                     red = yy + cr;
+                     green = yy - greenCbCr;
+                     blue = yy + cb;
+
+                     red = clip[ red >> 4 ];
+                     green = clip[ green >> 4 ];
+                     blue = clip[ blue >> 4 ];
+
+                     // RGB_444
+                     r1 |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+                     *d1++ = r1;
+                     }
+                 }
+             }
+
+         y1 += ( width << 1 );
+         d1 += uintsPerDestRow;
+         }     
+     }
+ 
+ 
+ void ConvertFrom420PlanarToXRGB_8888(
+          const TDesC8& aSource,
+          const TSize& aSize,
+          TDes8& aTarget,
+          TInt aStride )
+     {
+     
+     TInt height( aSize.iHeight >> 1 );
+     TInt width( aSize.iWidth );
+     
+     TInt ySize = aSize.iWidth * aSize.iHeight;
+     TInt ySizeDiv4 = ( ySize >> 2 );
+
+     const TUint32* y1 = reinterpret_cast< const TUint32* >( aSource.Mid( 0, ySize ).Ptr() );
+     const TUint32* u = reinterpret_cast< const TUint32* >( aSource.Mid( ySize, ySizeDiv4 ).Ptr() );
+     const TUint32* v = reinterpret_cast< const TUint32* >( aSource.Mid( ySize + ySizeDiv4, ySizeDiv4 ).Ptr() );
+     
+     TUint32 uintsPerDestRow = aStride >> 2;
+
+     const TUint32* TargetPtr =  reinterpret_cast< const TUint32* >( aTarget.Ptr() );
+     
+     TUint32* d1 = const_cast< TUint32* >( TargetPtr );    
+
+
+     TUint32 ywidth = width >> 2;
+
+     width >>= 3;
+
+     TInt32 cb;
+     TInt32 cr;
+     TInt32 greenCbCr;
+     TInt32 yy;
+     TUint32 p;
+     const TUint8* clip = NGA_COFF_TBL_16M + 144;
+
+     for( TInt y = 0; y < height; y++ )
+         {
+         for( TInt x = 0; x < width; x++ )
+             {
+             TUint32 u1 = *u++;
+             TUint32 v1 = *v++;
+
+             for( TInt c2 = 0; c2 < 2; c2++ )
+                 {
+                 TUint32 yy2 = y1[ ywidth ];
+                 TUint32 yy1 = *y1++;
+
+                 for( TInt c = 0; c < 2; c++ )
+                     {
+                     cb = TInt32( u1 & 0xff ) - 128;
+                     u1 >>= 8;
+                     cr = TInt32( v1 & 0xff ) - 128;
+                     v1 >>= 8;
+
+                     greenCbCr =
+                         (
+                         cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+                         cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+                         ) >> 16;
+                     cr =
+                         (
+                         cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+                         ) >> 16;
+                     cb =
+                         (
+                         cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+                         ) >> 16;
+
+                     // lower left
+                     yy = ( yy2 & 0xff );
+                     yy2 >>= 8;
+
+                     // 0xffBBGG
+                     p = 0xff0000 |
+                         ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+                     // 0xffBBGGRR
+                     d1[ uintsPerDestRow ] = clip[ yy + cb ] | ( p << 8 );
+
+                     // lower right
+                     yy = ( yy2 & 0xff );
+                     yy2 >>= 8;
+
+                     // 0xffBBGG
+                     p = 0xff0000 |
+                         ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+                     // 0xffBBGGRR
+                     d1[ uintsPerDestRow + 1 ] = clip[ yy + cb ] | ( p << 8 );
+
+                     // upper left
+                     yy = ( yy1 & 0xff );
+                     yy1 >>= 8;
+
+                     // 0xffBBGG
+                     p = 0xff0000 |
+                         ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+                     // 0xffBBGGRR
+                     *d1++ = clip[ yy + cb ] | ( p << 8 );
+
+                     // upper right
+                     yy = ( yy1 & 0xff );
+                     yy1 >>= 8;
+
+                     // 0xffBBGG
+                     p = 0xff0000 |
+                         ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+                     // 0xffBBGGRR
+                     *d1++ = clip[ yy + cb ] | ( p << 8 );
+                     }
+                 }
+             }
+
+         y1 += ( width << 1 );
+         d1 += uintsPerDestRow;
+         }  
+     
+     }
+  
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkNGA* CDisplaySinkNGA::NewL( TDisplaySinkParams& aParams,
+        const TDesC8& aInitData )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::NewL()<"), RThread().Id().operator TUint()));
+    CDisplaySinkNGA* self = new ( ELeave ) CDisplaySinkNGA();
+    CleanupStack::PushL( self );
+    self->ConstructL( aParams, aInitData );
+    CleanupStack::Pop(); // self
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::NewL()>"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::CDisplaySinkNGA
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkNGA::CDisplaySinkNGA()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::Ctor<"), RThread().Id().operator TUint()));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::Ctor>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::~CDisplaySinkNGA
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkNGA::~CDisplaySinkNGA()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::~<"), RThread().Id().operator TUint()));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::~>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseConstructL( TDisplaySinkParams& aParams,
+    const TDesC8& )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConstructL()<"), RThread().Id().operator TUint()));
+    iNewParams = static_cast< const TDisplaySinkParamsNGA& >( aParams );
+    if ( !iNewParams.iSurfaceBuffer1 || !iNewParams.iSurfaceBuffer2 )
+        {
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConstructL() surface buffer is NULL!")));
+        User::Leave( KErrArgument );
+        }
+    iBitmapTable[EFirstBitmap].iBuffer = iNewParams.iSurfaceBuffer1;
+    iBitmapTable[ESecondBitmap].iBuffer = iNewParams.iSurfaceBuffer2;    
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConstructL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseConvert
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkNGA::BaseConvert( const TVtMMFDataBuffer& aBuffer )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert()<"), RThread().Id().operator TUint()));
+    
+    TBool consumed( ETrue );
+    TBitmapNo bitmapNo( iBitmapTable[ EFirstBitmap ].iIsFree ? EFirstBitmap : ESecondBitmap );
+    if ( iBitmapTable[ bitmapNo ].iIsFree &&
+         !iReleased &&
+         ( *iRequestStatusPtr == KRequestPending ) )
+        {
+#if 1        
+        TInt bufferLength(
+             //iNewParams.iFrameSize.iHeight * ( iNewParams.iFrameSize.iWidth * 2 ) );
+             iNewParams.iFrameSize.iHeight * ( iNewParams.iFrameSize.iWidth * 3/2 ) );
+#else
+        TInt bufferLength(
+             iNewParams.iFrameSize.iHeight * ( iNewParams.iFrameSize.iWidth * 4 ) );
+#endif             
+
+        TPtr8 ptrBuffer(
+                *iBitmapTable[ bitmapNo ].iBuffer,
+            bufferLength,
+            bufferLength
+            );
+
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert(): buffer %d: $%x %d bytes"), RThread().Id().operator TUint(), bitmapNo, *iBitmapTable[ bitmapNo ].iBuffer, bufferLength));
+
+        // Determine wether to convert or copy (420 will be just copied)
+        //if ( iNewParams.iSurfaceFormat ==  EUidPixelFormatRGB_565 )
+        if ( iNewParams.iSurfaceFormat ==  EUidPixelFormatXRGB_8888 )
+            {
+            _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert(): converting to RGB565"), RThread().Id().operator TUint()));
+
+            /*
+            ConvertFrom420PlanarToRGB_565(
+                    aBuffer.Data(),
+                    aBuffer.GetFrameSize(),
+                    ptrBuffer,
+                    iNewParams.iFrameSize.iWidth * 2 );
+                    */
+            
+            ConvertFrom420PlanarToXRGB_8888(
+                    aBuffer.Data(),
+                    aBuffer.GetFrameSize(),
+                    ptrBuffer,
+                    iNewParams.iFrameSize.iWidth * 4 );
+            
+            }
+        else
+            {
+            _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert(): copying as 420"), RThread().Id().operator TUint()));
+            ptrBuffer = aBuffer.Data();
+            }
+
+        iBitmapTable[ bitmapNo ].iIsFree = EFalse;
+        TRequestStatus* statusP = iRequestStatusPtr;
+        iThread.RequestComplete( statusP, bitmapNo );
+        }
+    else
+        {
+        consumed = EFalse;
+        _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert(): could not find free buffer"), RThread().Id().operator TUint()));
+        }
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseConvert()>"), RThread().Id().operator TUint()));
+    return consumed;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSinkThreadLogonL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseSinkThreadLogonL()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSinkThreadLogonL()<"), RThread().Id().operator TUint()));
+    UpdateExpectedFrameSizeL();
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSinkThreadLogonL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSinkThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseSinkThreadLogoff()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSinkThreadLogoff()<"), RThread().Id().operator TUint()));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSinkThreadLogoff()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseUpdateSinkParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseUpdateSinkParamsL( const TDisplaySinkParams& aParams )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseUpdateSinkParamsL()<"), RThread().Id().operator TUint()));
+    iNewParams = static_cast< const TDisplaySinkParamsNGA& >( aParams );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseUpdateSinkParamsL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseDoUpdateParamsL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseDoUpdateParamsL()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseDoUpdateParamsL()<"), RThread().Id().operator TUint()));
+    iBitmapTable[ EFirstBitmap ].iBuffer = iNewParams.iSurfaceBuffer1;
+    iBitmapTable[ ESecondBitmap ].iBuffer = iNewParams.iSurfaceBuffer2;
+    UpdateExpectedFrameSizeL();
+    if( iNewParams.iFrameRateLimit != iFrameRateInterval )
+        {
+        SetFrameRateLimit( iNewParams.iFrameRateLimit );
+        ResetFrameRateLimitter();
+        }    
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseDoUpdateParamsL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseSetVideoFrameSizeL( const TSize& )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSetVideoFrameSizeL()<"), RThread().Id().operator TUint()));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSetVideoFrameSizeL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSizesMatch
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkNGA::BaseSizesMatch( const TSize& aSize)
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSizesMatch()<"), RThread().Id().operator TUint()));
+    TBool sizesMatch( iExpectedFrameSize == aSize );
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSizesMatch()>"), RThread().Id().operator TUint()));
+    return sizesMatch;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BitmapEntry
+// -----------------------------------------------------------------------------
+//
+CDisplaySink::TBitmapEntry& CDisplaySinkNGA::BitmapEntry( TInt aIndex )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BitmapEntry(%d)<"), RThread().Id().operator TUint(), aIndex));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BitmapEntry()>"), RThread().Id().operator TUint()));
+    return iBitmapTable[ aIndex ];
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseEmptyBufferL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseEmptyBufferL( TVtMMFDataBuffer& aVTMMFBuffer )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseEmptyBufferL()<"), RThread().Id().operator TUint()));
+    if ( BaseConvert( aVTMMFBuffer ) )
+        {
+        CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+        iSupplier->BufferEmptiedL( iBuffer );
+        }
+    else
+        {
+        if ( iVideoFrameQueue->IsStored() || !IsOkToSendFrame() )
+            {
+            CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+            iSupplier->BufferEmptiedL( iBuffer );
+            }
+        else
+            {
+            iVideoFrameQueue->Store( *iSupplier, static_cast<CMMFDataBuffer*>(aVTMMFBuffer.GetMMFBuffer()),  aVTMMFBuffer.GetFrameSize(), aVTMMFBuffer.Data());
+            CleanupStack::PopAndDestroy(); // iBitmapCS.Signal();
+            }
+        }    
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseEmptyBufferL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseSetBitmapAvailable( TBitmapNo aBitmapNo )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseSetBitmapAvailable( TBitmapNo )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSetBitmapAvailable()<"), RThread().Id().operator TUint()));
+    if ( iVideoFrameQueue->IsStored() )
+        {
+        if ( IsOkToSendFrame() )
+            {
+            BaseConvert( iVideoFrameQueue->Buffer() );
+            }
+        iVideoFrameQueue->Release();
+        }       
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseSetBitmapAvailable()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::BaseVideoFrameSizeChangedL( const TSize& )
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::BaseVideoFrameSizeChangedL( const TSize& )
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseVideoFrameSizeChangedL()<"), RThread().Id().operator TUint()));
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::BaseVideoFrameSizeChangedL()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkNGA::NextFrame
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::NextFrame()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::NextFrame()<"), RThread().Id().operator TUint()));
+    iBitmapCS.Wait();
+    if ( iVideoFrameQueue->IsStored() )
+        {
+        if ( IsOkToSendFrame() )
+            {
+            BaseConvert( iVideoFrameQueue->Buffer() );
+            }
+        iVideoFrameQueue->Release();
+        }    
+    iBitmapCS.Signal();
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::NextFrame()>"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkDP::UpdateExpectedFrameSizeL()
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkNGA::UpdateExpectedFrameSizeL()
+    {
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::UpdateExpectedFrameSizeL()<"), RThread().Id().operator TUint()));
+    iExpectedFrameSize = iNewParams.iFrameSize;
+    _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySinkNGA::UpdateExpectedFrameSizeL()>"), RThread().Id().operator TUint()));
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImage.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cvtimage.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImage::Type() const
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVtImage::TVtImageType CVtImage::Type() const
+    {
+    return iType;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImage::DisplayModeToVtDisplayMode( TDisplayMode aMode )
+// -----------------------------------------------------------------------------
+//
+CVtImage::TVtDisplayMode CVtImage::DisplayModeToVtDisplayMode(
+    TDisplayMode aMode )
+    {
+    TVtDisplayMode mode;
+
+    switch( aMode )
+        {
+        case EColor4K:
+            mode = EVtColor4K;
+            break;
+
+        case EColor64K:
+            mode = EVtColor64K;
+            break;
+
+        case EColor16M:
+            mode = EVtColor16M;
+            break;
+
+        case EColor16MU:
+            mode = EVtColor16MU;
+            break;
+
+        case EColor16MA:
+            mode = EVtColor16MA;
+            break;
+
+        default:
+            mode = EVtColorNone;
+            break;
+        }
+
+    return mode;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImage::CVtImage( TVtImageType aType )
+// -----------------------------------------------------------------------------
+//
+CVtImage::CVtImage( TVtImageType aType )
+: iType( aType )
+    {
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageBitmap.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageBitmap.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::NewL( TInt aBitmapHandle )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageBitmap* CVtImageBitmap::NewL( TInt aBitmapHandle )
+    {
+    CVtImageBitmap* self = new ( ELeave ) CVtImageBitmap();
+    CleanupStack::PushL( self );
+    self->ConstructL( aBitmapHandle );
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::NewL( const TSize& aSize, TDisplayMode aDisplayMode )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageBitmap* CVtImageBitmap::NewL(
+    const TSize& aSize,
+    TDisplayMode aDisplayMode )
+    {
+    CVtImageBitmap* self = new ( ELeave ) CVtImageBitmap();
+    CleanupStack::PushL( self );
+    self->ConstructL( aSize, aDisplayMode );
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::~CVtImageBitmap()
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageBitmap::~CVtImageBitmap()
+    {
+    delete iBitmap;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::ResizeL( const TSize& aSize )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageBitmap::ResizeL( const TSize& aSize )
+    {
+    User::LeaveIfError( iBitmap->Resize( aSize ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::SetBitmapL( TInt aBitmapHandle )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageBitmap::SetBitmapL( TInt aBitmapHandle )
+    {
+    delete iBitmap;
+    iBitmap = 0;
+    ConstructL( aBitmapHandle );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::Bitmap() const
+// -----------------------------------------------------------------------------
+EXPORT_C CFbsBitmap& CVtImageBitmap::Bitmap() const
+    {
+    return *iBitmap;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::NeedHeapLock() const
+// -----------------------------------------------------------------------------
+TBool CVtImageBitmap::NeedHeapLock() const
+    {
+    return iBitmap->IsLargeBitmap();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::DisplayMode() const
+// -----------------------------------------------------------------------------
+CVtImage::TVtDisplayMode CVtImageBitmap::DisplayMode() const
+    {
+    return CVtImage::DisplayModeToVtDisplayMode( iBitmap->DisplayMode() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::Size() const
+// -----------------------------------------------------------------------------
+TSize CVtImageBitmap::Size() const
+    {
+    return iBitmap->SizeInPixels();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::BytesPerRow() const
+// -----------------------------------------------------------------------------
+TInt CVtImageBitmap::BytesPerRow() const
+    {
+    return iBitmap->ScanLineLength( Size().iWidth, iBitmap->DisplayMode() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::DataAddress() const
+// -----------------------------------------------------------------------------
+TUint32* CVtImageBitmap::DataAddress() const
+    {
+    return iBitmap->DataAddress();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::LineAddress( TInt aLine ) const
+// -----------------------------------------------------------------------------
+TUint32* CVtImageBitmap::LineAddress( TInt aLine ) const
+    {
+    if( aLine < 0 )
+        {
+        aLine = 0;
+        }
+    else if( aLine > Size().iHeight - 1 )
+        {
+        aLine = Size().iHeight - 1;
+        }
+    return reinterpret_cast< TUint32* >(
+        reinterpret_cast< TUint8* >( DataAddress() ) + BytesPerRow() * aLine );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::CVtImageBitmap()
+// -----------------------------------------------------------------------------
+CVtImageBitmap::CVtImageBitmap()
+: CVtImage( CVtImage::EVtImageBitmap )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::ConstructL( const TSize& aSize, TDisplayMode aDisplayMode )
+// -----------------------------------------------------------------------------
+void CVtImageBitmap::ConstructL( const TSize& aSize, TDisplayMode aDisplayMode )
+    {
+    iBitmap = new ( ELeave ) CFbsBitmap();
+    User::LeaveIfError( iBitmap->Create( aSize, aDisplayMode ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageBitmap::ConstructL( TInt aBitmapHandle )
+// -----------------------------------------------------------------------------
+void CVtImageBitmap::ConstructL( TInt aBitmapHandle  )
+    {
+    iBitmap = new ( ELeave ) CFbsBitmap();
+    User::LeaveIfError( iBitmap->Duplicate( aBitmapHandle ) );
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageConverter.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1876 @@
+/*
+* 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:  YUV to bitmap and bitmap to YUV conversion routines for VT
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+#include "CVtImageConverter.h"
+
+// LOCAL CONSTANTS AND MACROS
+
+#ifdef _DEBUG
+#	define __IF_DEBUG(t) {RDebug::t;}
+#else
+#	define __IF_DEBUG(t)
+#endif
+
+// Calculates average for two integer values
+#define AVG( a, b ) ( ( a + b ) >> 1 )
+
+// MODULE DATA STRUCTURES
+
+/**
+*  Holds data for one YUV pixel
+*
+*  @lib VTImageConverter.lib
+*/
+struct TVSYCrCb
+	{
+	public:
+		// Y data
+		TInt iY;
+
+		// Cb (U) data
+		TInt iCb;
+
+		// Cr (V) data
+		TInt iCr;
+	};
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RGBtoYCbCr( TVSYCrCb* aYuv, const TRgb& aColor )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint8 RGBtoYCbCr( TVSYCrCb* aYuv, const TRgb& aColor )
+	{
+	const TInt YRedFactor = 19595; // 0.299 << 16
+	const TInt YGreenFactor = 38470; // 0.587 << 16
+	const TInt YBlueFactor = 7471; // 0.114 << 16
+	const TInt CbRedFactor = 11056; // 0.1687 << 16
+	const TInt CbGreenFactor = 21712; // 0.3313 << 16
+	const TInt CrGreenFactor = 27440; // 0.4187 << 16
+	const TInt CrBlueFactor = 5328; // 0.0813 << 16
+
+	TInt red = aColor.Red();
+	TInt green = aColor.Green();
+	TInt blue = aColor.Blue();
+
+	aYuv->iY = ( YRedFactor * red ) +
+	    ( YGreenFactor * green ) +
+	    ( YBlueFactor * blue );
+	aYuv->iCb = - ( CbRedFactor * red ) -
+	    ( CbGreenFactor * green ) +
+	    ( blue << 15 );
+	aYuv->iCr = ( red << 15 ) -
+	    ( CrGreenFactor * green ) -
+	    ( CrBlueFactor * blue );
+
+	aYuv->iY >>= 16;
+	aYuv->iCb >>= 16;
+	aYuv->iCr >>= 16;
+
+	aYuv->iCb += 128;
+	aYuv->iCr += 128;
+
+	return static_cast< TUint8 >( aYuv->iY );
+	}
+
+// -----------------------------------------------------------------------------
+// VSReadColor4K( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor4K( TAny*& aSource )
+	{
+	TUint16* s = static_cast< TUint16* >( aSource );
+	TRgb rgb( TRgb::Color4K( *s++ ) );
+	aSource = s;
+	return rgb;
+	}
+
+// -----------------------------------------------------------------------------
+// VSReadColor64K( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor64K( TAny*& aSource )
+	{
+	TUint16* s = static_cast< TUint16* >( aSource );
+	TRgb rgb( TRgb::Color64K( *s++ ) );
+	aSource = s;
+	return rgb;
+	}
+
+// -----------------------------------------------------------------------------
+// VSReadColor16M( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor16M( TAny*& aSource )
+	{
+	TUint8* s = static_cast< TUint8* >( aSource );
+	TRgb rgb( s[ 2 ], s[ 1 ], s[ 0 ] );
+	aSource = s + 3;
+	return rgb;
+	}
+
+// -----------------------------------------------------------------------------
+// VSReadColor16MU( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor16MU( TAny*& aSource )
+	{
+	TUint32* s = static_cast< TUint32* >( aSource );
+	TRgb rgb( TRgb::Color16MU( *s++ ) );
+	aSource = s;
+	return rgb;
+	}
+
+// -----------------------------------------------------------------------------
+// VSReadColor16MA( TAny*& aSource )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor16MA( TAny*& aSource )
+	{
+	TUint32* s = static_cast< TUint32* >( aSource );
+	TRgb rgb( TRgb::Color16MA( *s++ ) );
+	aSource = s;
+	return rgb;
+	}
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/**
+*
+*/
+const TUint8 CVTYUVFbsBitmapConverter::COFF_TBL_4K[ 80 ]=
+	{
+    0xe9,0x66,0x01,0x00,    // KRedCrFactor
+    0x1a,0x58,0x00,0x00,    // KGreenCbFactor
+    0xd2,0xb6,0x00,0x00,    // KGreenCrFactor
+    0xa2,0xc5,0x01,0x00,    // KBlueCbFactor
+
+    0x00,0x00,0x00,0x00,    // 4-bit
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,    // 5
+    0x00,0x00,0x00,0x00,
+    0x00,0x01,0x02,0x03,
+    0x04,0x05,0x06,0x07,
+    0x08,0x09,0x0a,0x0b,
+    0x0c,0x0d,0x0e,0x0f,    // 10
+    0x0f,0x0f,0x0f,0x0f,
+    0x0f,0x0f,0x0f,0x0f,
+    0x0f,0x0f,0x0f,0x0f,
+    0x0f,0x0f,0x0f,0x0f,
+    0x0f,0x0f,0x0f,0x0f,    // 15
+    0x0f,0x0f,0x0f,0x0f
+    };
+
+/**
+*
+*/
+const TUint8 CVTYUVFbsBitmapConverter::COFF_TBL_64K[ 220 ]=
+	{
+    0xe9,0x66,0x01,0x00,    // KRedCrFactor
+    0x1a,0x58,0x00,0x00,    // KGreenCbFactor
+    0xd2,0xb6,0x00,0x00,    // KGreenCrFactor
+    0xa2,0xc5,0x01,0x00,    // KBlueCbFactor
+
+    0x00,0x00,0x00,0x00,    // 5-bit
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x01,0x02,0x03,
+    0x04,0x05,0x06,0x07,
+    0x08,0x09,0x0a,0x0b,
+    0x0c,0x0d,0x0e,0x0f,
+    0x10,0x11,0x12,0x13,
+    0x14,0x15,0x16,0x17,
+    0x18,0x19,0x1a,0x1b,
+    0x1c,0x1d,0x1e,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+    0x1f,0x1f,0x1f,0x1f,
+
+    0x00,0x00,0x00,0x00,    // 6-bit
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x01,0x02,0x03,
+    0x04,0x05,0x06,0x07,
+    0x08,0x09,0x0a,0x0b,
+    0x0c,0x0d,0x0e,0x0f,
+    0x10,0x11,0x12,0x13,
+    0x14,0x15,0x16,0x17,
+    0x18,0x19,0x1a,0x1b,
+    0x1c,0x1d,0x1e,0x1f,
+    0x20,0x21,0x22,0x23,
+    0x24,0x25,0x26,0x27,
+    0x28,0x29,0x2a,0x2b,
+    0x2c,0x2d,0x2e,0x2f,
+    0x30,0x31,0x32,0x33,
+    0x34,0x35,0x36,0x37,
+    0x38,0x39,0x3a,0x3b,
+    0x3c,0x3d,0x3e,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f,
+    0x3f,0x3f,0x3f,0x3f
+	};
+
+/**
+*
+*/
+const TUint8 CVTYUVFbsBitmapConverter::COFF_TBL_16M[ 528 ] =
+	{
+    0xe9,0x66,0x01,0x00,    // KRedCrFactor
+    0x1a,0x58,0x00,0x00,    // KGreenCbFactor
+    0xd2,0xb6,0x00,0x00,    // KGreenCrFactor
+    0xa2,0xc5,0x01,0x00,    // KBlueCbFactor
+
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,
+
+    0x00,0x01,0x02,0x03,    // 8-bit
+    0x04,0x05,0x06,0x07,
+    0x08,0x09,0x0a,0x0b,
+    0x0c,0x0d,0x0e,0x0f,
+
+    0x10,0x11,0x12,0x13,
+    0x14,0x15,0x16,0x17,
+    0x18,0x19,0x1a,0x1b,
+    0x1c,0x1d,0x1e,0x1f,
+
+    0x20,0x21,0x22,0x23,
+    0x24,0x25,0x26,0x27,
+    0x28,0x29,0x2a,0x2b,
+    0x2c,0x2d,0x2e,0x2f,
+
+    0x30,0x31,0x32,0x33,
+    0x34,0x35,0x36,0x37,
+    0x38,0x39,0x3a,0x3b,
+    0x3c,0x3d,0x3e,0x3f,
+
+    0x40,0x41,0x42,0x43,
+    0x44,0x45,0x46,0x47,
+    0x48,0x49,0x4a,0x4b,
+    0x4c,0x4d,0x4e,0x4f,
+
+    0x50,0x51,0x52,0x53,
+    0x54,0x55,0x56,0x57,
+    0x58,0x59,0x5a,0x5b,
+    0x5c,0x5d,0x5e,0x5f,
+
+    0x60,0x61,0x62,0x63,
+    0x64,0x65,0x66,0x67,
+    0x68,0x69,0x6a,0x6b,
+    0x6c,0x6d,0x6e,0x6f,
+
+    0x70,0x71,0x72,0x73,
+    0x74,0x75,0x76,0x77,
+    0x78,0x79,0x7a,0x7b,
+    0x7c,0x7d,0x7e,0x7f,
+
+    0x80,0x81,0x82,0x83,
+    0x84,0x85,0x86,0x87,
+    0x88,0x89,0x8a,0x8b,
+    0x8c,0x8d,0x8e,0x8f,
+
+    0x90,0x91,0x92,0x93,
+    0x94,0x95,0x96,0x97,
+    0x98,0x99,0x9a,0x9b,
+    0x9c,0x9d,0x9e,0x9f,
+
+    0xa0,0xa1,0xa2,0xa3,
+    0xa4,0xa5,0xa6,0xa7,
+    0xa8,0xa9,0xaa,0xab,
+    0xac,0xad,0xae,0xaf,
+
+    0xb0,0xb1,0xb2,0xb3,
+    0xb4,0xb5,0xb6,0xb7,
+    0xb8,0xb9,0xba,0xbb,
+    0xbc,0xbd,0xbe,0xbf,
+
+    0xc0,0xc1,0xc2,0xc3,
+    0xc4,0xc5,0xc6,0xc7,
+    0xc8,0xc9,0xca,0xcb,
+    0xcc,0xcd,0xce,0xcf,
+
+    0xd0,0xd1,0xd2,0xd3,
+    0xd4,0xd5,0xd6,0xd7,
+    0xd8,0xd9,0xda,0xdb,
+    0xdc,0xdd,0xde,0xdf,
+
+    0xe0,0xe1,0xe2,0xe3,
+    0xe4,0xe5,0xe6,0xe7,
+    0xe8,0xe9,0xea,0xeb,
+    0xec,0xed,0xee,0xef,
+
+    0xf0,0xf1,0xf2,0xf3,
+    0xf4,0xf5,0xf6,0xf7,
+    0xf8,0xf9,0xfa,0xfb,
+    0xfc,0xfd,0xfe,0xff,
+
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff,
+    0xff,0xff,0xff,0xff
+    };
+
+// ============================ CVTYUVFbsBitmapConverter =======================
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::CVTYUVFbsBitmapConverter(
+//  const TSize& aSourceSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVTYUVFbsBitmapConverter::CVTYUVFbsBitmapConverter( const TSize& aSourceSize )
+: iSourceSize( aSourceSize )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::CVTYUVFbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::CVTYUVFbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+	delete iDestination;
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::~CVTYUVFbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::ProcessL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVFbsBitmapConverter::ProcessL()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ProcessL() >>"), RThread().Id().operator TUint()));
+	switch( iDestination->DisplayMode() )
+		{
+		case EColor4K:
+			DoProcess4K();
+			break;
+
+		case EColor64K:
+			DoProcess64K();
+			break;
+
+		case EColor16M:
+			DoProcess16M();
+			break;
+
+        case EColor16MU:
+        case EColor16MA:    // 16MU and 16MA are handled equally
+			DoProcess16MU16MA();
+            break;
+
+		default:
+			User::Leave( KErrNotSupported );
+			break;
+		};
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ProcessL() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SetDestinationL(
+//  const CFbsBitmap& aDestinationBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVFbsBitmapConverter::SetDestinationL(
+    const CFbsBitmap& aDestinationBitmap )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SetDestinationL() >>"), RThread().Id().operator TUint()));
+	SetDestinationL( aDestinationBitmap.Handle() );
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SetDestinationL() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SetDestinationL( TInt aHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVFbsBitmapConverter::SetDestinationL( TInt aHandle )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SetDestinationL() >>"), RThread().Id().operator TUint()));
+	ReConstructL( aHandle );
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SetDestinationL() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::ConstructL( TInt aBitmapHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVFbsBitmapConverter::ConstructL( TInt aBitmapHandle )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ConstructL() >>"), RThread().Id().operator TUint()));
+	iDestination = new (ELeave) CFbsBitmap();
+	ReConstructL( aBitmapHandle );
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ConstructL() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::ReConstructL( TInt aBitmapHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVFbsBitmapConverter::ReConstructL( TInt aBitmapHandle )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ReConstructL() >>"), RThread().Id().operator TUint()));
+	User::LeaveIfError( iDestination->Duplicate( aBitmapHandle ) );
+	// make sure that destination bitmap's displaymode is supported
+	if( ( iDestination->DisplayMode() != EColor4K ) &&
+	    ( iDestination->DisplayMode() != EColor64K ) &&
+	    ( iDestination->DisplayMode() != EColor16M ) &&
+	    ( iDestination->DisplayMode() != EColor16MU ) &&
+	    ( iDestination->DisplayMode() != EColor16MA )
+        )
+		{
+		User::Leave( KErrNotSupported );
+		}
+	iDestinationSize = iDestination->SizeInPixels();
+	SizeUpdateL();
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::ReConstructL() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVFbsBitmapConverter::SizeUpdateL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVFbsBitmapConverter::SizeUpdateL()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SizeUpdate() >>"), RThread().Id().operator TUint()));
+	if( ( SourceSize().iWidth < 2 ) || ( DestinationSize().iWidth < 2 ) )
+		{
+		User::Leave( KErrNotSupported ); // !!!!
+		}
+
+    iVSkipReal = TReal32( SourceSize().iHeight ) /
+	    TReal32( DestinationSize().iHeight );
+	iHSkipReal = TReal32( SourceSize().iWidth ) /
+	    TReal32( DestinationSize().iWidth );
+
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVFbsBitmapConverter::SizeUpdate() <<"), RThread().Id().operator TUint()));
+	}
+
+// ============================ CVTYUVPlanarFbsBitmapConverter ===============================
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::SetSourceSizeL( const TSize& aSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVPlanarFbsBitmapConverter::SetSourceSizeL(
+    const TSize& aSize )
+	{
+	iSourceSize = aSize;
+	SizeUpdateL();
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::SetSourceL(
+//  const TSize& aSize, const TDesC8& aSourceData )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVPlanarFbsBitmapConverter::SetSourceL(
+    const TSize& aSize,
+    const TDesC8& aSourceData )
+	{
+	iSourceSize = aSize;
+	SetSourceL( aSourceData );
+	SizeUpdateL();
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::CVTYUVPlanarFbsBitmapConverter(
+//  const TSize& aSourceSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVTYUVPlanarFbsBitmapConverter::CVTYUVPlanarFbsBitmapConverter(
+    const TSize& aSourceSize )
+: CVTYUVFbsBitmapConverter( aSourceSize )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::CVTYUVPlanarFbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::CVTYUVPlanarFbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess4K()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess4K()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4K() >>"), RThread().Id().operator TUint()));
+
+	// Vertical scaling needed?
+	if( ( iVSkipReal == 1 ) && ( iHSkipReal == 1 ) )
+		{
+		// NO: Use really fast conversion
+		DoProcess4KNoScale();
+		}
+	else
+		{
+
+		// YES: Use slower conversion method
+		const TUint8* y = iY;
+		const TUint8* u = iU;
+		const TUint8* v = iV;
+	    const TUint8* clip = COFF_TBL_4K + 40;
+
+		TInt height = DestinationSize().iHeight;
+		TInt width = DestinationSize().iWidth;
+
+		iDestination->LockHeap();
+		TUint32* d = iDestination->DataAddress();
+
+		__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4K(): [%d, %d] for >>"), RThread().Id().operator TUint(), width, height ));
+
+		for( TInt h = 0; h < height; h++ )
+			{
+			TInt sourceY = TInt( TReal32( h ) * iVSkipReal );
+			TInt hTimesW =  sourceY * SourceSize().iWidth;
+			TInt uvIdx = ( sourceY >> 1 ) * ( SourceSize().iWidth >> 1 );
+			for( TInt w = 0; w < width; w++ )
+				{
+				TInt sourceX = TInt( TReal32( w ) * iHSkipReal );
+			    TInt uvIdxW( uvIdx + ( sourceX >> 1 ) );
+
+                TInt ay = y[ hTimesW + sourceX ];
+				TInt cb = u[ uvIdxW ] - 128;
+				TInt cr = v[ uvIdxW ] - 128;
+
+                 TInt greenCbCr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+                    cb * *reinterpret_cast< const TInt32* >( clip - 36 )
+                    ) >> 16;
+			    cr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+                    ) >> 16;
+			    cb =
+                    (
+                    cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+                    ) >> 16;
+
+				TInt red = ay + cr;
+				TInt green = ay - greenCbCr;
+				TInt blue = ay + cb;
+
+				red = clip[ red >> 4 ];
+				green = clip[ green >> 4 ];
+				blue = clip[ blue >> 4 ];
+
+				// RGB_444
+				TUint32 s = green | ( red << 4 );
+				s = blue | ( s << 4 );
+
+				w++;
+				sourceX = TInt( TReal32( w ) * iHSkipReal );
+				uvIdxW = uvIdx + ( sourceX >> 1 );
+
+				ay = y[ hTimesW + sourceX ];
+				cb = u[ uvIdxW ] - 128;
+				cr = v[ uvIdxW ] - 128;
+
+                greenCbCr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+                    cb * *reinterpret_cast< const TInt32* >( clip - 36 )
+                    ) >> 16;
+			    cr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+                    ) >> 16;
+			    cb =
+                    (
+                    cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+                    ) >> 16;
+
+				red = ay + cr;
+				green = ay - greenCbCr;
+				blue = ay + cb;
+
+				red = clip[ red >> 4 ];
+				green = clip[ green >> 4 ];
+				blue = clip[ blue >> 4 ];
+
+				// RGB_444
+                s |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+				*d++ = s;
+				}
+			}
+
+		__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4K(): for <<"), RThread().Id().operator TUint()));
+
+		iDestination->UnlockHeap();
+		}
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4K() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess4KNoScale()
+// When vertical and horizontal scaling is not required we can do two vertical
+// lines in parallel in that case we need to calculate Cr and Cb values only
+// once for four pixels.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess4KNoScale()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4KNoScale() >>"), RThread().Id().operator TUint()));
+
+   	TInt height( SourceSize().iHeight >> 1 );
+    TInt width( SourceSize().iWidth );
+
+	const TUint32* y1 = reinterpret_cast< const TUint32* >( iY );
+    const TUint32* u = reinterpret_cast< const TUint32* >( iU );
+    const TUint32* v = reinterpret_cast< const TUint32* >( iV );
+
+    iDestination->LockHeap();
+
+	TUint32 uintsPerDestRow = CFbsBitmap::ScanLineLength
+        ( DestinationSize().iWidth, EColor4K ) >> 2;
+
+    TUint32* d1 = iDestination->DataAddress();
+
+    TUint32 ywidth = width >> 2;
+
+    width >>= 3;
+
+    TInt32 cb;
+    TInt32 cr;
+    TInt32 greenCbCr;
+    TInt32 yy;
+    TInt32 red;
+    TInt32 green;
+    TInt32 blue;
+    TUint32 r1;
+	const TUint8* clip = COFF_TBL_4K + 40;
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        for( TInt x = 0; x < width; x++ )
+            {
+            TUint32 u1 = *u++;
+            TUint32 v1 = *v++;
+
+            for( TInt c2 = 0; c2 < 2; c2++ )
+                {
+                TUint32 yy2 = y1[ ywidth ];
+                TUint32 yy1 = *y1++;
+
+                for( TInt c = 0; c < 2; c++ )
+                    {
+                    cb = TInt32( u1 & 0xff ) - 128;
+                    u1 >>= 8;
+			        cr = TInt32( v1 & 0xff ) - 128;
+                    v1 >>= 8;
+
+                    greenCbCr =
+                        (
+                        cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+                        cb * *reinterpret_cast< const TInt32* >( clip - 36 )
+                        ) >> 16;
+			        cr =
+                        (
+                        cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+                        ) >> 16;
+			        cb =
+                        (
+                        cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+                        ) >> 16;
+
+                    // lower left
+                    yy = ( yy2 & 0xff );
+                    yy2 >>= 8;
+
+				    red = yy + cr;
+				    green = yy - greenCbCr;
+				    blue = yy + cb;
+
+				    red = clip[ red >> 4 ];
+				    green = clip[ green >> 4 ];
+				    blue = clip[ blue >> 4 ];
+
+				    // RGB_444
+				    r1 = green | ( red << 4 );
+				    r1 = blue | ( r1 << 4 );
+
+                    // lower right
+                    yy = ( yy2 & 0xff );
+                    yy2 >>= 8;
+
+				    red = yy + cr;
+				    green = yy - greenCbCr;
+				    blue = yy + cb;
+
+				    red = clip[ red >> 4 ];
+				    green = clip[ green >> 4 ];
+				    blue = clip[ blue >> 4 ];
+
+				    // RGB_444
+				    r1 |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+                    d1[ uintsPerDestRow ] = r1;
+
+                    // upper left
+                    yy = ( yy1 & 0xff );
+                    yy1 >>= 8;
+
+				    red = yy + cr;
+				    green = yy - greenCbCr;
+				    blue = yy + cb;
+
+				    red = clip[ red >> 4 ];
+				    green = clip[ green >> 4 ];
+				    blue = clip[ blue >> 4 ];
+
+				    // RGB_444
+				    r1 = green | ( red << 4 );
+				    r1 = blue | ( r1 << 4 );
+
+                    // upper right
+                    yy = ( yy1 & 0xff );
+                    yy1 >>= 8;
+
+				    red = yy + cr;
+				    green = yy - greenCbCr;
+				    blue = yy + cb;
+
+				    red = clip[ red >> 4 ];
+				    green = clip[ green >> 4 ];
+				    blue = clip[ blue >> 4 ];
+
+				    // RGB_444
+				    r1 |= ( ( green | ( red << 4 ) ) << 4 | blue ) << 16;
+
+                    *d1++ = r1;
+                    }
+                }
+            }
+
+	    y1 += ( width << 1 );
+	    d1 += uintsPerDestRow;
+        }
+
+    iDestination->UnlockHeap();
+
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess4KNoScale() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess64K()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess64K()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64K() >>"), RThread().Id().operator TUint()));
+
+	// Vertical scaling needed?
+	if( ( iVSkipReal == 1 ) && ( iHSkipReal == 1 ) )	// !!!
+		{
+		// NO: Use really fast conversion
+		DoProcess64KNoScale();
+		return;
+		}
+	else
+		{
+		// YES: Use slower conversion method
+		const TUint8* y = iY;
+		const TUint8* u = iU;
+		const TUint8* v = iV;
+	    const TUint8* clip = COFF_TBL_64K + 40;
+
+		TInt height = DestinationSize().iHeight;
+		TInt width = DestinationSize().iWidth;
+
+		iDestination->LockHeap();
+		TUint32* d = iDestination->DataAddress();
+
+		__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64K(): [%d, %d] for >>"), RThread().Id().operator TUint(), width, height ));
+
+		for( TInt h = 0; h < height; h++ )
+			{
+			TInt sourceY = TInt( TReal32( h ) * iVSkipReal );
+			TInt hTimesW =  sourceY * SourceSize().iWidth;
+			TInt uvIdx = ( sourceY >> 1 ) * ( SourceSize().iWidth >> 1 );
+			for( TInt w = 0; w < width; w++ )
+				{
+				TInt sourceX = TInt( TReal32( w ) * iHSkipReal );
+
+				TInt uvIdxW( uvIdx + ( sourceX >> 1 ) );
+
+				TInt ay = y[ hTimesW + sourceX ];
+				TInt cb = u[ uvIdxW ] - 128;
+				TInt cr = v[ uvIdxW ] - 128;
+
+                TInt greenCbCr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+                    cb * *reinterpret_cast< const TInt32* >( clip - 36 ) -
+                    0x1200000
+                    ) >> 16;
+			    cr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+                    ) >> 16;
+			    cb =
+                    (
+                    cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+                    ) >> 16;
+
+				TInt red = ay + cr;
+				TInt green = ay - greenCbCr;
+				TInt blue = ay + cb;
+
+				red = clip[ red >> 3 ];
+				green = clip[ green >> 2 ];
+				blue = clip[ blue >> 3 ];
+
+                // RGB_565
+				TUint32 s = green | ( red << 6 );
+				s = blue | ( s << 5 );
+
+				w++;
+				sourceX = TInt( TReal32( w ) * iHSkipReal );
+
+				uvIdxW = uvIdx + ( sourceX >> 1 );
+
+				ay = y[ hTimesW + sourceX ];
+				cb = u[ uvIdxW ] - 128;
+				cr = v[ uvIdxW ] - 128;
+
+                greenCbCr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+                    cb * *reinterpret_cast< const TInt32* >( clip - 36 ) -
+                    0x1200000
+                    ) >> 16;
+			    cr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+                    ) >> 16;
+			    cb =
+                    (
+                    cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+                    ) >> 16;
+
+				red = ay + cr;
+				green = ay - greenCbCr;
+				blue = ay + cb;
+
+				red = clip[ red >> 3 ];
+				green = clip[ green >> 2 ];
+				blue = clip[ blue >> 3 ];
+
+                s |= ( ( green | ( red << 6 ) ) << 5 | blue ) << 16;
+
+				*d++ = s;
+				}
+			}
+
+		__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64K(): for <<"), RThread().Id().operator TUint()));
+
+		iDestination->UnlockHeap();
+		}
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64K() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess64KNoScale()
+// Source YUV image must be even divisible by 8.
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess64KNoScale()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64KNoScale() >>"), RThread().Id().operator TUint()));
+
+   	TInt height( SourceSize().iHeight >> 1 );
+    TInt width( SourceSize().iWidth );
+
+	const TUint32* y1 = reinterpret_cast< const TUint32* >( iY );
+    const TUint32* u = reinterpret_cast< const TUint32* >( iU );
+    const TUint32* v = reinterpret_cast< const TUint32* >( iV );
+
+    iDestination->LockHeap();
+
+	TUint32 uintsPerDestRow = CFbsBitmap::ScanLineLength
+        ( DestinationSize().iWidth, EColor64K ) >> 2;
+
+    TUint32* d1 = iDestination->DataAddress();
+
+    TUint32 ywidth = width >> 2;
+
+    width >>= 3;
+
+    TInt32 cb;
+    TInt32 cr;
+    TInt32 greenCbCr;
+    TInt32 yy;
+    TInt32 red;
+    TInt32 green;
+    TInt32 blue;
+    TUint32 r1;
+	const TUint8* clip = COFF_TBL_64K + 40;
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        for( TInt x = 0; x < width; x++ )
+            {
+            TUint32 u1 = *u++;
+            TUint32 v1 = *v++;
+
+            for( TInt c2 = 0; c2 < 2; c2++ )
+                {
+                TUint32 yy2 = y1[ ywidth ];
+                TUint32 yy1 = *y1++;
+
+                for( TInt c = 0; c < 2; c++ )
+                    {
+                    cb = TInt32( u1 & 0xff ) - 128;
+                    u1 >>= 8;
+			        cr = TInt32( v1 & 0xff ) - 128;
+                    v1 >>= 8;
+
+                    greenCbCr =
+                        (
+                        cr * *reinterpret_cast< const TInt32* >( clip - 32 ) +
+                        cb * *reinterpret_cast< const TInt32* >( clip - 36 ) -
+                        0x1200000
+                        ) >> 16;
+			        cr =
+                        (
+                        cr * *reinterpret_cast< const TInt32* >( clip - 40 )
+                        ) >> 16;
+			        cb =
+                        (
+                        cb * *reinterpret_cast< const TInt32* >( clip - 28 )
+                        ) >> 16;
+
+                    // lower left
+                    yy = ( yy2 & 0xff );
+                    yy2 >>= 8;
+
+				    red = yy + cr;
+				    green = yy - greenCbCr;
+				    blue = yy + cb;
+
+				    red = clip[ red >> 3 ];
+				    green = clip[ green >> 2 ];
+				    blue = clip[ blue >> 3 ];
+
+				    // RGB_565
+				    r1 = green | ( red << 6 );
+				    r1 = blue | ( r1 << 5 );
+
+                    // lower right
+                    yy = ( yy2 & 0xff );
+                    yy2 >>= 8;
+
+				    red = yy + cr;
+				    green = yy - greenCbCr;
+				    blue = yy + cb;
+
+                    // clear lowest 3 bits
+				    red = clip[ red >> 3 ];
+				    green = clip[ green >> 2 ];
+				    blue = clip[ blue >> 3 ];
+
+				    // RGB_565
+				    r1 |= ( ( green | ( red << 6 ) ) << 5 | blue ) << 16;
+
+                    d1[ uintsPerDestRow ] = r1;
+
+                    // upper left
+                    yy = ( yy1 & 0xff );
+                    yy1 >>= 8;
+
+				    red = yy + cr;
+				    green = yy - greenCbCr;
+				    blue = yy + cb;
+
+				    red = clip[ red >> 3 ];
+				    green = clip[ green >> 2 ];
+				    blue = clip[ blue >> 3 ];
+
+				    // RGB_565
+				    r1 = green | ( red << 6 );
+				    r1 = blue | ( r1 << 5 );
+
+                    // upper right
+                    yy = ( yy1 & 0xff );
+                    yy1 >>= 8;
+
+				    red = yy  + cr;
+				    green = yy - greenCbCr;
+				    blue = yy + cb;
+
+				    red = clip[ red >> 3 ];
+				    green = clip[ green >> 2 ];
+				    blue = clip[ blue >> 3 ];
+
+				    // RGB_565
+				    r1 |= ( ( green | ( red << 6 ) ) << 5 | blue ) << 16;
+
+                    *d1++ = r1;
+                    }
+                }
+            }
+
+	    y1 += ( width << 1 );
+	    d1 += uintsPerDestRow;
+        }
+
+    iDestination->UnlockHeap();
+
+    __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess64KNoScale() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess16M()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess16M()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16M() >>"), RThread().Id().operator TUint()));
+
+	// Vertical scaling needed?
+	if( ( iVSkipReal == 1 ) && ( iHSkipReal == 1 ) )
+		{
+		// NO: Use really fast conversion
+		DoProcess16MNoScale();
+		}
+	else
+		{
+		// YES: Use slower conversion method
+
+		// YES: Use slower conversion method
+		const TUint8* y = iY;
+		const TUint8* u = iU;
+		const TUint8* v = iV;
+	    const TUint8* clip = COFF_TBL_16M + 144;
+
+		TInt height = DestinationSize().iHeight;
+		TInt width = DestinationSize().iWidth;
+
+		iDestination->LockHeap();
+
+        TUint8* d = reinterpret_cast<TUint8*>( iDestination->DataAddress() );
+        TUint32 dPitch = iDestination->ScanLineLength( width, iDestination->DisplayMode() );
+
+        __IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16M(): [%d, %d] for >>"), RThread().Id().operator TUint(), width, height ));
+
+		for( TInt h = 0; h < height; h++ )
+			{
+			TInt sourceY = TInt( TReal32( h ) * iVSkipReal );
+			TInt hTimesW =  sourceY * SourceSize().iWidth;
+			TInt uvIdx = ( sourceY >> 1 ) * ( SourceSize().iWidth >> 1 );
+            TUint8* dTemp = d;
+			for( TInt w = 0; w < width; w++ )
+				{
+				TInt sourceX = TInt( TReal32( w ) * iHSkipReal );
+
+				TInt uvIdxW( uvIdx + ( sourceX >> 1 ) );
+
+				TInt ay = y[ hTimesW + sourceX ];
+				TInt cb = u[ uvIdxW ] - 128;
+				TInt cr = v[ uvIdxW ] - 128;
+
+                TInt greenCbCr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+                    cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+                    ) >> 16;
+			    cr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+                    ) >> 16;
+			    cb =
+                    (
+                    cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+                    ) >> 16;
+
+				*dTemp++ = clip[ ay + cb ];
+				*dTemp++ = clip[ ay - greenCbCr ];
+                *dTemp++ = clip[ ay + cr ];
+				}
+            d += dPitch;
+			}
+
+		__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16M(): for <<"), RThread().Id().operator TUint()));
+
+		iDestination->UnlockHeap();
+		}
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16M() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess16MNoScale()
+// When vertical and horizontal scaling is not required we can do two vertical
+// lines in parallel in that case we need to calculate Cr and Cb values only
+// once for four pixels.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess16MNoScale()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MNoScale() >>"), RThread().Id().operator TUint()));
+
+   	TInt height( SourceSize().iHeight >> 1 );
+    TInt width( SourceSize().iWidth );
+
+	const TUint32* y1 = reinterpret_cast< const TUint32* >( iY );
+    const TUint32* u = reinterpret_cast< const TUint32* >( iU );
+    const TUint32* v = reinterpret_cast< const TUint32* >( iV );
+
+    iDestination->LockHeap();
+
+	TUint32 bytesPerDestRow = CFbsBitmap::ScanLineLength
+        ( DestinationSize().iWidth, EColor16M );
+
+    TUint8* d1 = reinterpret_cast< TUint8* >( iDestination->DataAddress() );
+
+    TUint32 ywidth = width >> 2;
+
+    width >>= 3;
+
+    TInt32 cb;
+    TInt32 cr;
+    TInt32 greenCbCr;
+    TInt32 yy;
+    TInt32 idx1;
+    TInt32 idx2;
+	const TUint8* clip = COFF_TBL_16M + 144;
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        idx1 = 0;
+        idx2 = bytesPerDestRow;
+
+        for( TInt x = 0; x < width; x++ )
+            {
+            TUint32 u1 = *u++;
+            TUint32 v1 = *v++;
+
+            for( TInt c2 = 0; c2 < 2; c2++ )
+                {
+                TUint32 yy2 = y1[ ywidth ];
+                TUint32 yy1 = *y1++;
+
+                for( TInt c = 0; c < 2; c++ )
+                    {
+                    cb = TInt32( u1 & 0xff ) - 128;
+                    u1 >>= 8;
+			        cr = TInt32( v1 & 0xff ) - 128;
+                    v1 >>= 8;
+
+                    greenCbCr =
+                        (
+                        cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+                        cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+                        ) >> 16;
+			        cr =
+                        (
+                        cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+                        ) >> 16;
+			        cb =
+                        (
+                        cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+                        ) >> 16;
+
+                    // lower left
+                    yy = ( yy2 & 0xff );
+                    yy2 >>= 8;
+
+				    d1[ idx2++ ] = clip[ yy + cb ];
+				    d1[ idx2++ ] = clip[ yy - greenCbCr ];
+                    d1[ idx2++ ] = clip[ yy + cr ];
+
+                    // lower right
+                    yy = ( yy2 & 0xff );
+                    yy2 >>= 8;
+
+				    d1[ idx2++ ] = clip[ yy + cb ];
+				    d1[ idx2++ ] = clip[ yy - greenCbCr ];
+				    d1[ idx2++ ] = clip[ yy + cr ];
+
+                    // upper left
+                    yy = ( yy1 & 0xff );
+                    yy1 >>= 8;
+
+				    d1[ idx1++ ] = clip[ yy + cb ];
+				    d1[ idx1++ ] = clip[ yy - greenCbCr ];
+				    d1[ idx1++ ] = clip[ yy + cr ];
+
+                    // upper right
+                    yy = ( yy1 & 0xff );
+                    yy1 >>= 8;
+
+				    d1[ idx1++ ] = clip[ yy + cb ];
+				    d1[ idx1++ ] = clip[ yy - greenCbCr ];
+				    d1[ idx1++ ] = clip[ yy + cr ];
+                    }
+                }
+            }
+
+	    y1 += ( width << 1 );
+	    d1 += bytesPerDestRow * 2;
+        }
+
+    iDestination->UnlockHeap();
+
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MNoScale() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA() >>"), RThread().Id().operator TUint()));
+
+	// Vertical scaling needed?
+	if( ( iVSkipReal == 1 ) && ( iHSkipReal == 1 ) )
+		{
+		// NO: Use really fast conversion
+		DoProcess16MU16MANoScale();
+		}
+	else
+		{
+		// YES: Use slower conversion method
+		const TUint8* y = iY;
+		const TUint8* u = iU;
+		const TUint8* v = iV;
+    	const TUint8* clip = COFF_TBL_16M + 144;
+
+		TInt height = DestinationSize().iHeight;
+		TInt width = DestinationSize().iWidth;
+
+		iDestination->LockHeap();
+		TUint32* d = iDestination->DataAddress();
+
+		__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA(): [%d, %d] for >>"), RThread().Id().operator TUint(), width, height ));
+
+		for( TInt h = 0; h < height; h++ )
+			{
+			TInt sourceY = TInt( TReal32( h ) * iVSkipReal );
+			TInt hTimesW =  sourceY * SourceSize().iWidth;
+			TInt uvIdx = ( sourceY >> 1 ) * ( SourceSize().iWidth >> 1 );
+			for( TInt w = 0; w < width; w++ )
+				{
+				TInt sourceX = TInt( TReal32( w ) * iHSkipReal );
+
+				TInt uvIdxW( uvIdx + ( sourceX >> 1 ) );
+
+				TInt ay = y[ hTimesW + sourceX ];
+				TInt cb = u[ uvIdxW ] - 128;
+				TInt cr = v[ uvIdxW ] - 128;
+
+                TInt greenCbCr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+                    cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+                    ) >> 16;
+			    cr =
+                    (
+                    cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+                    ) >> 16;
+			    cb =
+                    (
+                    cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+                    ) >> 16;
+
+
+                // 0xffBBGG
+                TUint32 p = 0xff0000 |
+                    ( clip[ ay + cr ] << 8 ) | clip[ ay - greenCbCr ];
+                // 0xffBBGGRR
+                *d++ = clip[ ay + cb ] | ( p << 8 );
+				}
+			}
+
+		__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA(): for <<"), RThread().Id().operator TUint()));
+
+		iDestination->UnlockHeap();
+		}
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MA() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MANoScale()
+// When vertical and horizontal scaling is not required we can do two vertical
+// lines in parallel in that case we need to calculate Cr and Cb values only
+// once for four pixels.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MANoScale()
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MANoScale() >>"), RThread().Id().operator TUint()));
+
+   	TInt height( SourceSize().iHeight >> 1 );
+    TInt width( SourceSize().iWidth );
+
+	const TUint32* y1 = reinterpret_cast< const TUint32* >( iY );
+    const TUint32* u = reinterpret_cast< const TUint32* >( iU );
+    const TUint32* v = reinterpret_cast< const TUint32* >( iV );
+
+    iDestination->LockHeap();
+
+	TUint32 uintsPerDestRow = CFbsBitmap::ScanLineLength
+        ( DestinationSize().iWidth, EColor16MU ) >> 2;
+
+    TUint32* d1 = iDestination->DataAddress();
+
+    TUint32 ywidth = width >> 2;
+
+    width >>= 3;
+
+    TInt32 cb;
+    TInt32 cr;
+    TInt32 greenCbCr;
+    TInt32 yy;
+    TUint32 p;
+	const TUint8* clip = COFF_TBL_16M + 144;
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        for( TInt x = 0; x < width; x++ )
+            {
+            TUint32 u1 = *u++;
+            TUint32 v1 = *v++;
+
+            for( TInt c2 = 0; c2 < 2; c2++ )
+                {
+                TUint32 yy2 = y1[ ywidth ];
+                TUint32 yy1 = *y1++;
+
+                for( TInt c = 0; c < 2; c++ )
+                    {
+                    cb = TInt32( u1 & 0xff ) - 128;
+                    u1 >>= 8;
+			        cr = TInt32( v1 & 0xff ) - 128;
+                    v1 >>= 8;
+
+                    greenCbCr =
+                        (
+                        cr * *reinterpret_cast< const TInt32* >( clip - 136 ) +
+                        cb * *reinterpret_cast< const TInt32* >( clip - 140 )
+                        ) >> 16;
+			        cr =
+                        (
+                        cr * *reinterpret_cast< const TInt32* >( clip - 144 )
+                        ) >> 16;
+			        cb =
+                        (
+                        cb * *reinterpret_cast< const TInt32* >( clip - 132 )
+                        ) >> 16;
+
+                    // lower left
+                    yy = ( yy2 & 0xff );
+                    yy2 >>= 8;
+
+                    // 0xffBBGG
+                    p = 0xff0000 |
+                        ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+                    // 0xffBBGGRR
+                    d1[ uintsPerDestRow ] = clip[ yy + cb ] | ( p << 8 );
+
+                    // lower right
+                    yy = ( yy2 & 0xff );
+                    yy2 >>= 8;
+
+                    // 0xffBBGG
+                    p = 0xff0000 |
+                        ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+                    // 0xffBBGGRR
+                    d1[ uintsPerDestRow + 1 ] = clip[ yy + cb ] | ( p << 8 );
+
+                    // upper left
+                    yy = ( yy1 & 0xff );
+                    yy1 >>= 8;
+
+                    // 0xffBBGG
+                    p = 0xff0000 |
+                        ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+                    // 0xffBBGGRR
+                    *d1++ = clip[ yy + cb ] | ( p << 8 );
+
+                    // upper right
+                    yy = ( yy1 & 0xff );
+                    yy1 >>= 8;
+
+                    // 0xffBBGG
+                    p = 0xff0000 |
+                        ( clip[ yy + cr ] << 8 ) | clip[ yy - greenCbCr ];
+                    // 0xffBBGGRR
+                    *d1++ = clip[ yy + cb ] | ( p << 8 );
+                    }
+                }
+            }
+
+	    y1 += ( width << 1 );
+	    d1 += uintsPerDestRow;
+        }
+
+    iDestination->UnlockHeap();
+
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYUVPlanarFbsBitmapConverter::DoProcess16MU16MANoScale() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYUVPlanarFbsBitmapConverter::SetSourceL( const TDesC8& aSourceData )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVTYUVPlanarFbsBitmapConverter::SetSourceL(
+    const TDesC8& aSourceData )
+	{
+	// make sure dimension and buffer size match
+	if( aSourceData.Length() !=
+	    ( ( SourceSize().iWidth * SourceSize().iHeight * 12 ) / 8 ) )
+		{
+		User::Leave( KErrArgument );
+		}
+	SetYUVPtrs( aSourceData );
+	}
+
+// ============================ CVTIYUVFbsBitmapConverter ===============================
+
+// -----------------------------------------------------------------------------
+// CVTIYUVFbsBitmapConverter::NewL( const TSize& aSourceSize,
+//  const CFbsBitmap& aDestinationBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTIYUVFbsBitmapConverter* CVTIYUVFbsBitmapConverter::NewL(
+    const TSize& aSourceSize,
+    const CFbsBitmap& aDestinationBitmap )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::NewL() >>"), RThread().Id().operator TUint()));
+	CVTIYUVFbsBitmapConverter* self = NewL(
+	    aSourceSize, aDestinationBitmap.Handle() );
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::NewL() <<"), RThread().Id().operator TUint()));
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CVTIYUVFbsBitmapConverter::NewL( const TSize& aSourceSize,
+//  TInt aBitmapHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTIYUVFbsBitmapConverter* CVTIYUVFbsBitmapConverter::NewL(
+    const TSize& aSourceSize,
+    TInt aBitmapHandle )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::NewL() >>"), RThread().Id().operator TUint()));
+	CVTIYUVFbsBitmapConverter* self = new (ELeave)
+	    CVTIYUVFbsBitmapConverter( aSourceSize );
+	CleanupStack::PushL( self );
+	self->ConstructL( aBitmapHandle );
+	CleanupStack::Pop(); // self
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::NewL() <<"), RThread().Id().operator TUint()));
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CVTIYUVFbsBitmapConverter::SetYUVPtrs( const TDesC8& aSourceData )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTIYUVFbsBitmapConverter::SetYUVPtrs( const TDesC8& aSourceData )
+	{
+	TInt ySize = SourceSize().iWidth * SourceSize().iHeight;
+	TInt ySizeDiv4 = ( ySize >> 2 );
+	iY = aSourceData.Mid( 0, ySize ).Ptr();
+	iU = aSourceData.Mid( ySize, ySizeDiv4 ).Ptr();
+	iV = aSourceData.Mid( ySize + ySizeDiv4, ySizeDiv4 ).Ptr();
+	}
+
+// -----------------------------------------------------------------------------
+// CVTIYUVFbsBitmapConverter::CVTIYUVFbsBitmapConverter( const TSize&
+//  aSourceSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVTIYUVFbsBitmapConverter::CVTIYUVFbsBitmapConverter( const TSize& aSourceSize )
+: CVTYUVPlanarFbsBitmapConverter( aSourceSize )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::CVTIYUVFbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTIYUVFbsBitmapConverter::CVTIYUVFbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+	}
+
+// ============================ CVTYV12FbsBitmapConverter ===============================
+
+// -----------------------------------------------------------------------------
+// CVTYV12FbsBitmapConverter::NewL( const TSize& aSourceSize,
+// const CFbsBitmap& aDestinationBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTYV12FbsBitmapConverter* CVTYV12FbsBitmapConverter::NewL(
+    const TSize& aSourceSize,
+    const CFbsBitmap& aDestinationBitmap )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::NewL() >>"), RThread().Id().operator TUint()));
+	CVTYV12FbsBitmapConverter* self = NewL(
+	    aSourceSize, aDestinationBitmap.Handle() );
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::NewL() <<"), RThread().Id().operator TUint()));
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYV12FbsBitmapConverter::NewL( const TSize& aSourceSize,
+// TInt aBitmapHandle )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVTYV12FbsBitmapConverter* CVTYV12FbsBitmapConverter::NewL(
+    const TSize& aSourceSize,
+    TInt aBitmapHandle )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::NewL() >>"), RThread().Id().operator TUint()));
+	CVTYV12FbsBitmapConverter* self = new (ELeave)
+	    CVTYV12FbsBitmapConverter( aSourceSize );
+	CleanupStack::PushL( self );
+	self->ConstructL( aBitmapHandle );
+	CleanupStack::Pop(); // self
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::NewL() <<"), RThread().Id().operator TUint()));
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYV12FbsBitmapConverter::SetYUVPtrs( const TDesC8& aSourceData )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVTYV12FbsBitmapConverter::SetYUVPtrs( const TDesC8& aSourceData )
+	{
+	TInt ySize = SourceSize().iWidth * SourceSize().iHeight;
+	TInt ySizeDiv4 = ( ySize >> 2 );
+	iY = aSourceData.Mid( 0, ySize ).Ptr();
+	iV = aSourceData.Mid( ySize, ySizeDiv4 ).Ptr();
+	iU = aSourceData.Mid( ySize + ySizeDiv4, ySizeDiv4 ).Ptr();
+	}
+
+// -----------------------------------------------------------------------------
+// CVTYV12FbsBitmapConverter::CVTYV12FbsBitmapConverter(
+//  const TSize& aSourceSize )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVTYV12FbsBitmapConverter::CVTYV12FbsBitmapConverter( const TSize& aSourceSize )
+: CVTYUVPlanarFbsBitmapConverter( aSourceSize )
+	{
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::CVTYV12FbsBitmapConverter() >>"), RThread().Id().operator TUint()));
+	__IF_DEBUG(Print(_L("VideoSource: [%d] CVTYV12FbsBitmapConverter::CVTYV12FbsBitmapConverter() <<"), RThread().Id().operator TUint()));
+	}
+
+// ============================ CVSFbsBitmapIYUVConverter ===============================
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::CVSFbsBitmapIYUVConverter()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVSFbsBitmapIYUVConverter::CVSFbsBitmapIYUVConverter()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::NewL( const CFbsBitmap& aBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSFbsBitmapIYUVConverter* CVSFbsBitmapIYUVConverter::NewL(
+    const CFbsBitmap& aBitmap )
+	{
+	CVSFbsBitmapIYUVConverter* self = new (ELeave) CVSFbsBitmapIYUVConverter();
+	CleanupStack::PushL( self );
+	self->ConstructL( aBitmap );
+	CleanupStack::Pop(); // self
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::~CVSFbsBitmapIYUVConverter()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSFbsBitmapIYUVConverter::~CVSFbsBitmapIYUVConverter()
+	{
+	delete iSource;
+	delete iYUVData;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::SetSourceL( const CFbsBitmap& aBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVSFbsBitmapIYUVConverter::SetSourceL( const CFbsBitmap& aBitmap )
+	{
+	ReConstructL( aBitmap );
+	}
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::ProcessL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVSFbsBitmapIYUVConverter::ProcessL()
+	{
+	switch( iSource->DisplayMode() )
+		{
+		case EColor4K:
+			DoProcess( VSReadColor4K );
+			break;
+
+		case EColor64K:
+			DoProcess( VSReadColor64K );
+			break;
+
+		case EColor16M:
+			DoProcess( VSReadColor16M );
+			break;
+
+        case EColor16MU:
+			DoProcess( VSReadColor16MU );
+			break;
+
+        case EColor16MA:
+			DoProcess( VSReadColor16MA );
+			break;
+
+		default:
+			User::Leave( KErrNotSupported );
+			break;
+		};
+	}
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::YUVData() const
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPtrC8 CVSFbsBitmapIYUVConverter::YUVData() const
+	{
+	return *iYUVData;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::ConstructL( const CFbsBitmap& aBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapIYUVConverter::ConstructL( const CFbsBitmap& aBitmap )
+	{
+	iSource = new (ELeave) CFbsBitmap();
+	ReConstructL( aBitmap );
+	}
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::ReConstructL( const CFbsBitmap& aBitmap )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapIYUVConverter::ReConstructL( const CFbsBitmap& aBitmap )
+	{
+	User::LeaveIfError( iSource->Duplicate( aBitmap.Handle() ) );
+
+	// make sure that source bitmap's displaymode is supported
+	if( ( iSource->DisplayMode() != EColor4K ) &&
+	    ( iSource->DisplayMode() != EColor64K ) &&
+	    ( iSource->DisplayMode() != EColor16M ) &&
+	    ( iSource->DisplayMode() != EColor16MU ) &&
+	    ( iSource->DisplayMode() != EColor16MA ) )
+		{
+		User::Leave( KErrNotSupported );
+		}
+
+	if( !iYUVData || !( iSize == iSource->SizeInPixels() ) )
+		{
+		iSize = iSource->SizeInPixels();
+		delete iYUVData; iYUVData = 0;
+		TInt ySize = iSize.iWidth * iSize.iHeight;
+		iYUVData = HBufC8::NewMaxL( ySize + ( ySize >> 1 ) );
+		iY.Set( iYUVData->Des().Mid( 0, ySize ) );
+		iU.Set( iYUVData->Des().Mid( ySize, ySize >> 2 ) );
+		iV.Set( iYUVData->Des().Mid( ySize + ( ySize >> 2 ), ySize >> 2 ) );
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CVSFbsBitmapIYUVConverter::DoProcess( TVSColorReadFunc aReadFunction )
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapIYUVConverter::DoProcess( TVSColorReadFunc aReadFunction )
+	{
+	TUint8* pY = const_cast<TUint8*>( iY.Ptr() );
+	TUint8* pU = const_cast<TUint8*>( iU.Ptr() );
+	TUint8* pV = const_cast<TUint8*>( iV.Ptr() );
+	TVSYCrCb yuv1, yuv2;
+
+	iSource->LockHeap();
+	TAny* s = iSource->DataAddress();
+	for( TInt h = 0; h < iSize.iHeight; h++ )
+		{
+		if( h&1 )
+			{
+			// Note! width must be even divisible by 2
+			for( TInt w = 0; w < iSize.iWidth >> 1; w++ )
+				{
+				*pY++ = RGBtoYCbCr( &yuv1, aReadFunction( s ) );
+				*pY++ = RGBtoYCbCr( &yuv2, aReadFunction( s ) );
+				*pU++ = static_cast<TUint8>( AVG( yuv1.iCb, yuv2.iCb ) );
+				*pV++ = static_cast<TUint8>( AVG( yuv1.iCr, yuv2.iCr ) );
+				}
+			}
+		else
+			{
+			// Note! width must be even divisible by 2
+			for( TInt w = 0; w < iSize.iWidth >> 1; w++ )
+				{
+				*pY++ = RGBtoYCbCr( &yuv1, aReadFunction( s ) );
+				*pY++ = RGBtoYCbCr( &yuv2, aReadFunction( s ) );
+				*pU++ = static_cast<TUint8>(
+				    AVG( *pU, AVG( yuv1.iCb, yuv2.iCb ) ) );
+				*pV++ = static_cast<TUint8>(
+				    AVG( *pV, AVG( yuv1.iCr, yuv2.iCr ) ) );
+				}
+			// if even row -> decrease pU and pV, we will calculate average for
+			// those on odd rows
+			pU -= ( iSize.iWidth >> 1 );
+			pV -= ( iSize.iWidth >> 1 );
+			}
+		}
+	iSource->UnlockHeap();
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageIYUV.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,294 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageIYUV.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::NewL( TInt aBitmapHandle )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageIYUV* CVtImageIYUV::NewL( const TSize& aSize )
+    {
+    CVtImageIYUV* self = new ( ELeave ) CVtImageIYUV( aSize );
+    CleanupStack::PushL( self );
+    self->ConstructL( 0 );
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::NewL( const TSize& aSize, TDisplayMode aDisplayMode, 
+//  const TDesC8& aImage )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageIYUV* CVtImageIYUV::NewL( 
+        const TSize& aSize, 
+        const TDesC8& aImage )
+    {
+    CVtImageIYUV* self = new ( ELeave ) CVtImageIYUV( aSize );
+    CleanupStack::PushL( self );
+    self->ConstructL( &aImage );
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::NewL( const TSize& aSize, TDisplayMode aDisplayMode, 
+//  TPtr8& aImage )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageIYUV* CVtImageIYUV::NewL( 
+        const TSize& aSize, 
+        TPtr8& aImage )
+    {
+    CVtImageIYUV* self = new ( ELeave ) CVtImageIYUV( aSize );
+    CleanupStack::PushL( self );
+    self->ValidateSizeL( aSize );
+    self->SetImageL( aImage ); // No constructor call!
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::~CVtImageIYUV()
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageIYUV::~CVtImageIYUV()
+    {
+    delete iImage;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::SetImageL( const TDesC8& aImage )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageIYUV::SetImageL( const TDesC8& aImage )
+    {
+    CheckDescriptorSizeL( aImage );
+    if( !iImage )
+        {
+        ConstructL( &aImage );
+        }
+    else
+        {
+        *iImage = aImage;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::SetImageL( TPtr8& aImage )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageIYUV::SetImageL( TPtr8& aImage )
+    {
+    CheckDescriptorSizeL( aImage );
+    delete iImage; iImage = 0;
+    iPtrImage.Set( aImage );
+    SetYUVPointers();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::Image() const
+// -----------------------------------------------------------------------------
+EXPORT_C TPtrC8 CVtImageIYUV::Image() const
+    {
+    return iPtrImage;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::Y() const
+// -----------------------------------------------------------------------------
+EXPORT_C TUint8* CVtImageIYUV::Y() const
+    {
+    return iY;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::U() const
+// -----------------------------------------------------------------------------
+EXPORT_C TUint8* CVtImageIYUV::U() const
+    {
+    return iU;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::V() const
+// -----------------------------------------------------------------------------
+EXPORT_C TUint8* CVtImageIYUV::V() const
+    {
+    return iV;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::UVPlaneWidth() const
+// -----------------------------------------------------------------------------
+EXPORT_C TInt CVtImageIYUV::UVPlaneWidth() const
+    {
+    return iSize.iWidth / 2;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::UVPlaneHeight() const
+// -----------------------------------------------------------------------------
+EXPORT_C TInt CVtImageIYUV::UVPlaneHeight() const
+    {
+    return iSize.iHeight / 2;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::NeedHeapLock() const
+// -----------------------------------------------------------------------------
+TBool CVtImageIYUV::NeedHeapLock() const
+    {
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::DisplayMode() const
+// -----------------------------------------------------------------------------
+CVtImage::TVtDisplayMode CVtImageIYUV::DisplayMode() const
+    {
+    return CVtImage::EVtColorIYUV;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::Size() const
+// -----------------------------------------------------------------------------
+TSize CVtImageIYUV::Size() const
+    {
+    return iSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::BytesPerRow() const
+// -----------------------------------------------------------------------------
+TInt CVtImageIYUV::BytesPerRow() const
+    {
+    return iSize.iWidth;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::DataAddress() const
+// -----------------------------------------------------------------------------
+TUint32* CVtImageIYUV::DataAddress() const
+    {
+    return reinterpret_cast< TUint32* >( iY );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::LineAddress( TInt aLine ) const
+// -----------------------------------------------------------------------------
+TUint32* CVtImageIYUV::LineAddress( TInt aLine ) const
+    {
+    if( aLine < 0 )
+        {
+        aLine = 0;
+        }
+    else if( aLine > Size().iHeight - 1 )
+        {
+        aLine = Size().iHeight - 1;
+        }
+    return reinterpret_cast< TUint32* >( 
+        reinterpret_cast< TUint8* >( DataAddress() ) + BytesPerRow() * aLine );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::ImageSize() const
+// -----------------------------------------------------------------------------
+TInt CVtImageIYUV::ImageSize() const
+    {
+    return UVPlaneWidth() * UVPlaneHeight() * 2 + BytesPerRow() * iSize.iHeight;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::CVtImageIYUV( const TSize& aSize )
+// -----------------------------------------------------------------------------
+CVtImageIYUV::CVtImageIYUV( const TSize& aSize )
+: CVtImage( CVtImage::EVtImageIYUV ), iSize( aSize ), iPtrImage( 0, 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::ConstructL( const TDesC8* aImage )
+// -----------------------------------------------------------------------------
+void CVtImageIYUV::ConstructL( const TDesC8* aImage )
+    {   
+    ValidateSizeL( iSize );
+    if( !aImage )
+        {
+        // empty image
+        TInt size( ImageSize() );
+        iImage = HBufC8::NewL( size );
+        iImage->Des().SetLength( size );
+        }
+    else
+        {
+        // prefilled image
+        CheckDescriptorSizeL( *aImage );
+        iImage = aImage->AllocL();
+        }
+    // set ptr descriptor
+    iPtrImage.Set( iImage->Des() );
+    // set YUV pointers
+    SetYUVPointers();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::ValidateSizeL( const TSize& aSize )
+// -----------------------------------------------------------------------------
+void CVtImageIYUV::ValidateSizeL( const TSize& aSize )
+    {
+    if( ( aSize.iWidth & 1 ) || ( aSize.iHeight & 1 ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::CheckDescriptorSizeL( const TDesC8& aImage )
+// -----------------------------------------------------------------------------
+void CVtImageIYUV::CheckDescriptorSizeL( const TDesC8& aImage )
+    {
+    if( aImage.Size() != ImageSize() )
+        {
+        User::Leave( KErrArgument );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageIYUV::SetYUVPointers()
+// -----------------------------------------------------------------------------
+void CVtImageIYUV::SetYUVPointers()
+    {
+    iY = const_cast< TUint8* >( iPtrImage.Ptr() );
+    iU = iY + BytesPerRow() * iSize.iHeight;
+    iV = iU + UVPlaneWidth() * UVPlaneHeight();
+    }
+
+// End of File  
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageRotator.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,244 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "cvtimagerotator.h"
+#include "CVtImageRotatorImplMirrorFlip.h"
+#include "CVtImageRotatorImplClockwise.h"
+
+// CONSTANTS
+
+_LIT( KModuleName, "CVtImageRotator" );
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::NewL( MVtImageRotatorObserver& aObserver,
+//  TPriority aPriority )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageRotator* CVtImageRotator::NewL(
+    MVtImageRotatorObserver& aObserver,
+    TPriority aPriority)
+    {
+    CVtImageRotator* self = new ( ELeave ) CVtImageRotator( aObserver, aPriority );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::~CVtImageRotator()
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageRotator::~CVtImageRotator()
+    {
+	Cancel();
+    delete iAsyncCallBack;
+    delete iHeapLock;
+	delete iRotatorImpl;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::ScaleL( const CVtImage& aSource,
+//  CVtImage& aTarget, const TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageRotator::RotateL( const CVtImage& aSource,
+    CVtImage& aTarget, const TRotationAngle& aAngle )
+    {
+    if ( !IsActive() )
+        {
+        CreateRotatorL( aAngle );
+        iRotatorImpl->SetSourceTargetL( aSource, aTarget );
+        iCancelled = EFalse;
+        Activate();
+        iAsyncCallBack->CallBack();
+        }
+    else
+        {
+        User::Panic( KModuleName(), EBusy );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::Rotate
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageRotator::Rotate(
+    const CVtImage& aSource,
+    CVtImage& aTarget, const TRotationAngle& aAngle )
+    {
+    TRAPD( result, RotateL( aSource, aTarget, aAngle ) );
+    if ( result != KErrNone )
+        {
+        Activate();
+        Signal( result );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::CVtImageRotator( MVtImageRotatorObserver& aObserver,
+//  TPriority aPriority )
+// -----------------------------------------------------------------------------
+CVtImageRotator::CVtImageRotator( MVtImageRotatorObserver& aObserver,
+                                  TPriority aPriority )
+: CActive( aPriority ), iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::ConstructL()
+// -----------------------------------------------------------------------------
+void CVtImageRotator::ConstructL()
+    {
+    iHeapLock = new ( ELeave ) CFbsBitmap();
+    iHeapLock->Create( TSize( 1, 1 ), EColor256 );
+    iAsyncCallBack = new ( ELeave )
+        CAsyncCallBack( TCallBack( StaticRotate, this ), Priority() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::CreateRotatorL( const TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+void CVtImageRotator::CreateRotatorL( const TRotationAngle& aAngle )
+    {
+    if( iRotatorImpl )
+        {
+        if( iRotatorImpl->SupportsRotationAngle( aAngle ) )
+            {
+            iRotatorImpl->SetAngle( aAngle );
+            return;
+            }
+        delete iRotatorImpl;
+        iRotatorImpl = 0;
+        }
+
+    switch( aAngle )
+        {
+        case E90DegreesClockwise:
+        case E270DegreesClockwise:
+            iRotatorImpl =
+                new ( ELeave ) CVtImageRotatorImplClockwise( aAngle );
+            break;
+
+        case EMirrorHorizontalAxis:
+        case EFlipVerticalAxis:
+        case E180DegreesClockwise:
+            iRotatorImpl =
+                new ( ELeave ) CVtImageRotatorImplMirrorFlip( aAngle );
+            break;
+
+        default:
+            User::Leave( KErrNotSupported );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::Activate
+// -----------------------------------------------------------------------------
+void CVtImageRotator::Activate()
+    {
+    iStatus = KRequestPending;
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::Signal( TInt aError )
+// -----------------------------------------------------------------------------
+void CVtImageRotator::Signal( TInt aError )
+    {
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, aError );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::RunL()
+// -----------------------------------------------------------------------------
+void CVtImageRotator::RunL()
+    {
+    iObserver.RotationFinished( iStatus.Int() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::DoCancel()
+// -----------------------------------------------------------------------------
+void CVtImageRotator::DoCancel()
+    {
+    if ( iStatus == KRequestPending )
+        {
+        iCancelled = ETrue;
+        Signal( KErrCancel );
+        iObserver.RotationFinished( KErrCancel );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::StaticRotate()
+// -----------------------------------------------------------------------------
+TInt CVtImageRotator::StaticRotate( TAny* aPtr )
+    {
+    CVtImageRotator* self = reinterpret_cast< CVtImageRotator* >( aPtr );
+    self->DoRotate();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotator::DoRotate
+// -----------------------------------------------------------------------------
+void CVtImageRotator::DoRotate()
+    {
+    if ( !iCancelled )
+        {
+        TBool more;
+        TBool needsLock = iRotatorImpl->NeedHeapLock();
+        if( needsLock )
+            {
+            iHeapLock->LockHeap( ETrue );
+            }
+        TInt result = iRotatorImpl->Rotate( more );
+        if( needsLock )
+            {
+            iHeapLock->UnlockHeap( ETrue );
+            }
+        if( !more || ( result != KErrNone ) )
+            {
+            Signal( result );
+            }
+        else
+            {
+            iAsyncCallBack->CallBack();
+            }
+        }
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageRotatorImpl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,81 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageRotatorImpl.h"
+#include "cvtimage.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ========================== CVtImageRotatorImpl ==============================
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImpl::SetSourceTargetL( 
+//  const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImpl::SetSourceTargetL( 
+    const CVtImage& aSource, 
+    CVtImage& aTarget )
+    {
+    iSource = iTarget = 0;
+    ValidateSourceTargetL( aSource, aTarget );
+    iSource = &aSource;
+    iTarget = &aTarget;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImpl::NeedHeapLock() const
+// -----------------------------------------------------------------------------
+TBool CVtImageRotatorImpl::NeedHeapLock() const
+    {
+    return iSource->NeedHeapLock() || iTarget->NeedHeapLock();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImpl::SetAngle( 
+//  const CVtImageRotator::TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImpl::SetAngle( const CVtImageRotator::TRotationAngle& aAngle )
+    {
+    iAngle = aAngle;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImpl::CVtImageRotatorImpl( 
+//  const CVtImageRotator::TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+CVtImageRotatorImpl::CVtImageRotatorImpl( const CVtImageRotator::TRotationAngle& aAngle )
+: iAngle( aAngle )
+    {
+    }
+
+// End of File  
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageRotatorImplClockwise.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,372 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageRotatorImplClockwise.h"
+#include "cvtimage.h"
+#include "CVtImageIYUV.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageRotatorImplClockwise =======================
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::CVtImageRotatorImplClockwise(
+//  const CVtImageRotator::TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+CVtImageRotatorImplClockwise::CVtImageRotatorImplClockwise(
+    const CVtImageRotator::TRotationAngle& aAngle ) : CVtImageRotatorImpl( aAngle )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::Rotate( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageRotatorImplClockwise::Rotate( TBool& aContinue )
+    {
+    __IF_DEBUG( Print( _L( "ImageRotator [%d]: CVtImageRotatorImplClockwise::Rotate() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt result( KErrNone );
+
+    aContinue = EFalse;
+
+    DoRotate();
+
+    __IF_DEBUG( Print( _L( "ImageRotator [%d]: CVtImageRotatorImplClockwise::Rotate() <<" ), RThread().Id().operator TUint() ) );
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::ValidateSourceTargetL(
+//  const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplClockwise::ValidateSourceTargetL(
+    const CVtImage& aSource,
+    CVtImage& aTarget )
+    {
+    // SourceWidth == TargetHeight && SourceHeight == TargetWidth
+    if( ( aSource.Size().iWidth != aTarget.Size().iHeight ) ||
+        ( aSource.Size().iHeight != aTarget.Size().iWidth ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Displaymodes must match
+    if( aSource.DisplayMode() != aTarget.DisplayMode() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Check that displaymode is one of the supported
+    switch( aSource.DisplayMode() )
+        {
+        case CVtImage::EVtColor4K:
+        case CVtImage::EVtColor64K:
+        case CVtImage::EVtColor16M:
+        case CVtImage::EVtColor16MU:
+        case CVtImage::EVtColor16MA:
+        case CVtImage::EVtColorIYUV:
+            break;
+
+        default:
+            User::Leave( KErrNotSupported );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::ValidateSourceTargetL(
+//  const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+TBool CVtImageRotatorImplClockwise::SupportsRotationAngle(
+    const CVtImageRotator::TRotationAngle& aAngle )
+    {
+    TBool result( EFalse );
+
+    if( ( aAngle == CVtImageRotator::E90DegreesClockwise ) ||
+        ( aAngle == CVtImageRotator::E270DegreesClockwise ) )
+        {
+        result = ETrue;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// void CVtImageRotatorImplClockwise::DoRotate()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplClockwise::DoRotate()
+    {
+    TInt bytesPerRow( iSource->BytesPerRow() );
+
+    TInt height( iSource->Size().iHeight );
+
+    TInt width( iSource->Size().iWidth );
+
+    TInt targetWidth( iTarget->Size().iWidth );
+
+    TInt targetHeight( iTarget->Size().iHeight );
+
+    TInt targetBytesPerRow( iTarget->BytesPerRow() );
+
+    switch( iSource->DisplayMode() )
+        {
+        // DisplayMode: 4K and 64K
+        case CVtImage::EVtColor4K:
+        case CVtImage::EVtColor64K:
+            {
+            const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+            TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+            TInt offsetPerRow( -2 );
+
+            if( iAngle == CVtImageRotator::E90DegreesClockwise )
+                {
+                d += targetBytesPerRow - 2;
+
+                if( targetWidth & 1 )
+                    {
+                    d -= 2;
+                    }
+                }
+            else
+                {
+                d += targetBytesPerRow * ( targetHeight - 1 );
+
+                targetBytesPerRow = -targetBytesPerRow;
+
+                offsetPerRow = 2;
+                }
+
+            targetBytesPerRow /= 2; // in loop we need 16-bit precalculated
+
+            for( TInt y = height - 1; y >= 0; y-- )
+                {
+                register const TUint16* tempS = reinterpret_cast< const TUint16* >( s );
+
+                register TUint16* tempD = reinterpret_cast< TUint16* >( d );
+
+                for( register TInt x = width - 1; x >= 0; x-- )
+                    {
+                    *tempD = *tempS++;
+                    tempD += targetBytesPerRow;
+                    }
+
+                s += bytesPerRow;
+                d += offsetPerRow;
+                }
+            }
+            break;
+
+        // DisplayMode: 16M
+        case CVtImage::EVtColor16M:
+            {
+            const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+            TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+            TInt offsetPerRow( -3 );
+
+            if( iAngle == CVtImageRotator::E90DegreesClockwise )
+                {
+                d += targetWidth * 3 - 3;
+                }
+            else
+                {
+                d += targetBytesPerRow * ( targetHeight - 1 );
+
+                targetBytesPerRow = -targetBytesPerRow;
+
+                offsetPerRow = 3;
+                }
+
+            for( TInt y = height - 1; y >= 0; y-- )
+                {
+                register const TUint8* tempS = s;
+
+                register TUint8* tempD = d;
+
+                for( register TInt x = width - 1; x >= 0; x-- )
+                    {
+                    tempD[ 0 ] = *tempS++;
+                    tempD[ 1 ] = *tempS++;
+                    tempD[ 2 ] = *tempS++;
+                    tempD += targetBytesPerRow;
+                    }
+
+                s += bytesPerRow;
+                d += offsetPerRow;
+                }
+            }
+            break;
+
+        // DisplayMode: 16MU and 16MA
+        case CVtImage::EVtColor16MU:
+        case CVtImage::EVtColor16MA:
+            {
+            const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+            TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+            TInt offsetPerRow( -4 );
+
+            if( iAngle == CVtImageRotator::E90DegreesClockwise )
+                {
+                d += targetBytesPerRow - 4;
+                }
+            else
+                {
+                d += targetBytesPerRow * ( targetHeight - 1 );
+
+                targetBytesPerRow = -targetBytesPerRow;
+
+                offsetPerRow = 4;
+                }
+
+            targetBytesPerRow /= 4; // in loop we need 32-bit precalculated
+
+            for( TInt y = height - 1; y >= 0; y-- )
+                {
+                register const TUint32* tempS = reinterpret_cast< const TUint32* >( s );
+
+                register TUint32* tempD = reinterpret_cast< TUint32* >( d );
+
+                for( register TInt x = width - 1; x >= 0; x-- )
+                    {
+                    *tempD = *tempS++;
+                    tempD += targetBytesPerRow;
+                    }
+
+                s += bytesPerRow;
+                d += offsetPerRow;
+                }
+            }
+            break;
+
+        // DisplayMode: IYUV
+        case CVtImage::EVtColorIYUV:
+            {
+            const CVtImageIYUV* src = reinterpret_cast< const CVtImageIYUV* >( iSource );
+            CVtImageIYUV* trg = reinterpret_cast< CVtImageIYUV* >( iTarget );
+            RotatePlane
+                (
+                src->Y(),
+                trg->Y(),
+                width,
+                height,
+                bytesPerRow,
+                targetHeight,
+                targetBytesPerRow
+                );
+
+            RotatePlane
+                (
+                src->U(),
+                trg->U(),
+                src->UVPlaneWidth(),
+                src->UVPlaneHeight(),
+                src->UVPlaneWidth(),
+                trg->UVPlaneHeight(),
+                trg->UVPlaneWidth()
+                );
+
+            RotatePlane
+                (
+                src->V(),
+                trg->V(),
+                src->UVPlaneWidth(),
+                src->UVPlaneHeight(),
+                src->UVPlaneWidth(),
+                trg->UVPlaneHeight(),
+                trg->UVPlaneWidth()
+                );
+
+            }
+            break;
+
+        default:
+            break;
+
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplClockwise::RotatePlane(
+//    const TUint8* aSource,
+//    TUint8* aTarget,
+//    TInt aSourceWidth,
+//    TInt aSourceHeight,
+//    TInt aSourceBytesPerRow,
+//    TInt aTargetHeight,
+//    TInt aTargetBytesPerRow )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplClockwise::RotatePlane(
+    const TUint8* aSource,
+    TUint8* aTarget,
+    TInt aSourceWidth,
+    TInt aSourceHeight,
+    TInt aSourceBytesPerRow,
+    TInt aTargetHeight,
+    TInt aTargetBytesPerRow )
+    {
+    TInt offsetPerRow( -1 );
+
+    if( iAngle == CVtImageRotator::E90DegreesClockwise )
+        {
+        aTarget += aTargetBytesPerRow - 1;
+        }
+    else
+        {
+        aTarget += aTargetBytesPerRow * ( aTargetHeight - 1 );
+        aTargetBytesPerRow = -aTargetBytesPerRow;
+        offsetPerRow = -offsetPerRow;
+        }
+
+    for( TInt y = aSourceHeight - 1; y >= 0; y-- )
+        {
+        register const TUint8* tempS = aSource;
+        register TUint8* tempD = aTarget;
+        for( register TInt x = aSourceWidth - 1; x >= 0; x-- )
+            {
+            *tempD = *tempS++;
+            tempD += aTargetBytesPerRow;
+            }
+
+        aSource += aSourceBytesPerRow;
+        aTarget += offsetPerRow;
+        }
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageRotatorImplMirrorFlip.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,589 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageRotatorImplMirrorFlip.h"
+#include "cvtimage.h"
+#include "CVtImageIYUV.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageRotatorImplMirrorFlip =======================
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::CVtImageRotatorImplMirrorFlip(
+//  const CVtImageRotator::TRotationAngle& aAngle )
+// -----------------------------------------------------------------------------
+CVtImageRotatorImplMirrorFlip::CVtImageRotatorImplMirrorFlip(
+    const CVtImageRotator::TRotationAngle& aAngle ) : CVtImageRotatorImpl( aAngle )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Rotate( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageRotatorImplMirrorFlip::Rotate( TBool& aContinue )
+    {
+    __IF_DEBUG( Print( _L( "ImageRotator [%d]: CVtImageRotatorImplMirrorFlip::Rotate() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt result( KErrNone );
+
+    aContinue = EFalse;
+
+    TBool isSameBitmap( iSource->DataAddress() == iTarget->DataAddress() );
+
+    if( iAngle == CVtImageRotator::EFlipVerticalAxis )
+        {
+        // Are source and target referencing same bitmap?
+        if( isSameBitmap  )
+            {
+            // YES: Flip inside bitmap
+            Flip( *iTarget );
+            }
+        else
+            {
+            // NO: Use flipping from source to target
+            Flip();
+            }
+        }
+    else if( iAngle == CVtImageRotator::EMirrorHorizontalAxis )
+        {
+        // Are source and target referencing same bitmap?
+        if( isSameBitmap )
+            {
+            // YES: Mirror inside bitmap
+            Mirror( *iTarget );
+            }
+        else
+            {
+            // NO: Mirror from source to target
+            Mirror();
+            }
+        }
+    else if( iAngle == CVtImageRotator::E180DegreesClockwise )
+        {
+        // Are source and target referencing same bitmap?
+        if( isSameBitmap )
+            {
+            // YES: Mirror inside bitmap
+            Mirror( *iTarget );
+            }
+        else
+            {
+            // NO: Mirror from source to target
+            Mirror();
+            }
+        Flip( *iTarget );
+        }
+
+    __IF_DEBUG( Print( _L( "ImageRotator [%d]: CVtImageRotatorImplMirrorFlip::Rotate() <<" ), RThread().Id().operator TUint() ) );
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::ValidateSourceTargetL(
+//  const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::ValidateSourceTargetL(
+    const CVtImage& aSource,
+    CVtImage& aTarget )
+    {
+
+
+    // Sizes must match
+    if( aSource.Size() != aTarget.Size() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Displaymodes must match
+    if( aSource.DisplayMode() != aTarget.DisplayMode() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Check that displaymode is one of the supported
+    switch( aSource.DisplayMode() )
+        {
+        case CVtImage::EVtColor4K:
+        case CVtImage::EVtColor64K:
+        case CVtImage::EVtColor16M:
+        case CVtImage::EVtColor16MU:
+        case CVtImage::EVtColor16MA:
+        case CVtImage::EVtColorIYUV:
+            break;
+
+        default:
+            User::Leave( KErrNotSupported );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::ValidateSourceTargetL(
+//  const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+TBool CVtImageRotatorImplMirrorFlip::SupportsRotationAngle(
+    const CVtImageRotator::TRotationAngle& aAngle )
+    {
+    TBool result( EFalse );
+
+    if( ( aAngle == CVtImageRotator::EMirrorHorizontalAxis ) ||
+        ( aAngle == CVtImageRotator::EFlipVerticalAxis ) ||
+        ( aAngle == CVtImageRotator::E180DegreesClockwise ) )
+        {
+        result = ETrue;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Mirror()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::Mirror()
+    {
+    TInt bytesPerRow( iSource->BytesPerRow() );
+
+    TInt height( iSource->Size().iHeight );
+
+    TInt width( iSource->Size().iWidth );
+
+    switch( iSource->DisplayMode() )
+        {
+        // DisplayMode: 4K and 64K
+        case CVtImage::EVtColor4K:
+        case CVtImage::EVtColor64K:
+            {
+            const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+            TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+            d += bytesPerRow;
+
+            if( width & 1 )
+                {
+                d -= 2;
+                }
+
+            for( TInt y = height - 1; y >= 0; y-- )
+                {
+                register const TUint16* tempS = reinterpret_cast< const TUint16* >( s );
+
+                register TUint16* tempD = reinterpret_cast< TUint16* >( d );
+
+                for( register TInt x = width - 1; x >= 0; x-- )
+                    {
+                    *--tempD = *tempS++;
+                    }
+
+                s += bytesPerRow;
+
+                d += bytesPerRow;
+                }
+            }
+            break;
+
+        // DisplayMode: 16M
+        case CVtImage::EVtColor16M:
+            {
+            const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+            TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+            d += width * 3;
+
+            for( TInt y = height - 1; y >= 0; y-- )
+                {
+                const TUint8* tempS = s;
+
+                TUint8* tempD = d - 3;
+
+                for( TInt x = width - 1; x >= 0; x-- )
+                    {
+                    tempD[ 0 ] = *tempS++;
+                    tempD[ 1 ] = *tempS++;
+                    tempD[ 2 ] = *tempS++;
+                    tempD -= 3;
+                    }
+
+                s += bytesPerRow;
+
+                d += bytesPerRow;
+                }
+            }
+            break;
+
+        // DisplayMode: 16MU and 16MA
+        case CVtImage::EVtColor16MU:
+        case CVtImage::EVtColor16MA:
+            {
+            const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+            TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+            d += bytesPerRow;
+
+            for( TInt y = height - 1; y >= 0; y-- )
+                {
+                register const TUint32* tempS = reinterpret_cast< const TUint32* >( s );
+                register TUint32* tempD = reinterpret_cast< TUint32* >( d );
+
+                for( TInt x = width - 1; x >= 0; x-- )
+                    {
+                    *--tempD = *tempS++;
+                    }
+
+                s += bytesPerRow;
+
+                d += bytesPerRow;
+                }
+            }
+            break;
+
+        // IYUV
+        case CVtImage::EVtColorIYUV:
+            MirrorIYUV( reinterpret_cast< const CVtImageIYUV& >( *iSource ), reinterpret_cast< CVtImageIYUV& >( *iTarget ) );
+            break;
+
+        default:
+            break;
+
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Mirror( CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::Mirror( CVtImage& aTarget )
+    {
+    TInt bytesPerRow( aTarget.BytesPerRow() );
+
+    TInt height( aTarget.Size().iHeight );
+
+    TInt width( aTarget.Size().iWidth );
+
+    switch( aTarget.DisplayMode() )
+        {
+        // DisplayMode: 4K and 64K
+        case CVtImage::EVtColor4K:
+        case CVtImage::EVtColor64K:
+            {
+            TUint8* d = reinterpret_cast< TUint8* >( aTarget.DataAddress() );
+
+            TUint8* s = reinterpret_cast< TUint8* >( d );
+
+            d += bytesPerRow;
+
+            if( width & 1 )
+                {
+                d -= 2;
+                }
+
+            for( TInt y = height - 1; y >= 0; y-- )
+                {
+                register TUint16* tempS = reinterpret_cast< TUint16* >( s );
+
+                register TUint16* tempD = reinterpret_cast< TUint16* >( d );
+
+                for( register TInt x = width/2 - 1; x >= 0; x-- )
+                    {
+                    TUint16 p = *tempS;
+                    *tempS++ = *--tempD;
+                    *tempD = p;
+                    }
+
+                s += bytesPerRow;
+
+                d += bytesPerRow;
+                }
+            }
+            break;
+
+        // DisplayMode: 16M
+        case CVtImage::EVtColor16M:
+            {
+            TUint8* d = reinterpret_cast< TUint8* >( aTarget.DataAddress() );
+
+            TUint8* s = reinterpret_cast< TUint8* >( d );
+
+            d += width * 3;
+
+            for( TInt y = height - 1; y >= 0; y-- )
+                {
+                TUint8* tempS = s;
+
+                TUint8* tempD = d - 3;
+
+                for( TInt x = width/2 - 1; x >= 0; x-- )
+                    {
+                    TUint8 s = *tempS;
+                    TUint8 t = *tempD;
+                    *tempD++ = s;
+                    *tempS++ = t;
+
+                    s = *tempS;
+                    t = *tempD;
+                    *tempD++ = s;
+                    *tempS++ = t;
+
+                    s = *tempS;
+                    t = *tempD;
+                    *tempD++ = s;
+                    *tempS++ = t;
+
+                    tempD -= 6;
+                    }
+
+                s += bytesPerRow;
+
+                d += bytesPerRow;
+                }
+            }
+            break;
+
+        // DisplayMode: 16MU and 16MA
+        case CVtImage::EVtColor16MU:
+        case CVtImage::EVtColor16MA:
+            {
+            TUint8* d = reinterpret_cast< TUint8* >( aTarget.DataAddress() );
+
+            TUint8* s = reinterpret_cast< TUint8* >( d );
+
+            d += bytesPerRow;
+
+            for( TInt y = height - 1; y >= 0; y-- )
+                {
+                register TUint32* tempS = reinterpret_cast< TUint32* >( s );
+                register TUint32* tempD = reinterpret_cast< TUint32* >( d );
+
+                for( TInt x = width/2 - 1; x >= 0; x-- )
+                    {
+                    TUint32 p = *tempS;
+                    *tempS++ = *--tempD;
+                    *tempD = p;
+                    }
+
+                s += bytesPerRow;
+
+                d += bytesPerRow;
+                }
+            }
+            break;
+
+        // IYUV
+        case CVtImage::EVtColorIYUV:
+            MirrorIYUV( reinterpret_cast< const CVtImageIYUV& >( aTarget ), reinterpret_cast< CVtImageIYUV& >( aTarget ) );
+            break;
+
+        default:
+            break;
+
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::MirrorIYUV( const CVtImageIYUV& aSource,
+//  CVtImageIYUV& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::MirrorIYUV( const CVtImageIYUV& aSource,
+    CVtImageIYUV& aTarget )
+    {
+    MirrorPlane( aSource.Y(), aTarget.Y(), aSource.Size().iWidth,
+        aSource.Size().iHeight, aSource.BytesPerRow() );
+    MirrorPlane( aSource.U(), aTarget.U(), aSource.UVPlaneWidth(),
+        aSource.UVPlaneHeight(), aSource.UVPlaneWidth() );
+    MirrorPlane( aSource.V(), aTarget.V(), aSource.UVPlaneWidth(),
+        aSource.UVPlaneHeight(), aSource.UVPlaneWidth() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::MirrorPlane( TUint8* aSource, TUint8* aTarget,
+//  TInt aWidth, TInt aHeight, TInt aBytesPerRow )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::MirrorPlane( TUint8* aSource,
+    TUint8* aTarget, TInt aWidth, TInt aHeight, TInt aBytesPerRow )
+    {
+    if( aSource != aTarget )
+        {
+        aTarget += aBytesPerRow;
+        for( TInt y = aHeight - 1; y >= 0; y-- )
+            {
+            register const TUint8* tempS = aSource;
+            register TUint8* tempD = aTarget;
+            for( TInt x = aWidth - 1; x >= 0; x-- )
+                {
+                *--tempD = *tempS++;
+                }
+            aSource += aBytesPerRow;
+            aTarget += aBytesPerRow;
+            }
+        }
+    else
+        {
+        aTarget += aBytesPerRow;
+        for( TInt y = aHeight - 1; y >= 0; y-- )
+            {
+            register TUint8* tempS = aSource;
+            register TUint8* tempD = aTarget;
+            for( TInt x = aWidth/2 - 1; x >= 0; x-- )
+                {
+                TUint8 p = *tempS;
+                *tempS++ = *--tempD;
+                *tempD = p;
+                }
+            aSource += aBytesPerRow;
+            aTarget += aBytesPerRow;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Flip()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::Flip()
+    {
+    if( iSource->DisplayMode() == CVtImage::EVtColorIYUV )
+        {
+        FlipIYUV
+            (
+            reinterpret_cast< const CVtImageIYUV& >( *iSource ),
+            reinterpret_cast< CVtImageIYUV& >( *iTarget )
+            );
+        }
+    else
+        {
+        TInt bytesPerRow( iSource->BytesPerRow() );
+
+        TInt height( iSource->Size().iHeight );
+
+        const TUint8* s = reinterpret_cast< const TUint8* >( iSource->DataAddress() );
+
+        TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+        d += ( height - 1 ) * bytesPerRow;
+
+        for( TInt y = height - 1; y >= 0; y-- )
+            {
+            Mem::Copy( d, s, bytesPerRow );
+            s += bytesPerRow;
+            d -= bytesPerRow;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::FlipIYUV()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::FlipIYUV
+    (
+    const CVtImageIYUV& aSource,
+    CVtImageIYUV& aTarget
+    )
+    {
+    FlipPlane( aSource.Y(), aTarget.Y(), aSource.Size().iHeight, aSource.BytesPerRow() );
+    FlipPlane( aSource.U(), aTarget.U(), aSource.UVPlaneHeight(), aSource.UVPlaneWidth() );
+    FlipPlane( aSource.V(), aTarget.V(), aSource.UVPlaneHeight(), aSource.UVPlaneWidth() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::FlipPlane()
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::FlipPlane
+    (
+    TUint8* aSource,
+    TUint8* aTarget,
+    TInt aHeight,
+    TInt aBytesPerRow
+    )
+    {
+    TBool doSwap = ( aSource == aTarget );
+
+    aTarget += ( aHeight - 1 ) * aBytesPerRow;
+
+    if( doSwap )
+        {
+        for( TInt y = aHeight / 2 - 1; y >= 0; y-- )
+            {
+            Mem::Swap( aTarget, aSource, aBytesPerRow );
+            aSource += aBytesPerRow;
+            aTarget -= aBytesPerRow;
+            }
+        }
+    else
+        {
+        for( TInt y = aHeight - 1; y >= 0; y-- )
+            {
+            Mem::Copy( aTarget, aSource, aBytesPerRow );
+            aSource += aBytesPerRow;
+            aTarget -= aBytesPerRow;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageRotatorImplMirrorFlip::Flip( CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageRotatorImplMirrorFlip::Flip( CVtImage& aTarget )
+    {
+    if( iSource->DisplayMode() == CVtImage::EVtColorIYUV )
+        {
+        FlipIYUV
+            (
+            reinterpret_cast< const CVtImageIYUV& >( aTarget ),
+            reinterpret_cast< CVtImageIYUV& >( aTarget )
+            );
+        }
+    else
+        {
+        TInt bytesPerRow( aTarget.BytesPerRow() );
+
+        TInt height( aTarget.Size().iHeight );
+
+        TUint8* s = reinterpret_cast< TUint8* >( aTarget.DataAddress() );
+
+        TUint8* d = s;
+
+        d += ( height - 1 ) * bytesPerRow;
+
+        for( TInt y = height / 2 - 1; y >= 0; y-- )
+            {
+            Mem::Swap( d, s, bytesPerRow );
+            s += bytesPerRow;
+            d -= bytesPerRow;
+            }
+        }
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScaler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,273 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScaler.h"
+#include "CVtImageScalerImpl.h"
+#include "CVtImageScalerImplNearest.h"
+#include "CVtImageScalerImplWeightedAverage.h"
+#include "CVtImageScalerImplBilinear.h"
+
+// CONSTANTS
+
+_LIT( KModuleName, "CVtImageScaler" );
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::NewL( MVtImageScalerObserver& aObserver, TQuality aQuality,
+//   TPriority aPriority )
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageScaler* CVtImageScaler::NewL(
+    MVtImageScalerObserver& aObserver,
+    TQuality aQuality,
+    TPriority aPriority )
+    {
+    CVtImageScaler* self = new ( ELeave ) CVtImageScaler( aObserver, aPriority );
+    CleanupStack::PushL( self );
+    self->ConstructL( aQuality );
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::~CVtImageScaler()
+// -----------------------------------------------------------------------------
+EXPORT_C CVtImageScaler::~CVtImageScaler()
+    {
+	Cancel();
+    delete iAsyncCallBack;
+    delete iHeapLock;
+    delete iScalerImpl;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::SetQualityL( TQuality aQuality )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageScaler::SetQualityL( TQuality aQuality )
+    {
+    delete iScalerImpl;
+    iScalerImpl = 0;
+
+    switch( aQuality )
+        {
+        case ENearest:
+            iScalerImpl = new ( ELeave ) CVtImageScalerImplNearest();
+            break;
+
+        case EWeightedAverage:
+            iScalerImpl = new ( ELeave ) CVtImageScalerImplWeightedAverage();
+            break;
+
+        case EBilinear:
+            iScalerImpl = new ( ELeave ) CVtImageScalerImplBilinear();
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::ScaleL( const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageScaler::ScaleL(
+    const CVtImage& aSource,
+    CVtImage& aTarget )
+    {
+    if( !IsActive() )
+        {
+        if( !iScalerImpl )
+            {
+            User::Leave( KErrNotReady );
+            }
+        iScalerImpl->SetSourceTargetL( aSource, aTarget );
+        iCancelled = EFalse;
+        Activate();
+        iAsyncCallBack->CallBack();
+        }
+    else
+        {
+        User::Panic( KModuleName(), EBusy );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::Scale( const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageScaler::Scale(
+    const CVtImage& aSource,
+    CVtImage& aTarget )
+    {
+    TRAPD( result, ScaleL( aSource, aTarget ) );
+    if( result != KErrNone )
+        {
+        Activate();
+        Signal( result );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::ScaleNowL( const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+EXPORT_C void CVtImageScaler::ScaleNowL(
+    const CVtImage& aSource, CVtImage& aTarget )
+    {
+    if( !iScalerImpl )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    iScalerImpl->SetSourceTargetL( aSource, aTarget );
+
+    TInt result;
+    TBool more;
+    TBool needsLock( iScalerImpl->NeedHeapLock() );
+    do
+        {
+
+        if ( needsLock )
+            {
+            iHeapLock->LockHeap( ETrue );
+            }
+
+        result = iScalerImpl->Scale( more );
+
+        if ( needsLock )
+            {
+            iHeapLock->UnlockHeap( ETrue );
+            }
+
+        } while ( more && ( result == KErrNone ) );
+
+    User::LeaveIfError( result );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::CVtImageScaler()
+// -----------------------------------------------------------------------------
+CVtImageScaler::CVtImageScaler( MVtImageScalerObserver& aObserver, TPriority aPriority )
+: CActive( aPriority ), iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::ConstructL( TQuality aQuality )
+// -----------------------------------------------------------------------------
+void CVtImageScaler::ConstructL( TQuality aQuality )
+    {
+    SetQualityL( aQuality );
+    iHeapLock = new ( ELeave ) CFbsBitmap();
+    iHeapLock->Create( TSize( 1, 1 ), EColor256 );
+    iAsyncCallBack = new ( ELeave )
+        CAsyncCallBack( TCallBack( StaticScale, this ), Priority() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::Activate
+// -----------------------------------------------------------------------------
+void CVtImageScaler::Activate()
+    {
+    iStatus = KRequestPending;
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::Signal( TInt aError )
+// -----------------------------------------------------------------------------
+void CVtImageScaler::Signal( TInt aError )
+    {
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, aError );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::RunL()
+// -----------------------------------------------------------------------------
+void CVtImageScaler::RunL()
+    {
+    iObserver.ScalingFinished( iStatus.Int() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::DoCancel()
+// -----------------------------------------------------------------------------
+void CVtImageScaler::DoCancel()
+    {
+    if ( iStatus == KRequestPending )
+        {
+        iCancelled = ETrue;
+        Signal( KErrCancel );
+        iObserver.ScalingFinished( KErrCancel );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::StaticScale()
+// -----------------------------------------------------------------------------
+TInt CVtImageScaler::StaticScale( TAny* aPtr )
+    {
+    CVtImageScaler* self = reinterpret_cast< CVtImageScaler* >( aPtr );
+    self->DoScale();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScaler::DoScale
+// -----------------------------------------------------------------------------
+void CVtImageScaler::DoScale()
+    {
+    if ( !iCancelled )
+        {
+        TBool more;
+        TBool needsLock = iScalerImpl->NeedHeapLock();
+        if ( needsLock )
+            {
+            iHeapLock->LockHeap( ETrue );
+            }
+        TInt result = iScalerImpl->Scale( more );
+        if ( needsLock )
+            {
+            iHeapLock->UnlockHeap( ETrue );
+            }
+        if ( !more || ( result != KErrNone ) )
+            {
+            Signal( result );
+            }
+        else
+            {
+            iAsyncCallBack->CallBack();
+            }
+        }
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScalerImpl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,157 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScalerImpl.h"
+#include "cvtimage.h"
+#include "CVtImageBitmap.h"
+
+// MACROS
+
+#ifdef _DEBUG
+    #include <e32debug.h>
+    #define PRINT RDebug::Print
+    #define _IFDBG(a) a
+#else
+    #define PRINT
+    #define _IFDBG(a)
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ========================== CVtImageScalerImpl ==============================
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::CVtImageScalerImpl()
+// -----------------------------------------------------------------------------
+CVtImageScalerImpl::CVtImageScalerImpl() : CActive( EPriorityStandard )
+    {
+    _IFDBG(PRINT( _L("ScaleImpl.Ctor<") ));
+    CActiveScheduler::Add( this );
+    _IFDBG(PRINT( _L("ScaleImpl.Ctor>") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::~CVtImageScalerImpl()
+// -----------------------------------------------------------------------------
+CVtImageScalerImpl::~CVtImageScalerImpl()
+    {
+    _IFDBG(PRINT( _L("ScaleImpl.~<") ));
+    Cancel();
+    delete iScaler;
+    _IFDBG(PRINT( _L("ScaleImpl.~>") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::SetSourceTargetL(
+//  const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::SetSourceTargetL(
+    const CVtImage& aSource,
+    CVtImage& aTarget )
+    {
+    iSource = iTarget = 0;
+    LeaveIfNotValidSizeL( aSource.Size(), TSize( 2, 2 ) );
+    LeaveIfNotValidSizeL( aTarget.Size() );
+    ValidateSourceTargetL( aSource, aTarget );
+    iSource = &aSource;
+    iTarget = &aTarget;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::NeedHeapLock() const
+// -----------------------------------------------------------------------------
+TBool CVtImageScalerImpl::NeedHeapLock() const
+    {
+    return iSource->NeedHeapLock() || iTarget->NeedHeapLock();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::ScaleWithBitmapScalerL()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::ScaleWithBitmapScalerL(
+    const CBitmapScaler::TQualityAlgorithm
+#ifdef _DEBUG
+    aQuality
+#endif // _DEBUG
+     )
+    {
+    _IFDBG(PRINT( _L("ScaleImpl.ScaleWithBitmapScalerL<") ));
+    if ( IsActive() || iActiveSchedulerWait.IsStarted() )
+        {
+        _IFDBG(PRINT( _L("ScaleImpl.ScaleWithBitmapScalerL LEAVE KErrInUse>") ));
+        User::Leave( KErrInUse );
+        }
+    _IFDBG(PRINT( _L("ScaleImpl::ScaleWithBitmapScalerL aQuality = %d"), aQuality ));
+    CFbsBitmap& source( static_cast< CVtImageBitmap* >(
+        const_cast< CVtImage* >( iSource ) )->Bitmap() );
+    CFbsBitmap& target( static_cast< CVtImageBitmap* >( iTarget )->Bitmap() );
+    iScaler = CBitmapScaler::NewL();
+    SetActive();
+    iScaler->Scale( &iStatus, source, target, EFalse );
+    iActiveSchedulerWait.Start();
+    delete iScaler; iScaler = NULL;
+    _IFDBG(PRINT( _L("ScaleImpl.ScaleWithBitmapScalerL iStatus.Int() = %d"), iStatus.Int() ));
+    User::LeaveIfError( iStatus.Int() );
+    _IFDBG(PRINT( _L("ScaleImpl.ScaleWithBitmapScalerL>") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::LeaveIfNotValidSizeL(
+//  const TSize& aSize, const TSize aMinSize )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::LeaveIfNotValidSizeL(
+    const TSize& aSize,
+    const TSize aMinSize )
+    {
+    _IFDBG(PRINT( _L("ScaleImpl.LeaveIfNotValidSizeL<") ));
+    if( ( aSize.iWidth < aMinSize.iWidth ) ||
+        ( aSize.iHeight < aMinSize.iHeight ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    _IFDBG(PRINT( _L("ScaleImpl.LeaveIfNotValidSizeL>") ));
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::RunL()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::RunL()
+    {
+    _IFDBG(PRINT( _L("CVtImageScalerImpl.RunL") ));
+    iActiveSchedulerWait.AsyncStop();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImpl::RunL()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImpl::DoCancel()
+    {
+    _IFDBG(PRINT( _L("CVtImageScalerImpl.DoCancel") ));
+    iScaler->Cancel();
+    iActiveSchedulerWait.AsyncStop();
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScalerImplBilinear.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1462 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScalerImplBilinear.h"
+#include "cvtimage.h"
+#include "CVtImageScalerMacros.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+const TUint32 KDecimalBits = 14;    // 18.14 pseudo real format,
+                                    // this must be lower than 15!
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageScalerImplBilinear ==========================
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageScalerImplBilinear::Scale( TBool& aContinue )
+    {
+    TInt result( KErrNone );
+
+    aContinue = EFalse;
+
+    // this implementation does not support different display modes for source
+    // and target
+    if( iSource->DisplayMode() != iTarget->DisplayMode() )
+        {
+        return KErrNotSupported;
+        }
+
+    // if sizes are same, just copy the data
+    if( iSource->Size() == iTarget->Size() )
+        {
+        Mem::Copy(
+            iTarget->DataAddress(),
+            iSource->DataAddress(),
+            iTarget->BytesPerRow() * iTarget->Size().iHeight );
+        }
+    else if ( ( iSource->Size().iHeight * 2 == iTarget->Size().iHeight )
+            && ( iSource->Size().iWidth * 2 == iTarget->Size().iWidth ) )
+        {
+        switch( iSource->DisplayMode() )
+            {
+            case CVtImage::EVtColor4K:
+                Scale2x4K64K( 0xeee );  // 0000ggggbbbbrrrr ->
+                break;                  // mask = %0000111011101110 = 0xeee
+
+            case CVtImage::EVtColor64K:
+                Scale2x4K64K( 0xf7de ); // bbbbbggggggrrrrr ->
+                break;                  // mask = %1111011111011110 = 0xf7de
+
+            case CVtImage::EVtColor16M:
+                Scale2x16M();
+                break;
+
+            case CVtImage::EVtColor16MU:
+            case CVtImage::EVtColor16MA:
+                Scale2x16MU16MA();
+                break;
+
+            default:
+                if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+                     iTarget->Type() == CVtImage::EVtImageBitmap )
+                    {
+                    TRAPD( error,
+                        ScaleWithBitmapScalerL(
+                            CBitmapScaler::EMaximumQuality ) );
+                    result = error;
+                    }
+                else
+                    {
+                    result = KErrNotSupported;
+                    }
+            }
+        }
+    else
+        {
+        Initialize();
+
+        switch( iSource->DisplayMode() )
+            {
+            case CVtImage::EVtColor4K:
+                Scale4K();
+                break;
+
+            case CVtImage::EVtColor64K:
+                Scale64K();
+                break;
+
+            case CVtImage::EVtColor16M:
+                Scale16M();
+                break;
+
+            case CVtImage::EVtColor16MU:
+                Scale16MU();
+                break;
+
+            case CVtImage::EVtColor16MA:
+                Scale16MA();
+                break;
+
+            default:
+                if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+                     iTarget->Type() == CVtImage::EVtImageBitmap )
+                    {
+                    TRAPD( error,
+                        ScaleWithBitmapScalerL(
+                            CBitmapScaler::EMaximumQuality ) );
+                    result = error;
+                    }
+                else
+                    {
+                    result = KErrNotSupported;
+                    }
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::ValidateSourceTargetL(
+//  const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::ValidateSourceTargetL(
+    const CVtImage& aSource,
+    CVtImage& aTarget )
+    {
+    if( aSource.DisplayMode() != aTarget.DisplayMode() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    switch( aSource.DisplayMode() )
+        {
+        case CVtImage::EVtColor4K:
+        case CVtImage::EVtColor64K:
+        case CVtImage::EVtColor16M:
+        case CVtImage::EVtColor16MU:
+        case CVtImage::EVtColor16MA:
+            break;
+
+        default:
+            // Scaling for bitmaps is supported for other display modes
+            if ( !( aSource.Type() == CVtImage::EVtImageBitmap &&
+                 aTarget.Type() == CVtImage::EVtImageBitmap ) )
+                {
+                User::Leave( KErrNotSupported );
+                }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Initialize()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Initialize()
+    {
+    iU = ( 1 << KDecimalBits ) * iSource->Size().iWidth /
+        iTarget->Size().iWidth;
+    iV = ( 1 << KDecimalBits ) * iSource->Size().iHeight /
+        iTarget->Size().iHeight;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale4K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale4K()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale4K() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint16* t = reinterpret_cast< TUint16* >( iTarget->DataAddress() );
+
+    TUint32 sourceY( 0 );
+
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+    TUint32 b11( 0 );
+    TUint32 g11( 0 );
+    TUint32 r11( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint16* s = reinterpret_cast< TUint16* >(
+            iSource->LineAddress( sourceY >> KDecimalBits ) );
+        TUint16* snext = reinterpret_cast< TUint16* >(
+            iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+        TUint32 x0prev( TUint32( -1 ) );
+
+        TInt x;
+
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            // If the source is still same then we don't have to fetch
+            // pixels from memory and unpack them again
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+
+                b00 = UNPACK_4K_BLUE( p0 );
+                g00 = UNPACK_4K_GREEN( p0 );
+                r00 = UNPACK_4K_RED( p0 );
+
+                p0 = *( s + x0 + 1 );
+
+                b01 = UNPACK_4K_BLUE( p0 );
+                g01 = UNPACK_4K_GREEN( p0 );
+                r01 = UNPACK_4K_RED( p0 );
+
+                p0 = *( snext + x0 );
+
+                b10 = UNPACK_4K_BLUE( p0 );
+                g10 = UNPACK_4K_GREEN( p0 );
+                r10 = UNPACK_4K_RED( p0 );
+
+                p0 = *( snext + x0 + 1 );
+
+                b11 = UNPACK_4K_BLUE( p0 );
+                g11 = UNPACK_4K_GREEN( p0 );
+                r11 = UNPACK_4K_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *t = 0;
+
+            *t++ = PACK_4K_BGR(
+                bres >> KDecimalBits,
+                gres >> KDecimalBits,
+                rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        // last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            // If the source is still same then we don't have to fetch pixels
+            // from memory and unpack them again
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+                b01 = b00 = UNPACK_4K_BLUE( p0 );
+                g01 = g00 = UNPACK_4K_GREEN( p0 );
+                r01 = r00 = UNPACK_4K_RED( p0 );
+
+                p0 = *( snext + x0 );
+                b11 = b10 = UNPACK_4K_BLUE( p0 );
+                g11 = g10 = UNPACK_4K_GREEN( p0 );
+                r11 = r10 = UNPACK_4K_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *t++ = PACK_4K_BGR(
+                bres >> KDecimalBits,
+                gres >> KDecimalBits,
+                rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        // if width is not even -> then we need to skip one additional byte
+        if( width & 1 )
+            {
+            t++;
+            }
+
+        sourceY += iV;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale4K() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale64K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale64K()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale64K() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint16* t = reinterpret_cast< TUint16* >( iTarget->DataAddress() );
+
+    TUint32 sourceY( 0 );
+
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+    TUint32 b11( 0 );
+    TUint32 g11( 0 );
+    TUint32 r11( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint16* s = reinterpret_cast< TUint16* >(
+            iSource->LineAddress( sourceY >> KDecimalBits ) );
+        TUint16* snext = reinterpret_cast< TUint16* >(
+            iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+        TUint32 x0prev( TUint32( -1 ) );
+
+        TInt x;
+
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            // If the source is still same then we don't have to fetch pixels
+            // from memory and unpack them again
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+
+                b00 = UNPACK_64K_BLUE( p0 );
+                g00 = UNPACK_64K_GREEN( p0 );
+                r00 = UNPACK_64K_RED( p0 );
+
+                p0 = *( s + x0 + 1 );
+
+                b01 = UNPACK_64K_BLUE( p0 );
+                g01 = UNPACK_64K_GREEN( p0 );
+                r01 = UNPACK_64K_RED( p0 );
+
+                p0 = *( snext + x0 );
+
+                b10 = UNPACK_64K_BLUE( p0 );
+                g10 = UNPACK_64K_GREEN( p0 );
+                r10 = UNPACK_64K_RED( p0 );
+
+                p0 = *( snext + x0 + 1 );
+
+                b11 = UNPACK_64K_BLUE( p0 );
+                g11 = UNPACK_64K_GREEN( p0 );
+                r11 = UNPACK_64K_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *t++ = PACK_64K_BGR(
+                bres >> KDecimalBits,
+                gres >> KDecimalBits,
+                rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        // last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            // If the source is still same then we don't have to fetch pixels
+            // from memory and unpack them again
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+                b01 = b00 = UNPACK_64K_BLUE( p0 );
+                g01 = g00 = UNPACK_64K_GREEN( p0 );
+                r01 = r00 = UNPACK_64K_RED( p0 );
+
+                p0 = *( snext + x0 );
+                b11 = b10 = UNPACK_64K_BLUE( p0 );
+                g11 = g10 = UNPACK_64K_GREEN( p0 );
+                r11 = r10 = UNPACK_64K_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *t++ = PACK_64K_BGR(
+                bres >> KDecimalBits,
+                gres >> KDecimalBits,
+                rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        // if width is not even -> then we need to skip one additional byte
+        if( width & 1 )
+            {
+            t++;
+            }
+
+        sourceY += iV;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale64K() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale16M()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16M() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint32 t_pitch = iTarget->BytesPerRow();
+
+    TUint8* t = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+    TUint32 sourceY( 0 );
+
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+    TUint32 b11( 0 );
+    TUint32 g11( 0 );
+    TUint32 r11( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint8* s = reinterpret_cast< TUint8* >(
+            iSource->LineAddress( sourceY >> KDecimalBits ) );
+        TUint8* snext = reinterpret_cast< TUint8* >(
+        iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+        TUint32 x0prev( TUint32( -1 ) );
+
+        TInt x;
+
+        TUint8* d = t;
+
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = ( sourceX >> KDecimalBits ) * 3;
+
+            if( x0 != x0prev )
+                {
+                TUint8* tempSrc = s + x0;
+
+                b00 = *tempSrc++;
+                g00 = *tempSrc++;
+                r00 = *tempSrc++;
+
+                b01 = *tempSrc++;
+                g01 = *tempSrc++;
+                r01 = *tempSrc++;
+
+                tempSrc = snext + x0;
+
+                b10 = *tempSrc++;
+                g10 = *tempSrc++;
+                r10 = *tempSrc++;
+
+                b11 = *tempSrc++;
+                g11 = *tempSrc++;
+                r11 = *tempSrc++;
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *d++ = static_cast< TUint8 >( bres >> KDecimalBits );
+            *d++ = static_cast< TUint8 >( gres >> KDecimalBits );
+            *d++ = static_cast< TUint8 >( rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        // last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = ( sourceX >> KDecimalBits ) * 3;
+
+            if( x0 != x0prev )
+                {
+                TUint8* tempSrc = s + x0;
+
+                b01 = b00 = *tempSrc++;
+                g01 = g00 = *tempSrc++;
+                r01 = r00 = *tempSrc++;
+
+                tempSrc = snext + x0;
+
+                b11 = b10 = *tempSrc++;
+                g11 = g10 = *tempSrc++;
+                r11 = r10 = *tempSrc++;
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *d++ = static_cast< TUint8 >( bres >> KDecimalBits );
+            *d++ = static_cast< TUint8 >( gres >> KDecimalBits );
+            *d++ = static_cast< TUint8 >( rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        t += t_pitch;
+
+        sourceY += iV;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16M() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale16MU()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale16MU()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16MU() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint32* t = iTarget->DataAddress();
+
+    TUint32 sourceY( 0 );
+
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+    TUint32 b11( 0 );
+    TUint32 g11( 0 );
+    TUint32 r11( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint32* s = iSource->LineAddress( sourceY >> KDecimalBits );
+        TUint32* snext = iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+        TUint32 x0prev( TUint32( -1 ) );
+
+        TInt x;
+
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            // If the source is still same then we don't have to fetch pixels
+            // from memory and unpack them again
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+
+                b00 = UNPACK_16MU_BLUE( p0 );
+                g00 = UNPACK_16MU_GREEN( p0 );
+                r00 = UNPACK_16MU_RED( p0 );
+
+                p0 = *( s + x0 + 1 );
+
+                b01 = UNPACK_16MU_BLUE( p0 );
+                g01 = UNPACK_16MU_GREEN( p0 );
+                r01 = UNPACK_16MU_RED( p0 );
+
+                p0 = *( snext + x0 );
+
+                b10 = UNPACK_16MU_BLUE( p0 );
+                g10 = UNPACK_16MU_GREEN( p0 );
+                r10 = UNPACK_16MU_RED( p0 );
+
+                p0 = *( snext + x0 + 1 );
+
+                b11 = UNPACK_16MU_BLUE( p0 );
+                g11 = UNPACK_16MU_GREEN( p0 );
+                r11 = UNPACK_16MU_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *t++ = PACK_16MU_BGR(
+                bres >> KDecimalBits,
+                gres >> KDecimalBits,
+                rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        // last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            // If the source is still same then we don't have to fetch pixels
+            // from memory and unpack them again
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+                b01 = b00 = UNPACK_16MU_BLUE( p0 );
+                g01 = g00 = UNPACK_16MU_GREEN( p0 );
+                r01 = r00 = UNPACK_16MU_RED( p0 );
+
+                p0 = *( snext + x0 );
+                b11 = b10 = UNPACK_16MU_BLUE( p0 );
+                g11 = g10 = UNPACK_16MU_GREEN( p0 );
+                r11 = r10 = UNPACK_16MU_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *t++ = PACK_16MU_BGR(
+                bres >> KDecimalBits,
+                gres >> KDecimalBits,
+                rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        sourceY += iV;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16MU() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale16MA()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16MA() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint32* t = iTarget->DataAddress();
+
+    TUint32 sourceY( 0 );
+
+    TUint32 a00( 0 );
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 a01( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 a10( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+    TUint32 a11( 0 );
+    TUint32 b11( 0 );
+    TUint32 g11( 0 );
+    TUint32 r11( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint32* s = iSource->LineAddress( sourceY >> KDecimalBits );
+        TUint32* snext = iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+        TUint32 x0prev( TUint32( -1 ) );
+
+        TInt x;
+
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            // If the source is still same then we don't have to fetch pixels
+            // from memory and unpack them again
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+
+                a00 = UNPACK_16MA_ALPHA( p0 );
+                b00 = UNPACK_16MA_BLUE( p0 );
+                g00 = UNPACK_16MA_GREEN( p0 );
+                r00 = UNPACK_16MA_RED( p0 );
+
+                p0 = *( s + x0 + 1 );
+
+                a01 = UNPACK_16MA_ALPHA( p0 );
+                b01 = UNPACK_16MA_BLUE( p0 );
+                g01 = UNPACK_16MA_GREEN( p0 );
+                r01 = UNPACK_16MA_RED( p0 );
+
+                p0 = *( snext + x0 );
+
+                a10 = UNPACK_16MA_ALPHA( p0 );
+                b10 = UNPACK_16MA_BLUE( p0 );
+                g10 = UNPACK_16MA_GREEN( p0 );
+                r10 = UNPACK_16MA_RED( p0 );
+
+                p0 = *( snext + x0 + 1 );
+
+                a11 = UNPACK_16MA_ALPHA( p0 );
+                b11 = UNPACK_16MA_BLUE( p0 );
+                g11 = UNPACK_16MA_GREEN( p0 );
+                r11 = UNPACK_16MA_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 ares = w1 * a00 + w2 * a01 + w3 * a10 + w4 * a11;
+            ares += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *t++ = PACK_16MA_ABGR(
+                ares >> KDecimalBits,
+                bres >> KDecimalBits,
+                gres >> KDecimalBits,
+                rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        // last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            // If the source is still same then we don't have to fetch pixels
+            // from memory and unpack them again
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+                a01 = a00 = UNPACK_16MA_ALPHA( p0 );
+                b01 = b00 = UNPACK_16MA_BLUE( p0 );
+                g01 = g00 = UNPACK_16MA_GREEN( p0 );
+                r01 = r00 = UNPACK_16MA_RED( p0 );
+
+                p0 = *( snext + x0 );
+                a11 = a10 = UNPACK_16MA_ALPHA( p0 );
+                b11 = b10 = UNPACK_16MA_BLUE( p0 );
+                g11 = g10 = UNPACK_16MA_GREEN( p0 );
+                r11 = r10 = UNPACK_16MA_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 w1 = ( du * dv ) >> KDecimalBits;
+            TUint32 w2 = ( invdu * dv ) >> KDecimalBits;
+            TUint32 w3 = ( du * invdv ) >> KDecimalBits;
+            TUint32 w4 = ( invdu * invdv ) >> KDecimalBits;
+
+            TUint32 ares = w1 * a00 + w2 * a01 + w3 * a10 + w4 * a11;
+            ares += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 bres = w1 * b00 + w2 * b01 + w3 * b10 + w4 * b11;
+            bres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 gres = w1 * g00 + w2 * g01 + w3 * g10 + w4 * g11;
+            gres += ( 1 << ( KDecimalBits - 1 ) );
+            TUint32 rres = w1 * r00 + w2 * r01 + w3 * r10 + w4 * r11;
+            rres += ( 1 << ( KDecimalBits - 1 ) );
+
+            *t++ = PACK_16MA_ABGR(
+                ares >> KDecimalBits,
+                bres >> KDecimalBits,
+                gres >> KDecimalBits,
+                rres >> KDecimalBits );
+
+            sourceX += iU;
+            }
+
+        sourceY += iV;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale16MA() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale2x4K64K( TUint32 aMask )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale2x4K64K( TUint32 aMask )
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x4K64K() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt sheight = iSource->Size().iHeight;
+    TInt swidth = iSource->Size().iWidth;
+    TInt spitch = iSource->BytesPerRow();
+    TInt dpitch = iTarget->BytesPerRow();
+
+    TUint32* s = iSource->DataAddress();
+    TUint32* d = iTarget->DataAddress();
+    TInt y;
+
+    // first average source rows
+    for( y = 0; y < sheight; y++ )
+        {
+        TUint32* s1 = s;
+        TUint32* d1 = d;
+
+        TUint32 p = *s1++; // 2 pixels
+        TUint32 p1 = p & 0xffff;
+        TUint32 p2 = ( p >> 16 ) & 0xffff;
+        TInt x;
+
+        for( x = 0; x < swidth/2 - 1; x++ )
+            {
+            TUint32 p1a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+            *d1++ = p1 | ( p1a << 16 );
+
+            p = *s1++; // 2 pixels
+
+            p1 = p & 0xffff;
+            TUint32 p2a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+            *d1++ = p2 | ( p2a << 16 );
+
+            p2 = ( p >> 16 ) & 0xffff;
+            }
+
+        TUint32 p1a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+        *d1++ = p1 | ( p1a << 16 );
+
+        if( swidth & 1 )
+            {
+            p = *s1; // 2 pixels
+            p1 = p & 0xffff;
+            TUint32 p2a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+            *d1++ = p2 | ( p2a << 16 );
+
+            p = *--s1; // 2 pixels
+            p2 = ( p >> 16 ) & 0xffff;
+            *d1++ = p1 | ( p1 << 16 );
+            }
+        else
+            {
+            p = *--s1; // 2 pixels
+            p2 = ( p >> 16 ) & 0xffff;
+            *d1++ = p2 | ( p2 << 16 );
+            }
+
+        d = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+        s = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( s ) + spitch );
+        }
+
+    // then average rows between
+    d = iTarget->DataAddress();
+
+    TUint32 mask32bit = aMask | ( aMask << 16 );
+
+    for( y = 0; y < sheight - 1; y++ )
+        {
+        TUint32* d1 = reinterpret_cast< TUint32* >( d );
+        TUint32* d2 = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d1 ) + dpitch );
+        TUint32* d3 = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d2 ) + dpitch );
+
+        for( TInt x = 0; x < swidth; x++ )
+            {
+            TUint32 p1 = *d1++;
+            TUint32 p2 = *d3++;
+            *d2++ = ( ( ( p1 ^ p2 ) & mask32bit ) >> 1 ) + ( p1 & p2 );
+            }
+
+        d = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+        }
+
+    // last row is just copy of previous row, because we cannot calculate
+    // average
+    Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x4K64K() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale2x16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale2x16M()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x16M() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt sheight = iSource->Size().iHeight;
+    TInt swidth = iSource->Size().iWidth;
+    TInt spitch = iSource->BytesPerRow();
+    TInt dpitch = iTarget->BytesPerRow();
+
+    TUint8* s = reinterpret_cast< TUint8* >( iSource->DataAddress() );
+    TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+    TInt y;
+
+    for( y = 0; y < sheight; y++ )
+        {
+        TUint8* s2 = s;
+        TUint8* d1 = d;
+
+        TUint32 g1 = 0;
+        TUint32 b1 = 0;
+        TUint32 r1 = 0;
+
+        TUint32 g2 = 0;
+        TUint32 b2 = 0;
+        TUint32 r2 = 0;
+
+        for( TInt x = 0; x < swidth - 1; x++ )
+            {
+            g1 = *s2++;
+            b1 = *s2++;
+            r1 = *s2++;
+
+            *d1++ = static_cast< TUint8 >( g1 );
+            *d1++ = static_cast< TUint8 >( b1 );
+            *d1++ = static_cast< TUint8 >( r1 );
+
+            g2 = s2[ 0 ];
+            b2 = s2[ 1 ];
+            r2 = s2[ 2 ];
+
+            *d1++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+            *d1++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+            *d1++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+            }
+
+        *d1++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+        *d1++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+        *d1++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+
+        *d1++ = static_cast< TUint8 >( g2 );
+        *d1++ = static_cast< TUint8 >( b2 );
+        *d1++ = static_cast< TUint8 >( r2 );
+
+        d += dpitch * 2;
+        s += spitch;
+        }
+
+    // then average rows between
+    d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+    for( y = 0; y < sheight - 1; y++ )
+        {
+        TUint8* d1 = d;
+        TUint8* d2 = d1 + dpitch;
+        TUint8* d3 = d2 + dpitch;
+
+        for( TInt x = 0; x < swidth; x++ )
+            {
+            TUint32 g1 = *d1++;
+            TUint32 g2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+
+            TUint32 b1 = *d1++;
+            TUint32 b2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+
+            TUint32 r1 = *d1++;
+            TUint32 r2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+
+            g1 = *d1++;
+            g2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+
+            b1 = *d1++;
+            b2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+
+            r1 = *d1++;
+            r2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+            }
+
+        d += dpitch * 2;
+        }
+
+    // last row is just copy of previous row, because we cannot calculate
+    // average
+    Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x16M() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplBilinear::Scale2x16MU16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplBilinear::Scale2x16MU16MA()
+    {
+
+#if defined ( __MARM_ARMI__ ) && defined ( NDEBUG ) && defined ( __USE_ASM_OPTS ) // From urel
+
+ 		asm("stmfd	sp!, {r4, r5, r6, r7, r8, r9, sl, r11, r12, lr} ");
+        asm("ldr    r11, .L1_671");
+ 		asm("sub	sp, sp, #24 ");
+ 		asm("mov	r6, r0 ");
+ 		asm("ldr	r1, [r6, #4] ");
+ 		asm("ldr	r3, [r1, #0] ");
+ 		asm("add	r0, sp, #16 ");
+ 		asm("ldr	ip, [r3, #20] ");
+ 		asm("mov	lr, pc ");
+ 		asm("bx	ip ");
+ 		asm("ldr	r7, [sp, #20] ");
+ 		asm("ldr	r1, [r6, #4] ");
+ 		asm("ldr	r3, [r1, #0] ");
+ 		asm("add	r0, sp, #8 ");
+ 		asm("ldr	ip, [r3, #20] ");
+ 		asm("mov	lr, pc ");
+ 		asm("bx	ip ");
+ 		asm("ldr	r9, [sp, #8] ");
+ 		asm("str	r9, [sp, #0] ");
+ 		asm("ldr	r0, [r6, #4] ");
+ 		asm("ldr	r3, [r0, #0] ");
+ 		asm("ldr	ip, [r3, #24] ");
+ 		asm("mov	lr, pc ");
+ 		asm("bx	ip ");
+ 		asm("str	r0, [sp, #4] ");
+ 		asm("ldr	r0, [r6, #8] ");
+ 		asm("ldr	r3, [r0, #0] ");
+ 		asm("ldr	ip, [r3, #24] ");
+ 		asm("mov	lr, pc ");
+ 		asm("bx	ip ");
+ 		asm("mov	sl, r0 ");
+ 		asm("ldr	r0, [r6, #4] ");
+ 		asm("ldr	r3, [r0, #0] ");
+ 		asm("ldr	ip, [r3, #28] ");
+ 		asm("mov	lr, pc ");
+ 		asm("bx	ip ");
+ 		asm("mov	r4, r0 ");
+ 		asm("ldr	r0, [r6, #8] ");
+ 		asm("ldr	r3, [r0, #0] ");
+ 		asm("ldr	ip, [r3, #28] ");
+ 		asm("mov	lr, pc ");
+ 		asm("bx	ip ");
+ 		asm("mov	r5, r0 ");
+ 		asm("subs	r8, r7, #1 ");
+ 		asm("bmi	.L1_654 ");
+
+asm("	.L1_656: ");
+ 		asm("mov	ip, r5 ");
+        asm("mov	lr, r4 ");
+ 		asm("ldr	r1, [lr], #4 ");
+ 		asm("ldr	r9, [sp, #0] ");
+        asm("cmp    r9, #4");
+        asm("bhi    .L1_658_1");
+
+        // picture width lower or equal to 4
+        asm("subs   r0, r9, #2");
+        asm("bmi    .L1_658");
+
+        asm("ldr	r9, [lr], #4 ");
+        asm("eor	r2, r9, r1 ");
+        asm("and    r2, r2, r11 ");
+ 		asm("and	r3, r9, r1 ");
+ 		asm("add	r3, r3, r2, lsr #1 ");
+        asm("str    r1, [ip], #4");
+        asm("str    r3, [ip], #4");
+
+        asm("subs   r0, r0, #1");
+        asm("strmi  r9, [ip], #4");
+        asm("strmi  r9, [ip], #4");
+        asm("bmi    .L1_658");
+
+        asm("ldr	r1, [lr], #4 ");
+        asm("eor	r2, r9, r1 ");
+        asm("and    r2, r2, r11 ");
+ 		asm("and	r3, r9, r1 ");
+ 		asm("add	r3, r3, r2, lsr #1 ");
+        asm("str    r9, [ip], #4");
+        asm("str    r3, [ip], #4");
+
+        asm("subs   r0, r0, #1");
+        asm("strmi  r1, [ip], #4");
+        asm("strmi  r1, [ip], #4");
+        asm("bmi    .L1_658");
+
+        asm("ldr	r9, [lr], #4 ");
+        asm("eor	r2, r9, r1 ");
+        asm("and    r2, r2, r11 ");
+ 		asm("and	r3, r9, r1 ");
+ 		asm("add	r3, r3, r2, lsr #1 ");
+        asm("str    r1, [ip], #4");
+        asm("str    r3, [ip], #4");
+
+        asm("b      .L1_658");
+
+        // picture width higher than 4
+asm("   .L1_658_1:");
+        asm("mov    r9, r9, lsr #1 ");
+ 		asm("subs	r0, r9, #2 ");
+ 		asm("bmi	.L1_658 ");
+
+asm("	.L1_660: ");
+		asm("ldr	r9, [lr], #4 ");
+        asm("eor	r2, r9, r1 ");
+        asm("and    r2, r2, r11 ");
+ 		asm("and	r3, r9, r1 ");
+ 		asm("add	r3, r3, r2, lsr #1 ");
+        asm("stmia  ip!, { r1, r3, r9 } ");
+        asm("sub	r0, r0, #1 ");
+		asm("ldr	r1, [lr], #4 ");
+        asm("eor	r2, r9, r1 ");
+        asm("and    r2, r2, r11 ");
+ 		asm("and	r3, r9, r1 ");
+ 		asm("add	r3, r3, r2, lsr #1 ");
+        asm("str	r3, [ip], #4");
+        asm("cmp    r0,#0");
+ 		asm("bge	.L1_660 ");
+
+asm("	.L1_658: ");
+ 		asm("str	r1, [ip], #4 ");
+ 		asm("str	r1, [ip, #0] ");
+ 		asm("add	r5, r5, sl, asl #1 ");
+ 		asm("ldr	r9, [sp, #4] ");
+ 		asm("add	r4, r4, r9 ");
+ 		asm("subs	r8, r8, #1 ");
+ 		asm("bpl	.L1_656 ");
+
+asm("	.L1_654: ");
+ 		asm("ldr	r0, [r6, #8] ");
+ 		asm("ldr	r3, [r0, #0] ");
+ 		asm("ldr	ip, [r3, #28] ");
+ 		asm("mov	lr, pc ");
+ 		asm("bx	ip ");
+ 		asm("mov	r5, r0 ");
+ 		asm("subs	r8, r7, #2 ");
+ 		asm("bmi	.L1_664 ");
+
+asm("	.L1_666: ");
+ 		asm("mov	r7, r5 ");
+ 		asm("add	r4, r5, sl ");
+ 		asm("add	r6, r4, sl ");
+ 		asm("ldr	r9, [sp, #0] ");
+ 		asm("subs	lr, r9, #1 ");
+ 		asm("bmi	.L1_668 ");
+
+asm("	.L1_670: ");
+        asm("ldr	r1, [r7], #4 ");
+        asm("ldr	r2, [r7], #4 ");
+        asm("ldr	r0, [r6], #4 ");
+        asm("ldr	ip, [r6], #4 ");
+        asm("eor	r3, r1, r0 ");
+        asm("and    r3, r3, r11 ");
+        asm("and	r1, r1, r0 ");
+        asm("add	r1, r1, r3, lsr #1 ");
+        asm("str	r1, [r4], #4 ");
+        asm("eor	r3, r2, ip ");
+        asm("and    r3, r3, r11 ");
+        asm("and	r2, r2, ip ");
+        asm("add	r2, r2, r3, lsr #1 ");
+        asm("str	r2, [r4], #4 ");
+        asm("subs	lr, lr, #1 ");
+ 		asm("bpl	.L1_670 ");
+
+asm("	.L1_668: ");
+ 		asm("add	r5, r5, sl, asl #1 ");
+ 		asm("subs	r8, r8, #1 ");
+ 		asm("bpl	.L1_666 ");
+
+asm("	.L1_664: ");
+ 		asm("add	r0, r5, sl ");
+ 		asm("mov	r1, r5 ");
+ 		asm("mov	r2, sl ");
+ 		asm("bl	Copy__3MemPvPCvi ");
+ 		asm("add	sp, sp, #24 ");
+ 		asm("ldmfd	sp!, {r4, r5, r6, r7, r8, r9, sl, r11, r12, lr} ");
+ 		asm("bx	lr ");
+
+asm("    .align 0 ");
+asm("    .L1_671: ");
+asm("        .word   0x00fefefe ");
+
+#else
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x16MU16MA() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt sheight = iSource->Size().iHeight;
+    TInt swidth = iSource->Size().iWidth;
+    TInt spitch = iSource->BytesPerRow();
+    TInt dpitch = iTarget->BytesPerRow();
+
+    TUint32 mask = 0xfefefefe;
+    TUint32* s = iSource->DataAddress();
+    TUint32* d = iTarget->DataAddress();
+    TInt y;
+
+    TUint32 p1;
+    TUint32 p2;
+    TUint32 p3;
+    TUint32 p4;
+
+    // first average source rows
+    for( y = sheight - 1; y >= 0; y-- )
+        {
+        TUint32* s1 = s;
+        TUint32* d1 = d;
+
+        TUint32 p2 = *s1++;
+        TUint32 p1 = 0;
+
+        for( TInt x = swidth - 2; x >= 0; x-- )
+            {
+            *d1++ = p2;
+            p1 = p2;
+            p2 = *s1++;
+            *d1++ = ( ( ( p1 ^ p2 ) & mask ) >> 1 ) + ( p1 & p2 );
+            }
+
+        *d1++ = p2;
+        *d1++ = p2;
+
+        d = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+        s = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( s ) + spitch );
+        }
+
+    // then average rows between
+    d = iTarget->DataAddress();
+
+    for( y = sheight - 2; y >= 0; y-- )
+        {
+        TUint32* d1 = reinterpret_cast< TUint32* >( d );
+        TUint32* d2 = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d1 ) + dpitch );
+        TUint32* d3 = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d2 ) + dpitch );
+
+        for( TInt x = swidth - 1; x >= 0; x-- )
+            {
+            p1 = *d1++;
+            p2 = *d3++;
+            *d2++ = ( ( ( p1 ^ p2 ) & mask ) >> 1 ) + ( p1 & p2 );
+            p3 = *d1++;
+            p4 = *d3++;
+            *d2++ = ( ( ( p3 ^ p4 ) & mask ) >> 1 ) + ( p3 & p4 );
+            }
+
+        d = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+        }
+
+    // last row is just copy of previous row, because we cannot calculate
+    // average
+    Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplBilinear::Scale2x16MU16MA() <<" ), RThread().Id().operator TUint() ) );
+
+#endif
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScalerImplNearest.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,522 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScalerImplNearest.h"
+#include "cvtimage.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+const TUint32 KDecimalBits = 16;        // 16.16 pseudo real format
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageScalerImplNearest =======================
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageScalerImplNearest::Scale( TBool& aContinue )
+    {
+    TInt result( KErrNone );
+
+    aContinue = EFalse;
+
+    // this implementation does not support different display modes for source
+    // and target
+    if( iSource->DisplayMode() != iTarget->DisplayMode() )
+        {
+        return KErrNotSupported;
+        }
+
+    // if sizes are same, just copy the data
+    if( iSource->Size() == iTarget->Size() )
+        {
+        Mem::Copy(
+            iTarget->DataAddress(),
+            iSource->DataAddress(),
+            iTarget->BytesPerRow() * iTarget->Size().iHeight );
+        }
+    else if( ( iSource->Size().iHeight * 2 == iTarget->Size().iHeight ) &&
+        ( iSource->Size().iWidth * 2 == iTarget->Size().iWidth ) )
+        {
+        switch( iSource->DisplayMode() )
+            {
+            case CVtImage::EVtColor4K:
+            case CVtImage::EVtColor64K:
+                Scale2x4K64K();
+                break;
+
+            case CVtImage::EVtColor16M:
+                Scale2x16M();
+                break;
+
+            case CVtImage::EVtColor16MU:
+            case CVtImage::EVtColor16MA:
+                Scale2x16MU16MA();
+                break;
+
+            default:
+                if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+                     iTarget->Type() == CVtImage::EVtImageBitmap )
+                    {
+                    TRAPD( error,
+                        ScaleWithBitmapScalerL(
+                            CBitmapScaler::EMinimumQuality ) );
+                    result = error;
+                    }
+                else
+                    {
+                    result = KErrNotSupported;
+                    }
+            }
+        }
+    else
+        {
+        Initialize();
+
+        switch( iSource->DisplayMode() )
+            {
+            case CVtImage::EVtColor4K:
+                Scale4K(
+                    reinterpret_cast< const TUint16* >(
+                        iSource->DataAddress() ),
+                    iSource->BytesPerRow(),
+                    reinterpret_cast< TUint16* >( iTarget->DataAddress() ),
+                    iTarget->Size().iWidth,
+                    iTarget->Size().iHeight,
+                    iU,
+                    iV );
+                break;
+
+            case CVtImage::EVtColor64K:
+                Scale64K(
+                    reinterpret_cast< const TUint16* >(
+                        iSource->DataAddress() ),
+                    iSource->BytesPerRow(),
+                    reinterpret_cast< TUint16* >( iTarget->DataAddress() ),
+                    iTarget->Size().iWidth,
+                    iTarget->Size().iHeight,
+                    iU,
+                    iV );
+                break;
+
+            case CVtImage::EVtColor16M:
+                Scale16M(
+                    reinterpret_cast< const TUint8* >(
+                        iSource->DataAddress() ),
+                    iSource->BytesPerRow(),
+                    reinterpret_cast< TUint8* >( iTarget->DataAddress() ),
+                    iTarget->Size().iWidth,
+                    iTarget->Size().iHeight,
+                    iTarget->BytesPerRow(),
+                    iU,
+                    iV );
+                break;
+
+            case CVtImage::EVtColor16MU:
+            case CVtImage::EVtColor16MA:
+                Scale16MU16MA(
+                    iSource->DataAddress(),
+                    iSource->BytesPerRow(),
+                    iTarget->DataAddress(),
+                    iTarget->Size().iWidth,
+                    iTarget->Size().iHeight,
+                    iU,
+                    iV );
+                break;
+
+            default:
+                if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+                     iTarget->Type() == CVtImage::EVtImageBitmap )
+                    {
+                    TRAPD( error,
+                        ScaleWithBitmapScalerL(
+                            CBitmapScaler::EMinimumQuality ) );
+                    result = error;
+                    }
+                else
+                    {
+                    result = KErrNotSupported;
+                    }
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::ValidateSourceTargetL(
+//  const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::ValidateSourceTargetL(
+    const CVtImage& aSource,
+    CVtImage& aTarget )
+    {
+    if( aSource.DisplayMode() != aTarget.DisplayMode() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    switch( aSource.DisplayMode() )
+        {
+        case CVtImage::EVtColor4K:
+        case CVtImage::EVtColor64K:
+        case CVtImage::EVtColor16M:
+        case CVtImage::EVtColor16MU:
+        case CVtImage::EVtColor16MA:
+            break;
+
+        default:
+            // Scaling for bitmaps is supported for other display modes
+            if ( !( aSource.Type() == CVtImage::EVtImageBitmap &&
+                 aTarget.Type() == CVtImage::EVtImageBitmap ) )
+                {
+                User::Leave( KErrNotSupported );
+                }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Initialize()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Initialize()
+    {
+    iU = ( 1 << KDecimalBits ) * iSource->Size().iWidth /
+        iTarget->Size().iWidth + 1;
+    iV = ( 1 << KDecimalBits ) * iSource->Size().iHeight /
+        iTarget->Size().iHeight + 1;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale4K(
+//  const TUint16* aSrcPtr, TUint32 aSrcWidth, TUint16* aTrgPtr,
+//  TUint32 aTrgWidth, TUint32 aTrgHeight, TUint32 aDx, TUint32 aDy )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale4K(
+    const TUint16* aSrcPtr,
+    TUint32 aSrcWidth,
+    TUint16* aTrgPtr,
+    TUint32 aTrgWidth,
+    TUint32 aTrgHeight,
+    TUint32 aDx,
+    TUint32 aDy )
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale4K() >>" ), RThread().Id().operator TUint() ) );
+    // scaling 4K and 64K is equal procedure
+    Scale64K( aSrcPtr, aSrcWidth, aTrgPtr, aTrgWidth, aTrgHeight, aDx, aDy );
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale4K() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale64K(
+//  const TUint16* aSrcPtr, TUint32 aSrcPitch, TUint16* aTrgPtr,
+//  TUint32 aTrgWidth, TUint32 aTrgHeight, TUint32 aDx, TUint32 aDy )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale64K(
+    const TUint16* aSrcPtr,
+    TUint32 aSrcPitch,
+    TUint16* aTrgPtr,
+    TUint32 aTrgWidth,
+    TUint32 aTrgHeight,
+    TUint32 aDx,
+    TUint32 aDy )
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale64K() >>" ), RThread().Id().operator TUint() ) );
+
+    TUint32 sy( 0 );
+
+    for( TUint32 y = 0; y < aTrgHeight; y++ )
+        {
+        const TUint16* srow =
+            aSrcPtr + ( sy >> KDecimalBits ) * ( aSrcPitch >> 1 );
+
+        TUint32 sx( 0 );
+
+        TUint32 x( 0 );
+
+        // loop unrolled with 8
+        for( ; x < ( aTrgWidth >> 3 ); x++ )
+            {
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            }
+
+        // handle remaining columns
+        for( x = 0; x < ( aTrgWidth & 7 ); x++ )
+            {
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            }
+
+        // if target width is not even aligning is needed
+        if( aTrgWidth & 1 )
+            {
+            aTrgPtr++;
+            }
+
+        sy += aDy;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale64K() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale16M(
+//  const TUint8* aSrcPtr, TUint32 aSrcPitch, TUint8* aTrgPtr,
+//  TUint32 aTrgWidth, TUint32 aTrgHeight, TUint32 aTrgPitch, TUint32 aDx, TUint32 aDy )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale16M(
+    const TUint8* aSrcPtr,
+    TUint32 aSrcPitch,
+    TUint8* aTrgPtr,
+    TUint32 aTrgWidth,
+    TUint32 aTrgHeight,
+    TUint32 aTrgPitch,
+    TUint32 aDx,
+    TUint32 aDy )
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale16M() >>" ), RThread().Id().operator TUint() ) );
+
+    TUint32 sy( 0 );
+
+    for( TUint32 y = 0; y < aTrgHeight; y++ )
+        {
+        const TUint8* s = aSrcPtr + ( sy >> KDecimalBits ) * aSrcPitch;
+
+        TUint8* d = aTrgPtr;
+
+        TUint32 sx( 0 );
+
+        TUint32 x( 0 );
+
+        for( ; x < aTrgWidth; x++ )
+            {
+            const TUint8* tempSrc = s + ( sx >> KDecimalBits ) * 3;
+            *d++ = *tempSrc++;
+            *d++ = *tempSrc++;
+            *d++ = *tempSrc++;
+            sx += aDx;
+            }
+
+        aTrgPtr += aTrgPitch;
+
+        sy += aDy;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale16M() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale16MU16MA( const TUint32* aSrcPtr,
+//  TUint32 aSrcPitch, TUint32* aTrgPtr, TUint32 aTrgWidth, TUint32 aTrgHeight,
+//  TUint32 aDx, TUint32 aDy )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale16MU16MA(
+    const TUint32* aSrcPtr,
+    TUint32 aSrcPitch,
+    TUint32* aTrgPtr,
+    TUint32 aTrgWidth,
+    TUint32 aTrgHeight,
+    TUint32 aDx,
+    TUint32 aDy )
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale16MU16MA() >>" ), RThread().Id().operator TUint() ) );
+
+    TUint32 sy( 0 );
+
+    for( TUint32 y = 0; y < aTrgHeight; y++ )
+        {
+        const TUint32* srow =
+            aSrcPtr + ( sy >> KDecimalBits ) * ( aSrcPitch >> 2 );
+
+        TUint32 sx( 0 );
+
+        TUint32 x( 0 );
+
+        // loop unrolled with 8
+        for( ; x < ( aTrgWidth >> 3 ); x++ )
+            {
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            }
+
+        // handle remaining columns
+        for( x = 0; x < ( aTrgWidth & 7 ); x++ )
+            {
+            *aTrgPtr++ = srow[ sx >> KDecimalBits ];
+            sx += aDx;
+            }
+
+        sy += aDy;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale16MU16MA() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale2x4K64K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale2x4K64K()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x4K64K() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt sheight = iSource->Size().iHeight;
+    TInt swidth = iSource->Size().iWidth;
+    TInt spitch = iSource->BytesPerRow();
+    TInt dpitch = iTarget->BytesPerRow();
+
+    TUint16* s = reinterpret_cast< TUint16* >( iSource->DataAddress() );
+    TUint32* d = iTarget->DataAddress();
+
+    for( TInt y = 0; y < sheight; y++ )
+        {
+        TUint16* s2 = s;
+        TUint32* d1 = d;
+        for( TInt x = 0; x < swidth; x++ )
+            {
+            TUint32 p = *s2++;
+            p |= ( p << 16 );
+            *d1++ = p;
+            }
+        d = reinterpret_cast< TUint32* >(
+            Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch ) );
+        s = reinterpret_cast< TUint16* >(
+            reinterpret_cast< TUint8* >( s ) + spitch );
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x4K64K() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale2x16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale2x16M()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x16M() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt sheight = iSource->Size().iHeight;
+    TInt swidth = iSource->Size().iWidth;
+    TInt spitch = iSource->BytesPerRow();
+    TInt dpitch = iTarget->BytesPerRow();
+
+    TUint8* s = reinterpret_cast< TUint8* >( iSource->DataAddress() );
+    TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+    for( TInt y = 0; y < sheight; y++ )
+        {
+        TUint8* s2 = s;
+        TUint8* d1 = d;
+        for( TInt x = 0; x < swidth; x++ )
+            {
+            TUint8 g = *s2++;
+            TUint8 b = *s2++;
+            TUint8 r = *s2++;
+
+            *d1++ = g;
+            *d1++ = b;
+            *d1++ = r;
+
+            *d1++ = g;
+            *d1++ = b;
+            *d1++ = r;
+            }
+        d = Mem::Copy( d + dpitch, d, dpitch );
+        s += spitch;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x16M() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplNearest::Scale2x16MU16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplNearest::Scale2x16MU16MA()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x16MU16MA() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt sheight = iSource->Size().iHeight;
+    TInt swidth = iSource->Size().iWidth;
+    TInt spitch = iSource->BytesPerRow();
+    TInt dpitch = iTarget->BytesPerRow();
+
+    TUint32* s = iSource->DataAddress();
+    TUint32* d = iTarget->DataAddress();
+
+    for( TInt y = 0; y < sheight; y++ )
+        {
+        TUint32* s2 = s;
+        TUint32* d1 = d;
+        for( TInt x = 0; x < swidth; x++ )
+            {
+            TUint32 p = *s2++;
+            *d1++ = p;
+            *d1++ = p;
+            }
+        d = reinterpret_cast< TUint32* >(
+            Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch ) );
+        s = reinterpret_cast< TUint32* >(
+            reinterpret_cast< TUint8* >( s ) + spitch );
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplNearest::Scale2x16MU16MA() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/CVtImageScalerImplWeightedAverage.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1183 @@
+/*
+* 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:  Image Transforms subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVtImageScalerImplWeightedAverage.h"
+#include "cvtimage.h"
+#include "CVtImageScalerMacros.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+const TUint32 KDecimalBits = 16;        // 16.16 pseudo real format
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ======================= CVtImageScalerImplWeightedAverage ===================
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale( TBool& aContinue )
+// -----------------------------------------------------------------------------
+TInt CVtImageScalerImplWeightedAverage::Scale( TBool& aContinue )
+    {
+    TInt result( KErrNone );
+
+    aContinue = EFalse;
+
+    // this implementation does not support different display modes for source
+    // and target
+    if( iSource->DisplayMode() != iTarget->DisplayMode() )
+        {
+        return KErrNotSupported;
+        }
+
+    // if sizes are same, just copy the data
+    if( iSource->Size() == iTarget->Size() )
+        {
+        Mem::Copy(
+            iTarget->DataAddress(),
+            iSource->DataAddress(),
+            iTarget->BytesPerRow() * iTarget->Size().iHeight );
+        }
+    else if ( ( iSource->Size().iHeight * 2 == iTarget->Size().iHeight )
+            && ( iSource->Size().iWidth * 2 == iTarget->Size().iWidth ) )
+        {
+        switch( iSource->DisplayMode() )
+            {
+            case CVtImage::EVtColor4K:
+                Scale2x4K64K( 0xeee );  // 0000ggggbbbbrrrr ->
+                break;                  // mask = %0000111011101110 = 0xeee
+
+            case CVtImage::EVtColor64K:
+                Scale2x4K64K( 0xf7de ); // bbbbbggggggrrrrr ->
+                break;                  // mask = %1111011111011110 = 0xf7de
+
+            case CVtImage::EVtColor16M:
+                Scale2x16M();
+                break;
+
+            case CVtImage::EVtColor16MU:
+            case CVtImage::EVtColor16MA:
+                Scale2x16MU16MA();
+                break;
+
+            default:
+                if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+                     iTarget->Type() == CVtImage::EVtImageBitmap )
+                    {
+                    TRAPD( error,
+                        ScaleWithBitmapScalerL(
+                            CBitmapScaler::EMediumQuality ) );
+                    result = error;
+                    }
+                else
+                    {
+                    result = KErrNotSupported;
+                    }
+            }
+        }
+    else
+        {
+        Initialize();
+
+        switch( iSource->DisplayMode() )
+            {
+            case CVtImage::EVtColor4K:
+                Scale4K();
+                break;
+
+            case CVtImage::EVtColor64K:
+                Scale64K();
+                break;
+
+            case CVtImage::EVtColor16M:
+                Scale16M();
+                break;
+
+            case CVtImage::EVtColor16MU:
+                Scale16MU();
+                break;
+
+            case CVtImage::EVtColor16MA:
+                Scale16MA();
+                break;
+
+            default:
+                if ( iSource->Type() == CVtImage::EVtImageBitmap &&
+                     iTarget->Type() == CVtImage::EVtImageBitmap )
+                    {
+                    TRAPD( error,
+                        ScaleWithBitmapScalerL(
+                            CBitmapScaler::EMediumQuality ) );
+                    result = error;
+                    }
+                else
+                    {
+                    result = KErrNotSupported;
+                    }
+            }
+        }
+
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::ValidateSourceTargetL(
+// const CVtImage& aSource, CVtImage& aTarget )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::ValidateSourceTargetL(
+    const CVtImage& aSource,
+    CVtImage& aTarget )
+    {
+    // source and target must have same displaymode
+    if( aSource.DisplayMode() != aTarget.DisplayMode() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // only 4K, 64K, 16M and 16MU modes are supported
+    switch( aSource.DisplayMode() )
+        {
+        case CVtImage::EVtColor4K:
+        case CVtImage::EVtColor64K:
+        case CVtImage::EVtColor16M:
+        case CVtImage::EVtColor16MU:
+        case CVtImage::EVtColor16MA:
+            break;
+
+        default:
+            // Scaling for bitmaps is supported for other display modes
+            if ( !( aSource.Type() == CVtImage::EVtImageBitmap &&
+                 aTarget.Type() == CVtImage::EVtImageBitmap ) )
+                {
+                User::Leave( KErrNotSupported );
+                }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Initialize()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Initialize()
+    {
+    iU = ( 1 << KDecimalBits ) * iSource->Size().iWidth /
+        iTarget->Size().iWidth;
+    iV = ( 1 << KDecimalBits ) * iSource->Size().iHeight /
+        iTarget->Size().iHeight;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale4K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale4K()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale4K() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint16* t = reinterpret_cast< TUint16* >( iTarget->DataAddress() );
+
+    TUint32 sourceY( 0 );
+
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint16* s = reinterpret_cast< TUint16* >(
+            iSource->LineAddress( sourceY >> KDecimalBits ) );
+        TUint16* snext = reinterpret_cast< TUint16* >(
+            iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+
+        TInt x;
+
+        TUint32 x0prev( TUint32( -1 ) );
+
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+
+                b00 = UNPACK_4K_BLUE( p0 );
+                g00 = UNPACK_4K_GREEN( p0 );
+                r00 = UNPACK_4K_RED( p0 );
+
+                p0 = *( s + x0 + 1 );
+
+                b01 = UNPACK_4K_BLUE( p0 );
+                g01 = UNPACK_4K_GREEN( p0 );
+                r01 = UNPACK_4K_RED( p0 );
+
+                p0 = *( snext + x0 );
+
+                b10 = UNPACK_4K_BLUE( p0 );
+                g10 = UNPACK_4K_GREEN( p0 );
+                r10 = UNPACK_4K_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 );
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *t++ = PACK_4K_BGR(
+                bres >> ( KDecimalBits + 1 ),
+                gres >> ( KDecimalBits + 1 ),
+                rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        // handle last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+                b01 = b00 = UNPACK_4K_BLUE( p0 );
+                g01 = g00 = UNPACK_4K_GREEN( p0 );
+                r01 = r00 = UNPACK_4K_RED( p0 );
+
+                p0 = *( snext + x0 );
+                b10 = UNPACK_4K_BLUE( p0 );
+                g10 = UNPACK_4K_GREEN( p0 );
+                r10 = UNPACK_4K_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *t++ = PACK_4K_BGR(
+                bres >> ( KDecimalBits + 1 ),
+                gres >> ( KDecimalBits + 1 ),
+                rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        // if width is not even -> then we need to skip one additional byte
+        if( width & 1 )
+            {
+            t++;
+            }
+
+        sourceY += iV;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale4K() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale64K()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale64K()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale64K() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint16* t = reinterpret_cast< TUint16* >( iTarget->DataAddress() );
+
+    TUint32 sourceY( 0 );
+
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint16* s = reinterpret_cast< TUint16* >
+            ( iSource->LineAddress( sourceY >> KDecimalBits ) );
+        TUint16* snext = reinterpret_cast< TUint16* >
+            ( iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+
+        TInt x;
+
+        TUint32 x0prev( TUint32( -1 ) );
+
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+
+                b00 = UNPACK_64K_BLUE( p0 );
+                g00 = UNPACK_64K_GREEN( p0 );
+                r00 = UNPACK_64K_RED( p0 );
+
+                p0 = *( s + x0 + 1 );
+
+                b01 = UNPACK_64K_BLUE( p0 );
+                g01 = UNPACK_64K_GREEN( p0 );
+                r01 = UNPACK_64K_RED( p0 );
+
+                p0 = *( snext + x0 );
+
+                b10 = UNPACK_64K_BLUE( p0 );
+                g10 = UNPACK_64K_GREEN( p0 );
+                r10 = UNPACK_64K_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 );
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *t++ = PACK_64K_BGR(
+                bres >> ( KDecimalBits + 1 ),
+                gres >> ( KDecimalBits + 1 ),
+                rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        // handle last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+                b01 = b00 = UNPACK_64K_BLUE( p0 );
+                g01 = g00 = UNPACK_64K_GREEN( p0 );
+                r01 = r00 = UNPACK_64K_RED( p0 );
+
+                p0 = *( snext + x0 );
+                b10 = UNPACK_64K_BLUE( p0 );
+                g10 = UNPACK_64K_GREEN( p0 );
+                r10 = UNPACK_64K_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *t++ = PACK_64K_BGR(
+                bres >> ( KDecimalBits + 1 ),
+                gres >> ( KDecimalBits + 1 ),
+                rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        // if width is not even -> then we need to skip one additional byte
+        if( width & 1 )
+            {
+            t++;
+            }
+
+        sourceY += iV;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale64K() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale16M()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16M() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint32 t_pitch = iTarget->BytesPerRow();
+
+    TUint8* t = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+    TUint32 sourceY( 0 );
+
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint8* s = reinterpret_cast< TUint8* >(
+            iSource->LineAddress( sourceY >> KDecimalBits ) );
+        TUint8* snext = reinterpret_cast< TUint8* >(
+            iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 ) );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+
+        TInt x;
+
+        TUint32 x0prev( TUint32( -1 ) );
+
+        TUint8* d = t;
+
+        // first columns
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = ( sourceX >> KDecimalBits ) * 3;
+
+            if( x0 != x0prev )
+                {
+                TUint8* tempSrc = s + x0;
+
+                b00 = *tempSrc++;
+                g00 = *tempSrc++;
+                r00 = *tempSrc++;
+
+                b01 = *tempSrc++;
+                g01 = *tempSrc++;
+                r01 = *tempSrc++;
+
+                tempSrc = snext + x0;
+
+                b10 = *tempSrc++;
+                g10 = *tempSrc++;
+                r10 = *tempSrc++;
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *d++ = static_cast< TUint8 >( bres >> ( KDecimalBits + 1 ) );
+            *d++ = static_cast< TUint8 >( gres >> ( KDecimalBits + 1 ) );
+            *d++ = static_cast< TUint8 >( rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        // handle last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = ( sourceX >> KDecimalBits ) * 3;
+
+            if( x0 != x0prev )
+                {
+                TUint8* tempSrc = s + x0;
+
+                b01 = b00 = *tempSrc++;
+                g01 = g00 = *tempSrc++;
+                r01 = r00 = *tempSrc++;
+
+                tempSrc = snext + x0;
+
+                b10 = *tempSrc++;
+                g10 = *tempSrc++;
+                r10 = *tempSrc++;
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *d++ = static_cast< TUint8 >( bres >> ( KDecimalBits + 1 ) );
+            *d++ = static_cast< TUint8 >( gres >> ( KDecimalBits + 1 ) );
+            *d++ = static_cast< TUint8 >( rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        t += t_pitch;
+
+        sourceY += iV;
+        }
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16M() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale16MU()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale16MU()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16MU() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint32* t = iTarget->DataAddress();
+
+    TUint32 sourceY( 0 );
+
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint32* s = iSource->LineAddress( sourceY >> KDecimalBits );
+        TUint32* snext = iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+
+        TInt x;
+
+        TUint32 x0prev( TUint32( -1 ) );
+
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+
+                b00 = UNPACK_16MU_BLUE( p0 );
+                g00 = UNPACK_16MU_GREEN( p0 );
+                r00 = UNPACK_16MU_RED( p0 );
+
+                p0 = *( s + x0 + 1 );
+
+                b01 = UNPACK_16MU_BLUE( p0 );
+                g01 = UNPACK_16MU_GREEN( p0 );
+                r01 = UNPACK_16MU_RED( p0 );
+
+                p0 = *( snext + x0 );
+
+                b10 = UNPACK_16MU_BLUE( p0 );
+                g10 = UNPACK_16MU_GREEN( p0 );
+                r10 = UNPACK_16MU_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 );
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *t++ = PACK_16MU_BGR(
+                bres >> ( KDecimalBits + 1 ),
+                gres >> ( KDecimalBits + 1 ),
+                rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        // handle last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+                b01 = b00 = UNPACK_16MU_BLUE( p0 );
+                g01 = g00 = UNPACK_16MU_GREEN( p0 );
+                r01 = r00 = UNPACK_16MU_RED( p0 );
+
+                p0 = *( snext + x0 );
+                b10 = UNPACK_16MU_BLUE( p0 );
+                g10 = UNPACK_16MU_GREEN( p0 );
+                r10 = UNPACK_16MU_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *t++ = PACK_16MU_BGR(
+                bres >> ( KDecimalBits + 1 ),
+                gres >> ( KDecimalBits + 1 ),
+                rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        sourceY += iV;
+        }
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16MU() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale16MA()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16MA() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt width = iTarget->Size().iWidth;
+
+    TInt height = iTarget->Size().iHeight;
+
+    TInt mod_width = width - ( ( 1 << KDecimalBits ) / iU );
+
+    TUint32* t = iTarget->DataAddress();
+
+    TUint32 sourceY( 0 );
+
+    TUint32 a00( 0 );
+    TUint32 b00( 0 );
+    TUint32 g00( 0 );
+    TUint32 r00( 0 );
+    TUint32 a01( 0 );
+    TUint32 b01( 0 );
+    TUint32 g01( 0 );
+    TUint32 r01( 0 );
+    TUint32 a10( 0 );
+    TUint32 b10( 0 );
+    TUint32 g10( 0 );
+    TUint32 r10( 0 );
+
+    for( TInt y = 0; y < height; y++ )
+        {
+        TUint32* s = iSource->LineAddress( sourceY >> KDecimalBits );
+        TUint32* snext = iSource->LineAddress( ( sourceY >> KDecimalBits ) + 1 );
+
+        TUint32 invdv = sourceY & ( ( 1 << KDecimalBits ) - 1 ); // decimal part
+        TUint32 dv = ( 1 << KDecimalBits ) - invdv; // 1 - decimal part
+
+        TUint32 sourceX( 0 );
+
+        TInt x;
+
+        TUint32 x0prev( TUint32( -1 ) );
+
+        for( x = 0; x < mod_width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+
+                a00 = UNPACK_16MA_ALPHA( p0 );
+                b00 = UNPACK_16MA_BLUE( p0 );
+                g00 = UNPACK_16MA_GREEN( p0 );
+                r00 = UNPACK_16MA_RED( p0 );
+
+                p0 = *( s + x0 + 1 );
+
+                a01 = UNPACK_16MA_ALPHA( p0 );
+                b01 = UNPACK_16MA_BLUE( p0 );
+                g01 = UNPACK_16MA_GREEN( p0 );
+                r01 = UNPACK_16MA_RED( p0 );
+
+                p0 = *( snext + x0 );
+
+                a10 = UNPACK_16MA_ALPHA( p0 );
+                b10 = UNPACK_16MA_BLUE( p0 );
+                g10 = UNPACK_16MA_GREEN( p0 );
+                r10 = UNPACK_16MA_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 );
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 ares = ( du + dv ) * a00 + invdu * a01 + invdv * a10;
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *t++ = PACK_16MA_ABGR(
+                ares >> ( KDecimalBits + 1 ),
+                bres >> ( KDecimalBits + 1 ),
+                gres >> ( KDecimalBits + 1 ),
+                rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        // handle last columns
+        for( ; x < width; x++ )
+            {
+            TUint32 x0 = sourceX >> KDecimalBits;
+
+            if( x0 != x0prev )
+                {
+                TUint32 p0 = *( s + x0 );
+                a01 = a00 = UNPACK_16MA_ALPHA( p0 );
+                b01 = b00 = UNPACK_16MA_BLUE( p0 );
+                g01 = g00 = UNPACK_16MA_GREEN( p0 );
+                r01 = r00 = UNPACK_16MA_RED( p0 );
+
+                p0 = *( snext + x0 );
+                a10 = UNPACK_16MA_ALPHA( p0 );
+                b10 = UNPACK_16MA_BLUE( p0 );
+                g10 = UNPACK_16MA_GREEN( p0 );
+                r10 = UNPACK_16MA_RED( p0 );
+
+                x0prev = x0;
+                }
+
+            TUint32 invdu = sourceX & ( ( 1 << KDecimalBits ) - 1 ); // decimal
+            TUint32 du = ( 1 << KDecimalBits ) - invdu; // 1 - decimal part
+
+            TUint32 ares = ( du + dv ) * a00 + invdu * a01 + invdv * a10;
+            TUint32 bres = ( du + dv ) * b00 + invdu * b01 + invdv * b10;
+            TUint32 gres = ( du + dv ) * g00 + invdu * g01 + invdv * g10;
+            TUint32 rres = ( du + dv ) * r00 + invdu * r01 + invdv * r10;
+
+            *t++ = PACK_16MA_ABGR(
+                ares >> ( KDecimalBits + 1 ),
+                bres >> ( KDecimalBits + 1 ),
+                gres >> ( KDecimalBits + 1 ),
+                rres >> ( KDecimalBits + 1 ) );
+
+            sourceX += iU;
+            }
+
+        sourceY += iV;
+        }
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale16MA() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale2x4K64K( TUint32 aMask )
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale2x4K64K( TUint32 aMask )
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x4K64K() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt sheight = iSource->Size().iHeight;
+    TInt swidth = iSource->Size().iWidth;
+    TInt spitch = iSource->BytesPerRow();
+    TInt dpitch = iTarget->BytesPerRow();
+
+    TUint32* s = iSource->DataAddress();
+    TUint32* d = iTarget->DataAddress();
+    TInt y;
+
+    // first average source rows
+    for( y = 0; y < sheight; y++ )
+        {
+        TUint32* s1 = s;
+        TUint32* d1 = d;
+
+        TUint32 p = *s1++; // 2 pixels
+        TUint32 p1 = p & 0xffff;
+        TUint32 p2 = ( p >> 16 ) & 0xffff;
+        TInt x;
+
+        for( x = 0; x < swidth/2 - 1; x++ )
+            {
+            TUint32 p1a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+            p1a = ( ( ( p1 ^ p1a ) & aMask ) >> 1 ) + ( p1 & p1a );
+            *d1++ = p1 | ( p1a << 16 );
+
+            p = *s1++; // 2 pixels
+
+            p1 = p & 0xffff;
+            TUint32 p2a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+            p2a = ( ( ( p2a ^ p2 ) & aMask ) >> 1 ) + ( p2a & p2 );
+            *d1++ = p2 | ( p2a << 16 );
+
+            p2 = ( p >> 16 ) & 0xffff;
+            }
+
+        TUint32 p1a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+        p1a = ( ( ( p1 ^ p1a ) & aMask ) >> 1 ) + ( p1 & p1a );
+        *d1++ = p1 | ( p1a << 16 );
+
+        if( swidth & 1 )
+            {
+            p = *s1; // 2 pixels
+            p1 = p & 0xffff;
+            TUint32 p2a = ( ( ( p1 ^ p2 ) & aMask ) >> 1 ) + ( p1 & p2 );
+            p2a = ( ( ( p2a ^ p2 ) & aMask ) >> 1 ) + ( p2a & p2 );
+            *d1++ = p2 | ( p2a << 16 );
+
+            p = *--s1; // 2 pixels
+            p2 = ( p >> 16 ) & 0xffff;
+            *d1++ = p1 | ( p1 << 16 );
+            }
+        else
+            {
+            p = *--s1; // 2 pixels
+            p2 = ( p >> 16 ) & 0xffff;
+            *d1++ = p2 | ( p2 << 16 );
+            }
+
+        d = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+        s = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( s ) + spitch );
+        }
+
+    // then average rows between
+    d = iTarget->DataAddress();
+
+    for( y = 0; y < sheight - 1; y++ )
+        {
+        TUint32* d1 = reinterpret_cast< TUint32* >( d );
+        TUint32* d2 = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d1 ) + dpitch );
+        TUint32* d3 = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d2 ) + dpitch );
+
+        TUint32 p1 = *d1++;
+        for( TInt x = 0; x < swidth - 1; x++ )
+            {
+            TUint32 p11 = p1 & 0xffff;
+            TUint32 p3 = *d3++;
+            TUint32 p31 = p3 & 0xffff;
+
+            TUint32 r1 = ( ( ( p11 ^ p31 ) & aMask ) >> 1 ) + ( p11 & p31 );
+            r1 = ( ( ( p11 ^ r1 ) & aMask ) >> 1 ) + ( p11 & r1 );
+
+            p1 = *d1++; // read ahead
+            TUint32 p21 = p1 & 0xffff;
+            TUint32 r2 = ( ( ( p21 ^ p31 ) & aMask ) >> 1 ) + ( p21 & p31 );
+            r2 = ( ( ( p11 ^ r2 ) & aMask ) >> 1 ) + ( p11 & r2 );
+
+            *d2++ = r1 | ( r2 << 16 );
+            }
+
+        TUint32 p11 = p1 & 0xffff;
+        TUint32 p3 = *d3++;
+        TUint32 p31 = p3 & 0xffff;
+        TUint32 r1 = ( ( ( p11 ^ p31 ) & aMask ) >> 1 ) + ( p11 & p31 );
+        r1 = ( ( ( p11 ^ r1 ) & aMask ) >> 1 ) + ( p11 & r1 );
+        *d2++ = r1 | ( r1 << 16 );
+
+        d = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+        }
+
+    // last row is just copy of previous row, because we cannot calculate
+    // average
+    Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x4K64K() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale2x16M()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale2x16M()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x16M() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt sheight = iSource->Size().iHeight;
+    TInt swidth = iSource->Size().iWidth;
+    TInt spitch = iSource->BytesPerRow();
+    TInt dpitch = iTarget->BytesPerRow();
+
+    TUint8* s = reinterpret_cast< TUint8* >( iSource->DataAddress() );
+    TUint8* d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+    TInt y;
+
+    for( y = 0; y < sheight; y++ )
+        {
+        TUint8* s2 = s;
+        TUint8* d1 = d;
+
+        TUint32 g1 = 0;
+        TUint32 b1 = 0;
+        TUint32 r1 = 0;
+
+        TUint32 g2 = 0;
+        TUint32 b2 = 0;
+        TUint32 r2 = 0;
+
+        for( TInt x = 0; x < swidth - 1; x++ )
+            {
+            g1 = *s2++;
+            b1 = *s2++;
+            r1 = *s2++;
+
+            *d1++ = static_cast< TUint8 >( g1 );
+            *d1++ = static_cast< TUint8 >( b1 );
+            *d1++ = static_cast< TUint8 >( r1 );
+
+            g2 = s2[ 0 ];
+            b2 = s2[ 1 ];
+            r2 = s2[ 2 ];
+
+            *d1++ = static_cast< TUint8 >( ( g1 + ( ( g1 + g2 ) >> 1 ) ) >> 1 );
+            *d1++ = static_cast< TUint8 >( ( b1 + ( ( b1 + b2 ) >> 1 ) ) >> 1 );
+            *d1++ = static_cast< TUint8 >( ( r1 + ( ( r1 + r2 ) >> 1 ) ) >> 1 );
+            }
+
+        *d1++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+        *d1++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+        *d1++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+
+        *d1++ = static_cast< TUint8 >( g2 );
+        *d1++ = static_cast< TUint8 >( b2 );
+        *d1++ = static_cast< TUint8 >( r2 );
+
+        d += dpitch * 2;
+        s += spitch;
+        }
+
+    // then average rows between
+    d = reinterpret_cast< TUint8* >( iTarget->DataAddress() );
+
+    for( y = 0; y < sheight - 1; y++ )
+        {
+        TUint8* d1 = d;
+        TUint8* d2 = d1 + dpitch;
+        TUint8* d3 = d2 + dpitch;
+
+        for( TInt x = 0; x < swidth; x++ )
+            {
+            TUint32 g1 = *d1++;
+            TUint32 g2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+
+            TUint32 b1 = *d1++;
+            TUint32 b2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+
+            TUint32 r1 = *d1++;
+            TUint32 r2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+
+            g1 = *d1++;
+            g2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( g1 + g2 ) >> 1 );
+
+            b1 = *d1++;
+            b2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( b1 + b2 ) >> 1 );
+
+            r1 = *d1++;
+            r2 = *d3++;
+            *d2++ = static_cast< TUint8 >( ( r1 + r2 ) >> 1 );
+            }
+
+        d += dpitch * 2;
+        }
+
+    // last row is just copy of previous row, because we cannot calculate
+    // average
+    Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x16M() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtImageScalerImplWeightedAverage::Scale2x16MU16MA()
+// -----------------------------------------------------------------------------
+void CVtImageScalerImplWeightedAverage::Scale2x16MU16MA()
+    {
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x16MU16MA() >>" ), RThread().Id().operator TUint() ) );
+
+    TInt sheight = iSource->Size().iHeight;
+    TInt swidth = iSource->Size().iWidth;
+    TInt spitch = iSource->BytesPerRow();
+    TInt dpitch = iTarget->BytesPerRow();
+
+    TUint32 mask = 0xfefefefe;
+    TUint32* s = iSource->DataAddress();
+    TUint32* d = iTarget->DataAddress();
+    TInt y;
+
+    // first average source rows
+    for( y = 0; y < sheight; y++ )
+        {
+        TInt x;
+        TUint32* s1 = s;
+        TUint32* d1 = d;
+        TUint32 p2 = *s1++;
+        TUint32 p1 = 0;
+        for( x = 0; x < swidth - 1; x++ )
+            {
+            p1 = p2;
+            *d1++ = p1;
+            p2 = *s1++;
+            TUint32 p1a = ( ( ( p1 ^ p2 ) & mask ) >> 1 ) + ( p1 & p2 );
+            p1a = ( ( ( p1 ^ p1a ) & mask ) >> 1 ) + ( p1 & p1a );
+            *d1++ = p1a;
+            }
+
+        if( swidth & 1 )
+            {
+            TUint32 p2a = ( ( ( p1 ^ p2 ) & mask ) >> 1 ) + ( p1 & p2 );
+            p2a = ( ( ( p2a ^ p2 ) & mask ) >> 1 ) + ( p2a & p2 );
+            *d1++ = p2a;
+            *d1++ = p2;
+            }
+        else
+            {
+            p2 = *--s1;
+            *d1++ = p2;
+            *d1++ = p2;
+            }
+
+        d = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+        s = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( s ) + spitch );
+        }
+
+    // then average rows between
+    d = iTarget->DataAddress();
+
+    for( y = 0; y < sheight - 1; y++ )
+        {
+        TUint32* d1 = reinterpret_cast< TUint32* >( d );
+        TUint32* d2 = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d1 ) + dpitch );
+        TUint32* d3 = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d2 ) + dpitch );
+
+        TUint32 p1 = *d1++;
+
+        for( TInt x = 0; x < swidth - 1; x++ )
+            {
+            TUint32 p3 = *d3++;
+            d3++;
+
+            TUint32 r1 = ( ( ( p1 ^ p3 ) & mask ) >> 1 ) + ( p1 & p3 );
+            r1 = ( ( ( p1 ^ r1 ) & mask ) >> 1 ) + ( p1 & r1 );
+
+            *d2++ = r1;
+
+            d1++;
+            TUint32 p2 = *d1++;
+
+            TUint32 r2 = ( ( ( p2 ^ p3 ) & mask ) >> 1 ) + ( p2 & p3 );
+            r2 = ( ( ( p1 ^ r2 ) & mask ) >> 1 ) + ( p1 & r2 );
+
+            *d2++ = r2;
+
+            p1 = p2;
+            }
+
+        TUint32 p3 = *d3++;
+        TUint32 r1 = ( ( ( p1 ^ p3 ) & mask ) >> 1 ) + ( p1 & p3 );
+        r1 = ( ( ( p1 ^ r1 ) & mask ) >> 1 ) + ( p1 & r1 );
+        *d2++ = r1;
+        *d2++ = r1;
+
+        d = reinterpret_cast< TUint32* >
+            ( reinterpret_cast< TUint8* >( d ) + dpitch * 2 );
+        }
+
+    // last row is just copy of previous row, because we cannot calculate
+    // average
+    Mem::Copy( reinterpret_cast< TUint8* >( d ) + dpitch, d, dpitch );
+
+    __IF_DEBUG( Print( _L( "ImageScaler [%d]: CVtImageScalerImplWeightedAverage::Scale2x16MU16MA() <<" ), RThread().Id().operator TUint() ) );
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/DisplaySink/src/vtyuvconverter.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2005-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:  YUV format transcoder.
+*
+*/
+
+
+#include "vtyuvconverter.h"
+
+#ifdef _DEBUG
+    #include <e32debug.h>
+    #define PRINT RDebug::Print
+    #define _IFDBG(a) a
+#else
+    #define PRINT
+    #define _IFDBG(a)
+#endif
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// VtYuvConverter::ConvertFrom420PlanarTo422Interleaved
+// ---------------------------------------------------------------------------
+//
+TInt VtYuvConverter::ConvertFrom420PlanarTo422Interleaved(
+    const TDesC8& aSource,
+    const TSize& aSize,
+    TDes8& aTarget,
+    TInt aStride )
+    {
+    _IFDBG(PRINT( _L( "VtYuvConverter::ConvertFrom420PlanarTo422Interleaved<" ) ));
+
+    if ( aTarget.MaxLength() < ByteSize422Interleaved( aSize ) )
+        {
+        _IFDBG(PRINT( _L( "VtYuvConverter::ConvertFrom420PlanarTo422Interleaved> TargetMaxLength < ByteSize422" ) ));
+        return KErrUnderflow;
+        }
+
+    if ( aSource.Size() != ByteSize420Planar( aSize ) )
+        {
+        _IFDBG(PRINT( _L( "VtYuvConverter::ConvertFrom420PlanarTo422Interleaved> 420SourceSize != ByteSize420" ) ));
+        return KErrArgument;
+        }
+
+    TInt planeSize( aSize.iWidth * aSize.iHeight );
+    const TUint8* sy = aSource.Ptr();
+    const TUint8* su = sy + planeSize;
+    const TUint8* sv = su + ( planeSize >> 2 );
+    TUint8* t = const_cast< TUint8* >( aTarget.Ptr() );
+
+    TUint8* tsave = t;
+    for ( TInt y = ( aSize.iHeight >> 1 ) - 1; y >= 0; y-- )
+        {
+        const TUint8* susave = su;
+        const TUint8* svsave = sv;
+        for ( TInt x = ( aSize.iWidth >> 1 ) - 1; x >= 0; x-- )
+            {
+            *t++ = *su++;
+            *t++ = *sy++;
+            *t++ = *sv++;
+            *t++ = *sy++;
+            }
+        tsave = t = tsave + aStride;
+        su = susave;
+        sv = svsave;
+        for ( TInt x = ( aSize.iWidth >> 1 ) - 1; x >= 0; x-- )
+            {
+            *t++ = *su++;
+            *t++ = *sy++;
+            *t++ = *sv++;
+            *t++ = *sy++;
+            }
+        tsave = t = tsave + aStride;
+        }
+
+    _IFDBG(PRINT( _L( "VtYuvConverter::ConvertFrom420PlanarTo422Interleaved>" ) ));
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// VtYuvConverter::ByteSize420Planar
+// ---------------------------------------------------------------------------
+//
+TInt VtYuvConverter::ByteSize420Planar( const TSize& aSizeInPixels )
+    {
+    TInt planeSize( aSizeInPixels.iWidth * aSizeInPixels.iHeight );
+    return planeSize + planeSize / 2;
+    }
+
+// ---------------------------------------------------------------------------
+// VtYuvConverter::ByteSize422Interleaved
+// ---------------------------------------------------------------------------
+//
+TInt VtYuvConverter::ByteSize422Interleaved( const TSize& aSizeInPixels )
+    {
+    TInt planeSize( aSizeInPixels.iWidth * aSizeInPixels.iHeight );
+    return planeSize * 2;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/EABI/VideoSourceU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,38 @@
+EXPORTS
+	_ZN13CVSController4NewLEP21MVSControllerObserver @ 1 NONAME
+	_ZN14CVsFrameBuffer4NewLEi @ 2 NONAME
+	_ZN14CVsFrameBufferD0Ev @ 3 NONAME
+	_ZN14CVsFrameBufferD1Ev @ 4 NONAME
+	_ZN14CVsFrameBufferD2Ev @ 5 NONAME
+	_ZN16CVSMMFDataBuffer4NewLEi @ 6 NONAME
+	_ZN16CVSMMFDataBuffer4NewLEv @ 7 NONAME
+	_ZN16CVSMMFDataBufferD0Ev @ 8 NONAME
+	_ZN16CVSMMFDataBufferD1Ev @ 9 NONAME
+	_ZN16CVSMMFDataBufferD2Ev @ 10 NONAME
+	_ZTI14CVsFrameBuffer @ 11 NONAME ; #<TI>#
+	_ZTI15CVSDataProvider @ 12 NONAME ; #<TI>#
+	_ZTI16CVSControllerImp @ 13 NONAME ; #<TI>#
+	_ZTI16CVSDataSourceImp @ 14 NONAME ; #<TI>#
+	_ZTI16CVSMMFDataBuffer @ 15 NONAME ; #<TI>#
+	_ZTI17CVSFrameRateTimer @ 16 NONAME ; #<TI>#
+	_ZTI18CSyncCameraReserve @ 17 NONAME ; #<TI>#
+	_ZTI19CVSProviderSwitchAO @ 18 NONAME ; #<TI>#
+	_ZTI21CVSCameraDataProvider @ 19 NONAME ; #<TI>#
+	_ZTI23CVSDataSourceObserverAO @ 20 NONAME ; #<TI>#
+	_ZTI24CProviderErrorNotifierAO @ 21 NONAME ; #<TI>#
+	_ZTI25CVSStillImageDataProvider @ 22 NONAME ; #<TI>#
+	_ZTI28CVSOnboardCameraDataProvider @ 23 NONAME ; #<TI>#
+	_ZTV14CVsFrameBuffer @ 24 NONAME ; #<VT>#
+	_ZTV15CVSDataProvider @ 25 NONAME ; #<VT>#
+	_ZTV16CVSControllerImp @ 26 NONAME ; #<VT>#
+	_ZTV16CVSDataSourceImp @ 27 NONAME ; #<VT>#
+	_ZTV16CVSMMFDataBuffer @ 28 NONAME ; #<VT>#
+	_ZTV17CVSFrameRateTimer @ 29 NONAME ; #<VT>#
+	_ZTV18CSyncCameraReserve @ 30 NONAME ; #<VT>#
+	_ZTV19CVSProviderSwitchAO @ 31 NONAME ; #<VT>#
+	_ZTV21CVSCameraDataProvider @ 32 NONAME ; #<VT>#
+	_ZTV23CVSDataSourceObserverAO @ 33 NONAME ; #<VT>#
+	_ZTV24CProviderErrorNotifierAO @ 34 NONAME ; #<VT>#
+	_ZTV25CVSStillImageDataProvider @ 35 NONAME ; #<VT>#
+	_ZTV28CVSOnboardCameraDataProvider @ 36 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/bmarm/VIDEOSOURCEU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	NewL__13CVSControllerP21MVSControllerObserver @ 1 NONAME R3UNUSED ; CVSController::NewL(MVSControllerObserver *)
+	SwitchDataProviderL__16CVSDataSourceImpP15CVSDataProvider @ 2 NONAME R3UNUSED ; CVSDataSourceImp::SwitchDataProviderL(CVSDataProvider *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/bwins/VIDEOSOURCEU.DEF	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,8 @@
+EXPORTS
+	??1CVSMMFDataBuffer@@UAE@XZ @ 1 NONAME ; CVSMMFDataBuffer::~CVSMMFDataBuffer(void)
+	??1CVsFrameBuffer@@UAE@XZ @ 2 NONAME ; CVsFrameBuffer::~CVsFrameBuffer(void)
+	?NewL@CVSController@@SAPAV1@PAVMVSControllerObserver@@@Z @ 3 NONAME ; class CVSController * CVSController::NewL(class MVSControllerObserver *)
+	?NewL@CVSMMFDataBuffer@@SAPAV1@H@Z @ 4 NONAME ; class CVSMMFDataBuffer * CVSMMFDataBuffer::NewL(int)
+	?NewL@CVSMMFDataBuffer@@SAPAV1@XZ @ 5 NONAME ; class CVSMMFDataBuffer * CVSMMFDataBuffer::NewL(void)
+	?NewL@CVsFrameBuffer@@SAPAV1@H@Z @ 6 NONAME ; class CVsFrameBuffer * CVsFrameBuffer::NewL(int)
+
Binary file vtprotocolplugins/VideoSource/data/videosource_stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/data/videosource_stub.pkg	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,29 @@
+;
+; 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:
+;
+; Languages
+&EN
+
+; Header
+#{"videosource"}, (0x101F8692), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\videosource.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/group/CApiVideoSource.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* 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:  Project definition file for Video Source subsystem
+*
+*/
+
+
+#include        <platform_paths.hrh>
+#include        "../inc/VideoSourceUids.hrh"
+
+TARGET          videosource.dll
+TARGETTYPE      dll
+VENDORID        VID_DEFAULT
+
+UID             KSharedLibraryUidDefine KUidVideoSourceLibrary
+
+SOURCEPATH      ../src
+SOURCE			CVSController.cpp
+SOURCE          CVSControllerImp.cpp
+SOURCE			CVSDataProvider.cpp
+SOURCE          CVSStillImageDataProvider.cpp
+SOURCE          CVSCameraDataProvider.cpp
+SOURCE          CVSOnboardCameraDataProvider.cpp
+SOURCE          CVSDataSourceImp.cpp
+SOURCE          CVSMMFDataBuffer.cpp
+
+SOURCE          cmultiframeloopao.cpp
+SOURCE          cmultiframeprovider.cpp
+SOURCE 			cmultiframedataao.cpp
+USERINCLUDE     ../inc
+SYSTEMINCLUDE   ../../../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE	/epoc32/include/mmf/server
+SYSTEMINCLUDE	/epoc32/include/mmf/common
+
+LIBRARY			euser.lib
+LIBRARY			fbscli.lib
+LIBRARY			mmfcontrollerframework.lib
+LIBRARY			ecam.lib
+LIBRARY			efsrv.lib
+LIBRARY			bafl.lib
+LIBRARY			bitgdi.lib
+LIBRARY			imageconversion.lib
+LIBRARY			vtimageconverter.lib
+LIBRARY         vtimagetransforms.lib
+LIBRARY			featmgr.lib
+LIBRARY			phoneclient.lib
+LIBRARY         ws32.lib
+LIBRARY         ecamadvsettings.lib
+
+CAPABILITY      CAP_GENERAL_DLL
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2004 - 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:  Component definition file for Video Source subsystem
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CApiVideoSource.h    |../../../inc/capivideosource.h
+../inc/capivideosource.inl  |../../../inc/capivideosource.inl
+
+// Export SIS stub file
+../data/videosource_stub.SIS      /epoc32/data/z/system/install/videosource_stub.sis
+
+// Export IBY file
+../rom/VideoSource.iby            CORE_APP_LAYER_IBY_EXPORT_PATH(videosource.iby)
+
+PRJ_MMPFILES
+CApiVideoSource.mmp
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CApiVideoSource.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,922 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+#ifndef CAPIVIDEOSOURCE_H
+#define CAPIVIDEOSOURCE_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <ecam.h>
+#include <mmfutilities.h>
+#include <mmfdatasource.h>
+#include <mvtprotocolhandler.h>
+#include <ecamimageprocessing.h>
+
+// FORWARD DECLARATIONS
+
+class MVSControllerObserver;
+class MVSDataSourceObserver;
+class MVSDataProviderObserver;
+class CVSDataSource;
+class CVSDataProvider;
+class TVSDataProviderInfo;
+class CVSDataSourceImp;
+class CProviderErrorNotifierAO;
+
+class MFrameBuffer;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class CFbsBitmap;
+class MDataSink;
+class MDataSource;
+class MAsyncEventHandler;
+class TMMFPrioritySettings;
+class TMMFMessage;
+class CDesC8Array;
+class CVSMMFDataBuffer;
+
+// Camera lost during VT error
+const TInt KVsErrCameraNoLongerReserved = 666;
+// CLASS DECLARATION
+
+/**
+*  Initialization settings class for still image provider.
+*
+*  @lib videosource.lib
+*/
+class TVSStillImageDataProviderParams
+    {
+    public:
+        /**
+        * Enumeration that defines different initialization
+        * types.
+        */
+        enum TInitialize
+            {
+            /** Created as blank image */
+            EInitializeAsBlankImage,
+            /** Image will be load from General Settings */
+            EInitializeFromGeneralSettings,
+            /** Image will be from file */
+            EInitializeFromFile,
+            /** Imge will be load from phone server */
+            EInitializeAsDefaultStillImage
+            };
+
+    public:
+        /**
+         * Constructor, set iInitialize to EInitializeAsBlankImage. iFileName
+         * is initialized as an empty descriptor.
+         */
+        inline TVSStillImageDataProviderParams();
+
+        /**
+         * Constructor. iFileName is initialized as an empty descriptor.
+         * @param aInitialize Defines how provider must be initialized.
+         */
+        inline TVSStillImageDataProviderParams( const TInitialize aInitialize );
+
+        /**
+         * Constructor. iInitialize is set to EInitializeFromFile.
+         * @param aFileName Name of the file from which this instance will
+         * be initialized.
+         */
+        inline TVSStillImageDataProviderParams( const TFileName& aFileName );
+
+    public:
+        // Initialization type
+        TInitialize iInitialize;
+
+        // Filename for EInitializeFromFile
+        TFileName iFileName;
+    };
+
+typedef TPckgBuf< TVSStillImageDataProviderParams > TVSStillImageDataProviderParamsBuf;
+
+/**
+*  An interface to access free MMF buffers.
+*
+*  @lib videosource.lib
+*/
+class MVSBufferPool
+    {
+    public:
+
+        /**
+        * Pure virtual function to get next free buffer from free buffer pool.
+        * @param "aRemove" Boolean flag. If ETrue buffer will be removed from
+        * the pool.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Returns pointer to next available buffer in free buffers
+        * queue or NULL if no buffers in queue are available.
+        */
+        virtual CVSMMFDataBuffer* GetBufferL( TBool aRemove ) = 0;
+
+        /**
+        * Frees buffer that was previously got using GetBufferL().
+        * @param "aBuffer" Buffer to be freed.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void FreeBufferL( CVSMMFDataBuffer* aBuffer ) = 0;
+    };
+
+/**
+*  An interface to a controller callback functions.
+*
+*  @lib videosource.lib
+*/
+class MVSControllerObserver
+    {
+    public:
+
+        /**
+        * Called when provider count has been changed.
+        * @param "aAttached" ETrue if provider attached, else EFalse.
+        */
+        virtual void vsProvidersChanged( TBool aAttached ) = 0;
+    };
+
+/**
+*  Controller interface.
+*
+*  @lib videosource.lib
+*/
+class CVSController : public CBase
+    {
+    public: // Constructor and destructor
+
+        /**
+        * Static factory function to create instance of this class.
+        * @param "aObserver" Pointer to controller observer.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        IMPORT_C static CVSController* NewL( MVSControllerObserver* aObserver );
+
+        /**
+        * Pure virtual function to create data source instance.
+        * @param "aObserver" Pointer to data source observer.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new data source instance.
+        */
+        virtual CVSDataSource* CreateDataSourceL(
+            MVSDataSourceObserver* aObserver ) = 0;
+
+    public: // New functions
+
+        /**
+        * Pure virtual function to return provider count and provider index.
+        * @return Number of providers available. Count also acts as zero based
+        * provider index.
+        */
+        virtual TInt ProvidersAvailable() = 0;
+
+        /**
+        * Pure virtual function to return provider information.
+        * @param "aProviderIndex" Index of the provider to return information
+        * for.
+        * @param "aInfo" Reference to the variable where the provider
+        * information is copied.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void ProviderInfoL(
+            TInt aProviderIndex,
+            TVSDataProviderInfo& aInfo ) = 0;
+
+        /**
+        * Pure virtual function to create provider instance.
+        * @param "aProviderIndex" Index of the provider to be created.
+        * @param "aObserver" Pointer to provider observer.
+        * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+        * data provider.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new provider instance.
+        */
+        virtual CVSDataProvider* CreateDataProviderL(
+            TInt aProviderIndex,
+            MVSDataProviderObserver* aObserver,
+            MVSBufferPool* aPool ) = 0;
+
+    public: // Constructor and destructor
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        CVSController();
+
+        /**
+        * Inliner to return reference to the controller observer.
+        * @return Reference to the controller observer.
+        */
+        inline MVSControllerObserver& Observer() const;
+
+    protected:  // Constructor and destructor
+
+        /**
+        * 2nd phase constructor.
+        * @param "aObserver" Pointer to controller observer
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void ConstructL( MVSControllerObserver* aObserver ) = 0;
+
+    protected:  // Functions from base classes
+
+    public: // Data
+
+    protected:  // Data
+
+        // Pointer to controller observer
+        MVSControllerObserver* iObserver;
+
+    private:    // Data
+
+    };
+
+/**
+*  An interface to a provider callback functions.
+*
+*  @lib videosource.lib
+*/
+class MVSDataProviderObserver
+    {
+    public:
+
+        /**
+        * Called when an error occurred in provider.
+        * @param "aError" of the system wide error codes.
+        */
+        virtual void vsProviderError( TInt aError ) = 0;
+
+        /**
+        * Called when provider is initalized.
+        */
+        virtual void vsProviderReady() = 0;
+
+        /**
+        * Called when provider has view finder bitmap ready.
+        * @param "aFrame" Reference to the view finder bitmap.
+        */
+        virtual void vsViewFinderFrameReady( CFbsBitmap& aFrame ) = 0;
+    };
+
+/**
+*  Extension to standard ECam TCameraInfo class.
+*
+*  @lib videosource.lib
+*/
+class TVSDataProviderInfo : public TCameraInfo
+    {
+    public: // Data
+
+        // ETrue if the Freeze() is supported.
+        TBool iFreezeSupported;
+
+        // Pointer to extension information.
+        TAny* iExtension;
+
+        // A bitfield of suported colortones
+        TUint32 iSupportedColorTones;
+    };
+
+/**
+*  Provider interface.
+*
+*  @lib videosource.lib
+*/
+class CVSDataProvider : public CBase
+    {
+    public: // Constructor and destructor
+
+        /**
+        * Static factory function to create instance of this class.
+        * @param "aProviderIndex" Index of the provider to be created.
+        * @param "aObserver" Pointer to data provider observer.
+        * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+        * data provider.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        static CVSDataProvider* NewL(
+            TInt aProviderIndex,
+            MVSDataProviderObserver* aObserver,
+            MVSBufferPool* aPool );
+
+        /**
+        * Destructor.
+        */
+        ~CVSDataProvider();
+
+    public: // New functions
+
+        /**
+        * Static function get provider count and provider index.
+        * @return Number of providers available. Count also acts as zero based
+        * provider index.
+        */
+        static TInt ProvidersAvailable();
+
+        /**
+        * Static function to return provider information.
+        * @param "aProviderIndex" Index of the provider to return information
+        * for.
+        * @param "aInfo" Reference to the variable to where the provider
+        * information is copied.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        static void ProviderInfoL(
+            TInt aProviderIndex,
+            TVSDataProviderInfo& aInfo );
+
+        /**
+        * Pure virtual function to initialize provider.
+        * @param "aInitParams" Reference to the initialization parameters.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void InitializeL( const TDesC8& aInitParams ) = 0;
+
+        /**
+        * Pure virtual function to cancel initialization of provider.
+        */
+        virtual void CancelInitializing() = 0;
+        
+        /**
+        * Pure virtual function to return digital zoom factor.
+        * @return Digital zoom factor.
+        */
+        virtual TInt DigitalZoomFactor() const = 0;
+
+        /**
+        * Pure virtual function to set digital zoom factor.
+        * @param "aDigitalZoomFactor" Digital zoom factor.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void SetDigitalZoomFactorL( TInt aDigitalZoomFactor = 0 ) = 0;
+
+        /**
+        * Pure virtual function to start view finder bitmaps.
+        * @param "aSize" Size of the returned view finder bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderBitmapsL( TSize& aSize ) = 0;
+
+        /**
+        * Pure virtual function to start view finder bitmaps.
+        * @param "aSize" Size of the returned view finder bitmap.
+        * @param "aClipRect" Required clip rectangle.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderBitmapsL(
+            TSize& aSize,
+            TRect& aClipRect ) = 0;
+
+        /**
+        * Pure virtual function to start view finder bitmaps using direct
+        * screen access.
+        * @param "aWs" Window server session.
+        * @param "aScreenDevice" Screen device.
+        * @param "aWindow" Displayable window.
+        * @param "aScreenRect" Portion of the screen to which view finder data
+        * is to be transferred.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderDirectL(
+            RWsSession& aWs,
+            CWsScreenDevice& aScreenDevice,
+            RWindowBase& aWindow,
+            TRect& aScreenRect ) = 0;
+
+        /**
+        * Pure virtual function to start view finder bitmaps using direct
+        * screen access.
+        * @param "aWs" Window server session.
+        * @param "aScreenDevice" Screen device.
+        * @param "aWindow" Displayable window.
+        * @param "aScreenRect" Portion of the screen to which view finder data
+        * is to be transferred.
+        * @param "aClipRect" The rectangle to which the screen will be clipped.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderDirectL(
+            RWsSession& aWs,
+            CWsScreenDevice& aScreenDevice,
+            RWindowBase& aWindow,
+            TRect& aScreenRect,
+            TRect& aClipRect ) = 0;
+
+        /**
+        * Pure virtual function to test if view finder is active.
+        * @return ETrue if view finder active.
+        */
+        virtual TBool ViewFinderActive() const = 0;
+
+        /**
+        * Pure virtual function to stop view finder bitmaps.
+        */
+        virtual void StopViewFinder() = 0;
+
+        /**
+        * Pure virtual function to return provider information.
+        * @param "aInfo" Reference to the variable to where the provider
+        * information is copied.
+        */
+        virtual void ProviderInfo( TVSDataProviderInfo& aInfo ) = 0;
+
+        /**
+        * Used to switch between what the camera sees and what you would see
+        * if the device were a mirror.
+        * @param "aMirror" ETrue to set mirroring on, EFalse to set mirroring off.
+        * @exception May leave with KErrNotSupported.
+        */
+        virtual void SetViewFinderMirrorL( TBool aMirror ) = 0;
+
+        /**
+        * Gets whether view finder mirroring is active.
+        * @return ETrue if mirroring is set, EFalse if mirroring is not set.
+        */
+        virtual TBool ViewFinderMirror() const = 0;
+
+        /**
+        * Freezes video (i.e. starts sending the last frame until provider is
+        * unfrozen).
+        * @exception May leave with KErrNotSupported if freezing is not supported
+        * by the provider.
+        */
+        virtual void FreezeL() = 0;
+
+        /**
+        * Unfreezes video (i.e. starts sending actual frames).
+        * @exception May leave with KErrNotSupported if freezing
+        * is not supported
+        * by the provider.
+        */
+        virtual void UnfreezeL()= 0;
+
+        /**
+        * Gets whether freeze is active.
+        * @return ETrue if video is frozen, EFalse otherwise.
+        */
+        virtual TBool IsFrozen() const = 0;
+
+       	/**
+		* Sets the contrast adjustment of the device.
+		* This must be in the range of -100 to +100 or EContrastAuto.
+		* May leave with KErrNotSupported if the specified contrast value
+		* is out of range.
+		* @since S60 v3.2
+		* @param  aContrast
+		*/
+		virtual void SetContrastL( TInt aContrast ) = 0;
+
+		/**
+		* Gets the currently set contrast value.
+		* @since S60 v3.2
+		* @param  aContrast The currently set contrast value.
+		* @return indication if method succeed or not.
+		*/
+		virtual TInt GetContrast( TInt& aContrast ) const = 0;
+
+		/**
+		* Sets the brightness adjustment of the device.
+		* This must be in the range of -100 to +100 or EBrightnessAuto.
+		* May leave with KErrNotSupported if the brightness adjustment
+		* is out of range.
+		* @since S60 v3.2
+		* @param  aBrightness The required brightness adjustment.
+		*/
+		virtual void SetBrightnessL( TInt aBrightness ) = 0;
+
+		/**
+		* Gets the currently set brightness adjustment value.
+		* @since S60 v3.2
+		* @param aBrightness  The currently set brightness adjustment value.
+		* @return indication if method succeed or not.
+		*/
+		virtual TInt GetBrightness( TInt& aBrightness ) const = 0;
+
+        /**
+		* Sets the white balance adjustment of the device.
+		* No effect if this is not supported, see
+		* TCameraInfo::iWhiteBalanceModesSupported.
+		* @since S60 v3.2
+		* @param  aWhiteBalance The required white balance adjustment.
+		* @leave  KErrNotSupported if the specified white balance adjustment
+	    * is invalid.
+		*/
+		virtual void SetWhiteBalanceL(
+			CCamera::TWhiteBalance aWhiteBalance = CCamera::EWBAuto)   = 0;
+
+		/**
+		* Gets the currently set white balance adjustment value.
+		* @since S60 v3.2
+		* @param aWhiteBalance The currently set white balance adjustment value.
+		* @return indication if method succeed or not.
+		*/
+		virtual TInt GetWhiteBalance(
+			CCamera::TWhiteBalance& aWhiteBalance ) const = 0;
+
+        /**
+        * Gives the current color tone setting value
+        * @since S60 v3.2
+		* @param aColorTone The currently set color tone adjustment value.
+		* @return indication if method succeed or not.
+		*/
+        virtual TInt GetColorTone(
+        	CCamera::CCameraImageProcessing::TEffect& aColorTone ) const = 0;
+
+        /**
+        * Sets color tone
+        * @since S60 v3.2
+        * @param aValue new color tone
+        */
+        virtual void SetColorToneL(
+        	CCamera::CCameraImageProcessing::TEffect aValue ) = 0;
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void FillBufferL(
+            CMMFBuffer* aBuffer,
+            MVTVideoSink* aConsumer,
+            TMediaId aMediaId ) = 0;
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler ) = 0;
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourceThreadLogoff() = 0;
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourcePrimeL() = 0;
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourcePlayL() = 0;
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourcePauseL() = 0;
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourceStopL() = 0;
+
+    private:    // New functions
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void SetFormatL( const TDesC8& aFormat ) = 0;
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void SetFrameRateL( TReal32 aFrameRate ) = 0;
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void SetVideoFrameSizeL( const TSize& aSize ) = 0;
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void GetVideoFrameSizeL( TSize& aSize ) const = 0;
+
+    private:    // Functions from base classes
+
+    protected:  // New functions
+
+        /**
+        * This version of prime method will be called when a provider
+        * is being switched.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void PrimeL() = 0;
+
+        /**
+        * Inliner to test if FillBufferL call is active.
+        * @return ETrue if FillBufferL call is ongoing, else EFalse.
+        */
+        inline TBool FillBufferActive() const;
+
+        /**
+        * Inliner to return the sink that will empty the buffer.
+        * @return Pointer to sink.
+        */
+        inline MVTVideoSink* Consumer() const;
+
+        /**
+        * Inliner to return sink media ID that is used.
+        * @return Media ID identifiyng the stream that is used.
+        */
+        inline TMediaId MediaId() const;
+
+        /**
+        * Inliner to return reference to the provider observer.
+        * @return Reference to the provider observer.
+        */
+        inline MVSDataProviderObserver& Observer() const;
+
+        /**
+        * Saves input parameters given in FillBufferL call.
+        * @param "aConsumer" Pointer to sink that will empty the filled buffer.
+        * @param "aMediaId" Media ID for source/provider stream that is used.
+        */
+        virtual void SetFillBufferParams(
+            MVTVideoSink* aConsumer,
+            TMediaId aMediaId );
+
+        /**
+        * Notify observer about provider error.
+        * @param "aError" Error code
+        */
+        void NotifyError( TInt aError );
+
+        /**
+        * Inliner to return reference to the buffer pool.
+        * @return Reference to the buffer pool.
+        */
+        inline MVSBufferPool& BufferPool() const;
+
+    protected:  // Constructor and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CVSDataProvider();
+
+        /**
+        * Constructor.
+        * @param "aObserver" Pointer to provider observer.
+        */
+        CVSDataProvider(
+            MVSDataProviderObserver* aObserver,
+            MVSBufferPool* aPool );
+
+        /**
+        * 2nd phase constructor.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void ConstructL();
+
+        /**
+        * Returns microseconds from the first SourcePlayL() call.
+        */
+        const TTimeIntervalMicroSeconds& TimeToPlay();
+
+        /**
+        * Resets start time (the time when SourcePlayL() was called).
+        * iStartTime is set to TTime::HomeTime().
+        */
+        void ResetStartTime();
+
+    private:    // New functions
+
+        /**
+        *
+        */
+        static TInt CamerasAvailable();
+
+        /**
+        * Sets timestamp for first SourcePlayL() call. This method
+        * is called by the CVSDataSource when data provider is switched.
+        */
+        void SwitchFrom( const CVSDataProvider& anOldProvider );
+
+        /**
+        * Enumerate all providers and create a set of formats that is supported
+        * by all of them.
+        */
+        static void EnumerateVideoFrameFormatsL(
+            CDesC8Array* aSupportedFormats );
+
+        /**
+        * Enumerate all providers and create a set of video frame sizes that
+        * is supported by all of them.
+        */
+        static void EnumerateVideoFrameSizesL(
+            RArray<TSize>& aSupportedSizes,
+            const TDesC8& aFormat );
+
+        /**
+        * Enumerate all providers and create a set of video frame rates that
+        * is supported by all of them.
+        */
+        static void EnumerateVideoFrameRatesL(
+            RArray<TReal32>& aSupportedRates,
+            const TDesC8& aFormat,
+            const TSize& aSize );
+
+    protected:  // New functions
+
+        /**
+        * Get video frame size. Implemented in each provider.
+        */
+        virtual void GetVideoFrameSize(
+            TSize& aSize,
+            TInt aSizeIndex,
+            const TDesC8& aFormat ) = 0;
+
+        /**
+        * Get video frame rate. Implemented in each provider.
+        */
+        virtual void GetVideoFrameRate(
+            TReal32& aRate,
+            TInt aRateIndex,
+            const TDesC8& aFormat,
+            const TSize& aSize ) = 0;
+
+    public: // Data
+
+    protected:  // Data
+
+        // Boolean that is ETrue when FillBufferL call is active.
+        TBool iFillBufferActive;
+
+        // Sink that empties the buffer filled with video frame. Not owned.
+        MVTVideoSink* iConsumer;
+
+        // Provider's media ID identifying media stream used.
+        TMediaId iMediaId;
+
+    private:    // Data
+
+        // Pointer to provider observer.
+        MVSDataProviderObserver* iObserver;
+
+        // Pointer to AO that reports provider errors to provider observer,
+        // used through NotifyError call.
+        CProviderErrorNotifierAO* iErrorNotifier;
+
+        // Pointer to buffer pool
+        MVSBufferPool* iPool;
+
+        // Previous TimeToPlay interval
+        TTimeIntervalMicroSeconds iPreviousTimeToPlay;
+
+        // Start time (time when SourcePlayL() was called)
+        TTime iStartTime;
+
+    private:    // Data
+
+        // Source is friend because it's MDataSource and MVTVideoInput derived
+        // calls are forwarded to provider.
+        friend class CVSDataSource;
+
+        // Source is friend because it's MDataSource and MVTVideoInput derived
+        // calls are forwarded to provider.
+        friend class CVSDataSourceImp;
+    };
+
+/**
+*  An interface to a data source callback functions.
+*
+*  @lib videosource.lib
+*/
+class MVSDataSourceObserver
+    {
+    public:
+
+        /**
+        * Called when provider switch completed.
+        * @param "aOldProvider" Pointer provider that was previously active.
+        */
+        virtual void vsProviderSwitchDone( CVSDataProvider* aOldProvider ) = 0;
+    };
+
+/**
+*  Data source interface.
+*
+*  @lib videosource.lib
+*/
+class CVSDataSource :
+    public CBase,
+    public MVTVideoSource,
+    public MVSBufferPool
+    {
+    public: // Constructor and destructor
+
+        /**
+        * Static factory function to create data source instance.
+        * @param "aObserver" Pointer to data source observer.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to data source instance.
+        */
+        static CVSDataSource* NewSourceL( MVSDataSourceObserver* aObserver );
+
+    public: // New functions
+
+        /**
+        * Pure virtual function to switch active provider for source.
+        * @param "aNewProvider" Pointer to provider instance.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void SwitchDataProviderL( CVSDataProvider* aNewProvider ) = 0;
+
+        /**
+        * Temporarily pause video sending. Used during initialization.
+        */
+        virtual void PauseSending() = 0;
+
+        /**
+        * Resume video sending. Used during initialization.
+        */
+        virtual void ResumeSending() = 0;
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+        /**
+        * Inliner to return reference to the data source observer.
+        * @return Reference to the data source observer.
+        */
+        inline MVSDataSourceObserver& Observer() const;
+
+        /**
+        * Inliner to return reference to the provider that is active.
+        * @return Reference to the provider.
+        */
+        inline CVSDataProvider& DataProvider() const;
+
+        /**
+        * Inliner to update member variable holding pointer to provider with
+        * new provider pointer.
+        * @param "aNewProvider" Pointer to (new) provider.
+        * @return Pointer to (old) provider.
+        */
+        inline CVSDataProvider* SwitchProvider( CVSDataProvider* aNewProvider );
+
+    protected:  // Constructor and destructor
+
+        /**
+        * Constructor.
+        */
+        CVSDataSource();
+
+    private:    // Constructor and destructor
+
+        /**
+        * 2nd phase consturctor.
+        * @param "aObserver" Pointer to data source observer.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void ConstructL( MVSDataSourceObserver* aObserver );
+
+    private:    // New functions
+
+    private:    // Functions from base classes
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Pointer to data source observer.
+        MVSDataSourceObserver* iObserver;
+
+        // Pointer to active provider.
+        CVSDataProvider* iProvider;
+    };
+
+#include "capivideosource.inl"
+
+#endif      // CAPIVIDEOSOURCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSCameraDataProvider.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,517 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSCAMERADATAPROVIDER_H
+#define CVSCAMERADATAPROVIDER_H
+
+// INCLUDE FILES
+
+#include "CApiVideoSource.h"
+
+#include <cvtimagescaler.h>
+#include <cvtimagebitmap.h>
+// CLASS FORWARDS
+
+class CVsFrameBuffer;
+
+// CLASS DECLARATION
+
+/**
+*  Internal MFrameBuffer API.
+*
+*  @lib videosource.lib
+*  @since 5.0
+*/
+class MVsFrameBuffer
+    {
+
+public:
+
+    /**
+    * Copies properties from the given frame buffer.
+    * @param "aSource" Source frame buffer from which propreties will
+    * be copied.
+    */
+    virtual void CopyProperties( MFrameBuffer* aSource ) = 0;
+
+    /**
+    * Copies properties from the given camera buffer.
+    * @param "aSource" Source camera buffer from which propreties will
+    * be copied.
+    */
+    virtual void CopyProperties( MCameraBuffer* aSource ) = 0;
+
+    /**
+    * Copies frame data and properties from the given frame buffer.
+    * @param "aSource" Source frame buffer from which propreties and
+    * frame data will be copied.
+    */
+    virtual void CopyFrameL( MFrameBuffer* aSource ) = 0;
+
+	/**
+    * Copies frame data and properties from the given camera buffer.
+    * @param "aSource" Source camera buffer from which propreties and
+    * frame data will be copied.
+    */
+	virtual void CopyFrameL( MCameraBuffer* aSource ) = 0;
+
+    };
+
+/**
+*  Internal MFrameBuffer implementation.
+*
+*  @lib videosource.lib
+*/
+class CVsFrameBuffer : public CBase, public MVsFrameBuffer,
+    public MFrameBuffer, public MCameraBuffer
+    {
+    public:
+
+        /**
+        * Constructor.
+        * @param "sSize" Size of stored frame in bytes.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        IMPORT_C static CVsFrameBuffer* NewL( TInt aSize );
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CVsFrameBuffer();
+
+    public: // from MVsFrameBuffer
+
+        /**
+        * @see MVsFrameBuffer::CopyProperties
+        */
+        virtual void CopyProperties( MFrameBuffer* aSource );
+
+        /**
+        * @see MVsFrameBuffer::CopyProperties
+        */
+        virtual void CopyProperties( MCameraBuffer* aSource );
+
+        /**
+        * @see MVsFrameBuffer::CopyFrameL
+        */
+        virtual void CopyFrameL( MFrameBuffer* aSource );
+
+        /**
+        * @see MVsFrameBuffer::CopyFrameL
+        */
+    	virtual void CopyFrameL( MCameraBuffer* aSource );
+
+    public: // from MFrameBuffer
+
+        /**
+        * @see MFrameBuffer::DataL or MCameraBuffer::DataL
+        */
+        TDesC8* DataL( TInt aIndex );
+
+        /**
+        * @see MFrameBuffer::FrameL or MCameraBuffer::FrameL
+        */
+        CFbsBitmap* FrameL( TInt aIndex );
+
+        /**
+        * @see MFrameBuffer::Release or MCameraBuffer::Release
+        */
+        void Release();
+
+        /**
+        * @see MCameraBuffer::FrameSize
+        */
+        TInt FrameSize(TInt aFrameIndex);
+
+        /**
+        * @see MCameraBuffer::ChunkOffsetL
+        */
+        TInt ChunkOffsetL(TInt aFrameIndex);
+
+		/**
+        * @see MCameraBuffer::ChunkL
+        */
+		RChunk& ChunkL();
+
+		/**
+        * @see MCameraBuffer::BitmapL
+        */
+		CFbsBitmap& BitmapL(TInt aFrameIndex);
+
+		/**
+        * @see MCameraBuffer::NumFrames
+        */
+		TInt NumFrames();
+
+    private:
+
+        /**
+        * Constructor.
+        */
+        CVsFrameBuffer();
+
+        /**
+        * Second phase constructor.
+        * @param "aSize" Size of the frame in bytes.
+        */
+        void ConstructL( TInt aSize );
+
+    private:
+
+        HBufC8* iBuffer;
+
+        TPtr8 iPtr;
+
+    };
+
+/**
+*  Internal implementation of onboard camera data provider base class. This
+*  class is inherited from public provider interface.
+*
+*  @lib videosource.lib
+*/
+class CVSCameraDataProvider : public CVSDataProvider, public MCameraObserver, public MVtImageScalerObserver, public MCameraObserver2
+    {
+    public: // Constructor and destructor
+
+        /**
+        * Factory function to create instance of onboard camera data provider.
+        * @param "aObserver" Pointer to provider observer.
+        * @param "aProviderIndex" Index of the provider to be created.
+        * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+        * data provider.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new provider instance.
+        */
+        static CVSCameraDataProvider* NewL(
+            MVSDataProviderObserver* aObserver,
+            TInt aProviderIndex,
+            MVSBufferPool* aPool );
+
+        /**
+        * Destructor.
+        */
+        ~CVSCameraDataProvider();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * Initialize provider.
+        * @param "aInitParams" Initialization parameters.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void InitializeL( const TDesC8& aInitParams );
+
+        /**
+        * Cancel initialization of camera provider.
+        */
+        void CancelInitializing();
+        
+        /**
+        * Return digital zoom factor.
+        * @return Digital zoom factor.
+        */
+        virtual TInt DigitalZoomFactor() const;
+
+        /**
+        * Set digital zoom factor.
+        * @param "aDigitalZoomFactor" Digital zoom factor.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void SetDigitalZoomFactorL( TInt aDigitalZoomFactor = 0 );
+
+        /**
+        * Start view finder bitmaps.
+        * @param "aSize" Size of the returned view finder bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderBitmapsL( TSize& aSize );
+
+        /**
+        * Start view finder bitmaps.
+        * @param "aSize" Size of the returned view finder bitmap.
+        * @param "aClipRect" Required clip rectangle.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderBitmapsL( TSize& aSize,TRect& aClipRect );
+
+        /**
+        * Stop view finder bitmaps.
+        */
+        virtual void StopViewFinder();
+
+        /**
+        * Test if view finder is active.
+        * @return ETrue if view finder active.
+        */
+        virtual TBool ViewFinderActive() const;
+
+        /**
+        * Start view finder bitmaps using direct screen access.
+        * @param "aWs" Window server session.
+        * @param "aScreenDevice" Screen device.
+        * @param "aWindow" Displayable window.
+        * @param "aScreenRect" Portion of the screen to which view finder data
+        * is to be transferred.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderDirectL(
+            RWsSession& aWs,
+            CWsScreenDevice& aScreenDevice,
+            RWindowBase& aWindow,
+            TRect& aScreenRect );
+
+        /**
+        * Start view finder bitmaps using direct screen access.
+        * @param "aWs" Window server session.
+        * @param "aScreenDevice" Screen device.
+        * @param "aWindow" Displayable window.
+        * @param "aScreenRect" Portion of the screen to which view finder data
+        * is to be transferred.
+        * @param "aClipRect" The rectangle to which the screen will be clipped.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderDirectL(
+            RWsSession& aWs,
+            CWsScreenDevice& aScreenDevice,
+            RWindowBase& aWindow,
+            TRect& aScreenRect,
+            TRect& aClipRect );
+
+        /**
+        * Return provider information.
+        * @param @param "aInfo" Reference to variable to where the provider
+        * information is copied.
+        */
+        virtual void ProviderInfo( TVSDataProviderInfo& aInfo );
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual void SetViewFinderMirrorL( TBool aMirror );
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual TBool ViewFinderMirror() const;
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual void FreezeL();
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual void UnfreezeL();
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual TBool IsFrozen() const;
+
+       	/**
+		* @see CVSDataProvider::SetContrastL for description.
+		*/
+		virtual void SetContrastL( TInt aContrast );
+
+		/**
+		* @see CVSDataProvider::GetContrast
+		*/
+		virtual TInt GetContrast( TInt& aContrast ) const;
+
+		/**
+		* @see CVSDataProvider::SetBrightnessL for description.
+		*/
+		virtual void SetBrightnessL( TInt aBrightness );
+
+		/**
+		* @see CVSDataProvider::GetBrightness for description.
+		*/
+		virtual TInt GetBrightness( TInt& aBrightness ) const;
+
+		/**
+		* @see CVSDataProvider::SetWhiteBalanceL for description.
+		*/
+		virtual void SetWhiteBalanceL(
+			CCamera::TWhiteBalance aWhiteBalance = CCamera::EWBAuto );
+
+		/**
+		* @see CVSDataProvider::GetWhiteBalance for description.
+		*/
+		virtual TInt GetWhiteBalance(
+			CCamera::TWhiteBalance& aWhiteBalance ) const;
+
+		/**
+		* @see CVSDataProvider::GetColorTone for description.
+		*/
+        virtual TInt GetColorTone(
+        	CCamera::CCameraImageProcessing::TEffect& aColorTone ) const;
+
+  		/**
+		* @see CVSDataProvider::SetColorToneL for description.
+		*/
+        virtual void SetColorToneL(
+        	CCamera::CCameraImageProcessing::TEffect aValue );
+
+    protected: // from MCameraObserver
+
+        /**
+        * @see MCameraObserver::ImageReady
+        */
+        virtual void ImageReady( CFbsBitmap* aBitmap, HBufC8* aData,
+            TInt aError );
+
+        /**
+        * @see MCameraObserver::PowerOnComplete
+        */
+        virtual void PowerOnComplete( TInt aError );
+
+        /**
+        * @see MCameraObserver::ViewFinderFrameReady
+        */
+        virtual void ViewFinderFrameReady( CFbsBitmap& aFrame );
+
+    protected: // from MVtImageScalerObserver
+
+        /**
+        * @see MVtImageScalerObserver::ScalingFinished( TInt aError )
+        */
+        virtual void ScalingFinished( TInt aError );
+
+    protected: // from MCameraObserver2
+
+		/**
+        * @see MCameraObserver2::ImageBufferReady
+        */
+		virtual void ImageBufferReady( MCameraBuffer& aCameraBuffer,
+		    TInt aError );
+
+    protected:  // New functions
+
+        /**
+        * Inliner to return reference to the onboard camera handle.
+        * @return Reference to the onboard camera handle.
+        */
+        inline CCamera& Camera() const;
+
+    protected:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param "aObserver" Pointer to provider observer.
+        */
+        CVSCameraDataProvider(
+            MVSDataProviderObserver* aObserver,
+            MVSBufferPool* aPool );
+
+    private:    // Constructors and destructors
+
+        /**
+        * 2nd phase constructor.
+        * @param "aProviderIndex" Index of the provider to be created.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void ConstructL( TInt aProviderIndex );
+
+        void FreezeViewFinderFrame( CFbsBitmap& aFrame );
+
+        void ScaleFrozenBitmapL( TSize& aSize );
+
+    private:    // New functions
+
+        /**
+        * Return provider information.
+        */
+        void ProviderInfoExL( TVSDataProviderInfo& aInfo );
+
+    private:    // Functions from base classes
+
+    public: // Data
+
+    protected:  // Data
+
+        enum TFreezePendingFlags
+            {
+            EViewFinderFreezePending =      ( 1 << 0 ),
+            EVideoFrameFreezePending =      ( 1 << 1 )
+            };
+
+        // Camera handle number.
+        TInt iCameraHandle;
+
+        // ETrue after ReserveComplete for iCamera
+        TBool iReserverComplete;
+
+        // ETrue after PowerOnComplete for iCamera
+        TBool iPowerOnComplete;
+
+        // ETrue after Freeze
+        TBool iFrozen;
+
+        // Contains pending freeze flags after Freeze
+        TUint iFreezePendingFlags;
+        
+        // has frozen viewfinder frame copy
+        TBool iHasFrozenVFFrameCopyCreated;
+
+        CVsFrameBuffer* iFrozenFrame;
+
+        RCriticalSection iFreezeCS;
+
+    private:    // Data
+
+        // Camera handle.
+        CCamera* iCamera;
+
+        // owned: Copy of frozen VF frame
+        CFbsBitmap* iFrozenVFFrameCopy;
+
+        //
+        CVtImageBitmap* iSource;
+
+        // owned: Scaled version of frozen VF frame (this is sent)
+        CFbsBitmap* iFrozenVFFrameToBeSent;
+
+        //
+        CVtImageBitmap* iTarget;
+
+        // owned: Scaler instance
+        CVtImageScaler* iScaler;
+
+        // ETrue when frozen VF frame is ready to be sent EFalse otherwise
+        TBool iFrozenVfFrameReady;
+
+        // Camera image processing
+        CCamera::CCameraImageProcessing* iCamImgProc;
+
+    private: // friends
+
+        // Stif test module must be set as friend to be able to call protected
+        // and private methods
+        friend class CstiffVideoSourceAPICases;
+
+    };
+
+#include "CVSCameraDataProvider.inl"
+
+#endif      // CVSCAMERADATAPROVIDER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSCameraDataProvider.inl	Mon Nov 23 14:47:47 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:  Video Source subsystem.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::Camera
+// -----------------------------------------------------------------------------
+//
+inline CCamera& CVSCameraDataProvider::Camera() const
+    {
+    return *iCamera;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSControllerImp.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSCONTROLLERIMP_H
+#define CVSCONTROLLERIMP_H
+
+// INCLUDE FILES
+#include "CApiVideoSource.h"
+
+// CLASS DECLARATIONS
+
+/**
+*  Internal implementation of controller. This class is inherited from
+*  public controller interface.
+*
+*  @lib videosource.lib
+*/
+class CVSControllerImp : public CVSController
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Static factory function to create controller instance.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new controller instance.
+        */
+        static CVSControllerImp* NewL();
+
+        /**
+        * Destructor.
+        */
+        ~CVSControllerImp();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * Create data source instance.
+        * @param "aObserver" Pointer to data source observer.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new data source instance.
+        */
+        virtual CVSDataSource* CreateDataSourceL( 
+            MVSDataSourceObserver* aObserver );
+
+        /**
+        * Return provider count and provider index.
+        * @return Number of providers available. Count also acts as zero 
+        * based provider index.
+        */
+        virtual TInt ProvidersAvailable();
+
+        /**
+        * Return provider information.
+        * @param "aProviderIndex" Index of the provider to return information 
+        * for.
+        * @param "aInfo" Reference to the variable where the provider 
+        * information is copied.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void ProviderInfoL( 
+            TInt aProviderIndex, 
+            TVSDataProviderInfo& aInfo );
+
+        /**
+        * Create provider instance.
+        * @param "aProviderIndex" Index of the provider to be created.
+        * @param "aObserver" Pointer to provider observer.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new provider instance.
+        */
+        virtual CVSDataProvider* CreateDataProviderL( 
+            TInt aProviderIndex, 
+            MVSDataProviderObserver* aObserver, 
+            MVSBufferPool* aPool );
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // Constructors and destructor
+
+        /**
+        * 2nd phase constructor.
+        * @param "aObserver" Pointer to controller observer
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void ConstructL( MVSControllerObserver* aObserver );
+
+    private:    // New functions
+
+    private:    // Functions from base classes
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+    };
+
+#endif      // CVSCONTROLLERIMP_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSDataSourceImp.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,577 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSDATASOURCEIMP_H
+#define CVSDATASOURCEIMP_H
+
+//  INCLUDE FILES
+
+#include "CApiVideoSource.h"
+
+// FORWARD DECLARATIONS
+
+class CVSDataSourceImp;
+class CVSMMFDataBuffer;
+
+// CLASS DECLARATION
+
+/**
+*  Active Object that handles switch of active provider for data source.
+*
+*  @lib videosource.lib
+*/
+class CVSProviderSwitchAO : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Leave safe static constructor.
+        * @param "aDataSourceImp" Pointer to VSDataSourceImp instance.
+        */
+        static CVSProviderSwitchAO* NewL( CVSDataSourceImp* aDataSourceImp );
+
+        /**
+        * Destructor.
+        */
+        ~CVSProviderSwitchAO();
+
+    public: // New functions
+
+        /**
+        * Adds this instance to calling thread's active scheduler.
+        * @param "aEventHandler" Reference to asynchronous event handler. This
+        * will be given to provider that will be switched as active provider
+        * in SourceThreadLogon() call.
+        * @return Possible error code.
+        */
+        TInt ThreadLogon( MAsyncEventHandler& aEventHandler );
+
+        /**
+        * Removes this instance from calling thread's active scheduler.
+        */
+        void ThreadLogoff();
+
+        /**
+        * Initializes provider switch.
+        * @param "aNewProvider" Pointer to CVSDataProvider instance that will
+        * be set as active provider.
+        */
+        void InitiateProviderSwitch( CVSDataProvider* aNewProvider );
+
+        /**
+        * Return reference to event handler.
+        */
+        inline MAsyncEventHandler& EventHandler() { return *iEventHandler; }
+
+        /**
+        * Return pointer to new provider.
+        */
+        inline CVSDataProvider*& NewDataProvider() { return iNewProvider; }
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+        /**
+        * Constructor.
+        * @param "aDataSourceImp" Pointer to VSDataSourceImp instance.
+        */
+        CVSProviderSwitchAO( CVSDataSourceImp* aDataSourceImp );
+
+        /**
+        * Leave safe construtor
+        */
+        void ConstructL();
+
+    private:    // Functions from base classes
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void RunL();
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void DoCancel();
+
+    private:    // New functions
+
+        /**
+        * Signals this active object with given error code.
+        * @param "aError" Error code with which active object will be signalled.
+        */
+        void Signal( TInt aError );
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Pointer to data source implementation.
+        CVSDataSourceImp* iDataSourceImp; // not owned
+
+        // Pointer to data provider that will be switched.
+        CVSDataProvider* iNewProvider; // not owned
+
+        // Id of thread whose active scheduler this instance is added into.
+        TThreadId iThreadId;
+
+        // Pointer to async handler that will be given to the new provider in
+        // SourceThreadLogon() call.
+        MAsyncEventHandler* iEventHandler; // not owned
+
+        // Critical section for switch handling
+        RCriticalSection iSwitchCs;
+
+    };
+
+/**
+*  Data source observer active object. This AO is needed because we want to
+*  call vsProviderSwitchDone() callback
+*  in correct thread context.
+*
+*  @lib videosource.lib
+*/
+class CVSDataSourceObserverAO : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        CVSDataSourceObserverAO();
+
+        /**
+        * Destructor.
+        */
+        ~CVSDataSourceObserverAO();
+
+    public: // New functions
+
+        /**
+        * This method is called when CVSProviderSwitchAO has completed provider
+        * switching.
+        * @param "aObserver" Observer that will signalled when RunL() is called.
+        * @param "aOldProvider" Pointer to provider that was active before the
+        * provider switch was done.
+        */
+        void vsProviderSwitchDone(
+            MVSDataSourceObserver& aObserver,
+            CVSDataProvider* aOldProvider );
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+    private:    // Functions from base classes
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void RunL();
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void DoCancel();
+
+    private:    // New functions
+
+        /**
+        * Signals this active object with given error code.
+        * @param "aError" Error code with which active object will be signalled.
+        */
+        void Signal( TInt aError );
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Data source observer pointer
+        MVSDataSourceObserver* iObserver; // not owned
+
+        // Previous active provider
+        CVSDataProvider* iOldProvider; // not owned
+
+        // Thread Id whose active scheduler this instance is added into
+        TThreadId iThreadId;
+    };
+
+
+
+/**
+*  Internal implementation of data source. This class is inherited from
+*  public data source interface. Some of the implemented MVTVideoSource,
+*  MVTVideoInput calls are forwarded to active data provider,
+*  some are processed here.
+*
+*  @lib videosource.lib
+*/
+class CVSDataSourceImp : public CVSDataSource
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Static factory function to create instance of this class.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        static CVSDataSourceImp* NewSourceL();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * Switch active provider for source.
+        * @param "aNewProvider" Pointer to provider instance.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void SwitchDataProviderL( CVSDataProvider* aNewProvider );
+
+        /**
+        * @see CVSDataSource::PauseSending
+        */
+        void PauseSending();
+
+        /**
+        * @see CVSDataSource::ResumeSending
+        */
+        void ResumeSending();
+
+    public: // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        ~CVSDataSourceImp();
+
+    public: // Functions from base classes
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual void FillBufferL(
+            CMMFBuffer* aBuffer,
+            MVTVideoSink* aConsumer,
+            TMediaId aMediaId );
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        void BufferEmptiedL( CMMFBuffer* aBuffer );
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual TBool CanCreateSourceBuffer();
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual CMMFBuffer* CreateSourceBufferL(
+            TMediaId aMediaId,
+            TBool &aReference );
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual CMMFBuffer* CreateSourceBufferL(
+            TMediaId aMediaId,
+            CMMFBuffer& aSinkBuffer,
+            TBool &aReference );
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler );
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual void SourceThreadLogoff();
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual TInt SourcePrimeL();
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual TInt SourcePlayL();
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual TInt SourcePauseL();
+
+        /**
+        * From MVTVideoSource / MDataSource. See MDataSource for description.
+        */
+        virtual TInt SourceStopL();
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+        /**
+        * From MDataSource. See MDataSource for description.
+        */
+        virtual void ConstructSourceL(const TDesC8& aInitData);
+
+    public: // Functions from base classes
+
+        
+        virtual const RArray<TDesC8* >& GetMultimediaTypesL() const;
+
+
+
+    public: // Functions from base classes
+
+        /**
+        * From MVTVideoInput. See MVTVideoInput for description.
+        */
+        virtual void SetFormatL( const TDesC8& aFormat );
+
+        /**
+        * From MVTVideoInput. See MVTVideoInput for description.
+        */
+        virtual void SetFrameRateL( TReal32 aFrameRate );
+
+        /**
+        * From MVTVideoInput. See MVTVideoInput for description.
+        */
+        virtual void SetVideoFrameSizeL( const TSize& aSize );
+
+        /**
+        * From MVTVideoInput. See MVTVideoInput for description.
+        */
+        virtual void GetVideoFrameSizeL( TSize& aSize ) const;
+        
+    private:    // New functions
+
+        /**
+        * Starts provider switching. Switching must be done in correct thread
+        * context.
+        * @param "aNewProvider" Pointer to provider that will be switched as
+        * active.
+        * @param "aEventHandler" Reference to asynchronous event handler.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void DoProviderSwitchL(
+            CVSDataProvider* aNewProvider,
+            MAsyncEventHandler& aEventHandler );
+
+        /**
+        * Test if provider switch operation is ongoing.
+        * @return ETrue if provider switch operation was suspended because
+        * buffers were not free.
+        */
+        inline TBool SwitchPending() { return iSwitchPending; };
+
+        /**
+        * Notifies provider observer about error occurred in provider switch.
+        * @param "aError" Standard Symbian error code
+        */
+        void ProviderSwitchError( TInt aError );
+
+    private:    // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        CVSDataSourceImp();
+
+    private:    // Functions from base classes
+
+        /**
+        * From MVSBufferPool. See MVSBufferPool for description.
+        */
+        virtual CVSMMFDataBuffer* GetBufferL( TBool aRemove );
+
+        /**
+        * From MVSBufferPool. See MVSBufferPool for description.
+        */
+        virtual void FreeBufferL( CVSMMFDataBuffer* aBuffer );
+
+    private:    // New functions
+
+        /**
+        * Add buffer to free buffer pool without locking queue cs.
+        * @return One of the system wide error codes or KErrNone if no error
+        * happens.
+        * @param "aBuffer" A pointer to buffer to add to free buffer pool.
+        * If buffer pointer is found from active buffer pool it is first
+        * removed from there.
+        */
+        TInt FreeBufferNoWait( CVSMMFDataBuffer* aBuffer );
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Data source state
+        enum TDataSourceState
+            {
+            EStopped,
+            EPrimed,
+            EPlaying
+            };
+
+        // Data source method call flags
+        enum TCallFlags
+            {
+            // SetVideoFrameSizeL() was called
+            ESetSizeCalled = ( 1 << 0 ),
+
+            // SetFrameRateL() was called
+            ESetFrameRateCalled = ( 1 << 1 ),
+
+            // SetFormatL() was called
+            ESetFormatCalled = ( 1 << 2 )
+            };
+
+        // Data source state
+        TDataSourceState iDSState;
+
+        // Call flags
+        TUint32 iCallFlags;
+
+
+        // Provider switch AO pointer
+        CVSProviderSwitchAO* iProviderSwitchAO;
+
+        // Data source observer AO pointer
+        CVSDataSourceObserverAO* iDataSourceObserverAO; // owned
+
+        // Format heap descriptor pointer
+        HBufC8* iFormat; // owned
+
+        // Frame rate
+        TReal32 iFrameRate;
+
+        // Frame size
+        TSize iSize;
+
+        // SourceThreadLogon() called flag
+        TBool iThreadLogonCalled;
+
+        // Array to return in response to GetMultimediaTypesL call
+        // (supported video frame formats).
+        RArray<TDesC8*> iProtoMimeTypes;
+
+        // Video frame formats supported by all providers.
+        CDesC8Array* iSupportedVideoFormats;
+
+        // Video frame sizes for each format supported by all providers
+        class TVSFrameSize
+            {
+            public:
+                TPtrC8  iFormat;    // Primary key, 1st field
+                TSize   iSize;
+            };
+        RArray<TVSFrameSize> iSupportedVideoSizes;
+
+        // Video frame rates for each format and frame size supported by all
+        // providers.
+        class TVSFrameRate
+            {
+            public:
+                TPtrC8  iFormat;    // Primary key, 1st field
+                TSize   iSize;      // Primary key, 2nd field
+                TReal32 iRate;
+            };
+
+        RArray<TVSFrameRate> iSupportedFrameRates;
+
+    private:    // Data
+
+        // Needs to be friend
+        friend class CVSProviderSwitchAO;
+
+        // MIME type holder
+        TBuf8<128> iYuv420PlanarDesc;
+
+    private:    // Data
+
+        // Critical section for queue handling
+        RCriticalSection iQueueCs;
+
+        // Critical section for queue handling
+        RCriticalSection iPauseCs;
+
+        // Queue for buffers that are free for use
+        RPointerArray<CVSMMFDataBuffer> iFreeQueue;
+
+        // Queue for buffers that are being used by the Protocol
+        RPointerArray<CVSMMFDataBuffer> iActiveQueue;
+
+        // All buffers allocated by CreateSourceBufferL()
+        RPointerArray<CVSMMFDataBuffer> iAllocatedBuffers;
+
+        // Number of buffer requests by CreateSourceBufferL()
+        TInt iRequestedBufferCount;
+
+        // Set to ETrue when protocol is initializing (From
+        // SourceThreadLogon to SourcePlayL)
+        TBool iProtoInitOngoing;
+
+        // Set to ETrue if provider switch operation was suspended because
+        // protocol was initializing
+        TBool iProviderSwitchRequestDuringProtoInit;
+
+        // Temporary save pointer, not owned
+        CVSDataProvider* iNewProvider;
+
+        // Critical section for synchronizing access to
+        // iProviderSwitchRequestDuringProtoInit and iProtoInitOngoing
+        RCriticalSection iProtoInitCS;
+
+        // Set to ETrue during DoProviderSwitchL
+        TBool iSwitchOngoing;
+
+        // Set to ETrue when DoProviderSwitchL is needed
+        TBool iSwitchPending;
+
+        // Set to ETrue when video sending is paused to Protocol
+        // Guarded by: iPauseCs
+        TBool iSendingPaused;
+
+        // If true then FBS was started during SourceThreadLogon() and
+        // thus should be stopped in SourceThreadLogoff()
+        TBool iFbsStarted;
+    };
+
+#endif      // CVSDATASOURCEIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSMMFDataBuffer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,239 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSMMFDATABUFFER_H
+#define CVSMMFDATABUFFER_H
+
+//  INCLUDE FILES
+
+#include <mmfdatabuffer.h>
+
+// FORWARD DECLARATIONS
+
+class MFrameBuffer;
+class MCameraBuffer;
+
+/**
+*  API of data buffer that allows provider's buffer contents to
+*  be given to consumer without copying.
+*
+*  @lib videosource.lib
+*  @since 5.0
+*/
+class MVSMMFDataBuffer
+    {
+
+public:
+
+    /**
+    * Sets the ECAM frame buffer.
+    * @param "aFrameBuffer" MFrameBuffer pointer.
+    */
+    virtual void SetFrameBufferL( MFrameBuffer* aFrameBuffer ) = 0;
+
+	/**
+    * Sets the ECAM camera buffer.
+    * @param "aFrameBuffer" MFrameBuffer pointer.
+    */
+    virtual void SetFrameBufferL( MCameraBuffer* aCameraBuffer ) = 0;
+
+    /**
+    * Calls Release() for MFrameBuffer and sets aFrameBuffer to NULL.
+    */
+    virtual void ReleaseL() = 0;
+
+    /**
+    * Sets start offset and length of internal iPtr variable (when
+    * pointing to iData).
+    */
+    virtual void SetBufferOffset( TInt aOffset ) = 0;
+
+    /**
+    * Reallocates the max size in bytes.
+    * @param "aMaxBufferSize" New size in bytes.
+    * @exception Can leave with one of the system wide error codes.
+    */
+    virtual void ReAllocBufferL( TInt aMaxBufferSize ) = 0;
+
+    /**
+    * Checks whether buffer needs reset or not.
+    * @return ETrue if buffer needs reset, EFalse otherwise.
+    */
+    virtual TBool NeedsReset() const = 0;
+
+    /**
+    * Sets needs reset state.
+    * @param aNeedsReset New reset state.
+    */
+    virtual void SetNeedsReset( TBool aNeedsReset ) = 0;
+
+    /**
+    * Resets buffer (i.e. clears data).
+    */
+    virtual void Reset() = 0;
+
+    };
+
+/**
+*  Implementation of data buffer that allows provider's buffer contents to
+*  be given to consumer without copying.
+*
+*  @lib videosource.lib
+*/
+class CVSMMFDataBuffer : public CMMFDataBuffer, public MVSMMFDataBuffer
+    {
+    public: // new methods
+
+        /**
+        * Static factory function to create instance of this class.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        IMPORT_C static CVSMMFDataBuffer* NewL();
+
+        /**
+        * Static factory function to create instance of this class.
+        * @param "aMaxBufferSize" Buffer size
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        IMPORT_C static CVSMMFDataBuffer* NewL( TInt aMaxBufferSize );
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CVSMMFDataBuffer();
+
+    public: // from CMMFDataBuffer
+
+        /**
+        * @see CMMFDataBuffer::Data
+        */
+        virtual TDes8& Data();
+
+        /**
+        * @see CMMFDataBuffer::Data
+        */
+        virtual const TDesC8& Data() const;
+
+        /**
+        * @see CMMFDataBuffer::SetStatus
+        */
+        virtual void SetStatus( TBufferStatus aStatus );
+
+        /**
+        * @see CMMFDataBuffer::SetRequestSizeL
+        */
+        virtual void SetRequestSizeL( TInt aSize );
+
+        /**
+        * @see CMMFDataBuffer::BufferSize
+        */
+        virtual TUint BufferSize() const;
+
+        /**
+        * @see CMMFDataBuffer::SetPosition
+        */
+        virtual void SetPosition( TUint aPosition );
+
+    public: // from MVSMMFDataBuffer
+
+        /**
+        * @see MVSMMFDataBuffer::SetFrameBufferL
+        */
+        void SetFrameBufferL( MFrameBuffer* aFrameBuffer );
+
+        /**
+        * @see MVSMMFDataBuffer::SetFrameBufferL
+        */
+        void SetFrameBufferL( MCameraBuffer* aCameraBuffer );
+
+        /**
+        * @see MVSMMFDataBuffer::ReleaseL
+        */
+        void ReleaseL();
+
+        /**
+        * @see MVSMMFDataBuffer::SetBufferOffset
+        */
+        void SetBufferOffset( TInt aOffset );
+
+        /**
+        * @see MVSMMFDataBuffer::ReAllocBufferL
+        */
+        void ReAllocBufferL( TInt aMaxBufferSize );
+
+        /**
+        * @see MVSMMFDataBuffer::NeedsReset
+        */
+        TBool NeedsReset() const;
+
+        /**
+        * @see MVSMMFDataBuffer::SetNeedsReset
+        */
+        void SetNeedsReset( TBool aNeedsReset );
+
+        /**
+        * @see MVSMMFDataBuffer::Reset
+        */
+        void Reset();
+
+
+    private:    // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        CVSMMFDataBuffer();
+
+        /**
+        * 2nd phase constructor.
+        * @param "aMaxBufferSize" Buffer size in bytes.
+        */
+        void ConstructL( TInt aMaxBufferSize );
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Pointer to ECAM buffer
+        MFrameBuffer* iFrameBuffer;
+
+        // Pointer to ECAM buffer
+        MCameraBuffer* iCameraBuffer;
+
+        // Pointer to data buffer ( n/a for ECAM )
+        TUint8* iData;
+
+        // TPtr8 pointing to iData or ECAM buffer data content
+        TPtr8 iPtr;
+
+        // Max buffer size ( n/a for ECAM )
+        TInt iMaxBufferSize;
+
+        // ETrue if buffers needs reset, EFalse otherwise
+        TBool iNeedsReset;
+
+        // ETrue if buffer is set, EFalse otherwise
+        TBool iIsBufferSet;
+
+    };
+
+#endif // CVSMMFDATABUFFER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSOnboardCameraDataProvider.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,387 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSONBOARDCAMERADATAPROVIDER_H
+#define CVSONBOARDCAMERADATAPROVIDER_H
+
+// INCLUDE FILES
+
+#include "CVSCameraDataProvider.h"
+
+// CLASS DECLARATION
+
+/**
+*  Handles provider error notification using interface to provider callback
+*  functions. Provider errors can occur in two threads and this class provides
+*  error notification in the same thread context that the provider was created.
+*
+*  @lib videosource.lib
+*/
+class CProviderErrorNotifierAO : public CActive
+    {
+    public: // New functions
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // Constructors and destructor
+
+        /**
+        * Static factory function to create instance of this class.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        static CProviderErrorNotifierAO* NewL();
+
+        /**
+        * Destructor.
+        */
+        ~CProviderErrorNotifierAO();
+
+    private:    // New functions
+
+        /**
+        * Notify provider observer about error.
+        * @param "aObserver" Pointer to provider observer to notify.
+        * @param "aError" Error code.
+        */
+        void NotifyError( MVSDataProviderObserver* aObserver, TInt aError );
+
+    private:    // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        CProviderErrorNotifierAO();
+
+        /**
+        * 2nd phase constructor.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void ConstructL();
+
+    private: // Functions from base classes
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void DoCancel();
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void RunL();
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Pointer to provider observer that will receive the error
+        // notification.
+        MVSDataProviderObserver* iObserver;
+
+        // Error code.
+        TInt iError;
+
+        // Critical section to synchronize access to this object.
+        RCriticalSection iCS;
+
+        // Thread id of the thread in which this object was created.
+        TThreadId iThreadId;
+
+    private:    // Data
+
+        // This class is private to CVSDataProvider.
+        friend class CVSDataProvider;
+    };
+
+/**
+*  Makes onboard camera Reserve and PowerOn function calls synchronous.
+*
+*  @lib videosource.lib
+*/
+class CSyncCameraReserve : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Static factory function to create instance of this class.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        static CSyncCameraReserve* NewL();
+
+    public: // New functions
+
+        /**
+        * Starts waiting and returns when RunL is called.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void StartL();
+
+    private:    // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        CSyncCameraReserve();
+
+    private:    // Functions from base classes
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void DoCancel();
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void RunL();
+
+    private:    // Data
+
+        // Active scheduler loop owner. See CActiveSchedulerWait for
+        // description.
+        CActiveSchedulerWait iWait;
+    };
+
+/**
+*  Internal implementation of onboard camera data provider. This
+*  class is inherited from onboard camera data provider base class.
+*
+*  @lib videosource.lib
+*/
+class CVSOnboardCameraDataProvider : public CVSCameraDataProvider
+    {
+    public:        // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param "aObserver" Pointer to provider observer.
+        * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+        * data provider.
+        */
+        CVSOnboardCameraDataProvider(
+            MVSDataProviderObserver* aObserver,
+            MVSBufferPool* aPool );
+
+        /**
+        * Destructor.
+        */
+        ~CVSOnboardCameraDataProvider();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        void PrimeL();
+
+    private:    // Functions from base classes
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void FillBufferL(
+            CMMFBuffer* aBuffer,
+            MVTVideoSink* aConsumer,
+            TMediaId aMediaId );
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void BufferEmptiedL( CMMFBuffer* aBuffer );
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler );
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourceThreadLogoff();
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourcePrimeL();
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourcePlayL();
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourcePauseL();
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourceStopL();
+
+    private: // Functions from base classes
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void SetFormatL( const TDesC8& aFormat );
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void SetFrameRateL( TReal32 aFrameRate );
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void SetVideoFrameSizeL( const TSize& aSize );
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void GetVideoFrameSizeL( TSize& aSize ) const;
+
+    private: // from MCameraObserver
+
+        /**
+        * @see MCameraObserver::ReserveComplete
+        */
+        virtual void ReserveComplete( TInt aError );
+
+        /**
+        * @see MCameraObserver::FrameBufferReady
+        */
+        virtual void FrameBufferReady( MFrameBuffer* aFrameBuffer,
+            TInt aError );
+
+    private: // from MCameraObserver2
+
+        /**
+        * @see MCameraObserver2::HandleEvent
+        */
+       	virtual void HandleEvent(const TECAMEvent& aEvent);
+
+		/**
+        * @see MCameraObserver2::ViewFinderReady
+        */
+		virtual void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+		/**
+        * @see MCameraObserver2::VideoBufferReady
+        */
+		virtual void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+    private:    // Functions from base classes
+
+        /**
+        * Get video frame size.
+        */
+        virtual void GetVideoFrameSize(
+            TSize& aSize,
+            TInt aSizeIndex,
+            const TDesC8& aFormat );
+
+        /**
+        * Get video frame rate.
+        */
+        virtual void GetVideoFrameRate(
+            TReal32& aRate,
+            TInt aRateIndex,
+            const TDesC8& aFormat,
+            const TSize& aSize );
+
+        void FreezeFrame( MFrameBuffer* aFrameBuffer );
+
+        void FreezeFrame( MCameraBuffer* aCameraBuffer );
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Onboard camera dublicate for the second thread. Owned.
+        CCamera* iCameraDuplicate;
+
+        // MMF controller framwork mixin for event handling
+        MAsyncEventHandler* iEventHandler;
+
+        // Enumerated values for possible states this class can have.
+        enum TState
+            {
+            EStopped,
+            EPrimed,
+            EPlaying
+            };
+
+        // One of the enumerated states.
+        TState iState;
+
+        // ECAM frame rate index.
+        TInt iFrameRateIndex;
+
+        // ECAM frame size index.
+        TInt iFrameSizeIndex;
+
+        // Frame size.
+        TSize iFrameSize;
+
+        // ECAM Video frame format.
+        CCamera::TFormat iFormat;
+
+        // Pointer to AO that makes iCameraDuplicate.Reserve() and PowerOn()
+        // synchronous. Owned. These are called in SourcePrimeL and because
+        // it is synchronous, reserve & poweron must be too.
+        CSyncCameraReserve* iSyncReserve;
+
+        //
+        TBool iAsynchronousReserveIssued;
+
+        // Pointer to dublicated camera bitmap
+        CFbsBitmap* iDublicatedBitmap;
+
+        // Camera lost by force indicator
+        TBool iCameraLost;
+
+    private: // friends
+
+        // Stif test module must be set as friend to be able to call protected
+        // and private methods
+        friend class CstiffVideoSourceAPICases;
+
+    };
+
+#endif      // CVSONBOARDCAMERADATAPROVIDER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/CVSStillImageDataProvider.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,532 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+#ifndef CVSSTILLIMTAGEDATAPROVIDER_H
+#define CVSSTILLIMTAGEDATAPROVIDER_H
+
+// INCLUDE FILES
+
+#include <gdi.h>
+#include "CApiVideoSource.h"
+#include "cvtimagescaler.h"
+#include <ecamimageprocessing.h>
+
+#include "cactivewait.h"
+#include "mmultiframeprovider.h"
+
+// FORWARD DECLARATIONS
+
+class CImageDecoder;
+class CVSStillImageDataProvider;
+class CVSFrameRateTimer;
+class CVtImageBitmap;
+class CMultiframeProvider;
+
+
+// CLASS DECLARATION
+
+/**
+*  Internal implementation of still image data provider. This
+*  class is inherited from from public provider interface.
+*
+*  @lib videosource.lib
+*/
+class CVSStillImageDataProvider : public CVSDataProvider, MMultiframeprovider
+    {
+    public:        // Constructors and destructor
+
+        /**
+        * Static factory function create instance of this class.
+        * @param "aObserver" Pointer to provider observer.
+        * @param "aPool" Pointer to data MVSBufferPool that gives buffer to
+        * data provider.
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        static CVSStillImageDataProvider* NewL(
+            MVSDataProviderObserver* aObserver,
+            MVSBufferPool* aPool );
+
+        /**
+        * Destructor.
+        */
+        ~CVSStillImageDataProvider();
+
+    public:        // New functions
+
+    public:        // Functions from base classes
+
+        /**
+        * Initialize provider.
+        * @param "aInitParams" Reference to the initialization parameters.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void InitializeL( const TDesC8& aInitParams );
+
+        /**
+        * Cancel initialization of still image provider.
+        */
+        void CancelInitializing();
+
+        /**
+        * Return digital zoom factor.
+        * @return Digital zoom factor.
+        */
+        virtual TInt DigitalZoomFactor() const;
+
+        /**
+        * Set digital zoom factor.
+        * @param "aDigitalZoomFactor" Digital zoom factor.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void SetDigitalZoomFactorL( TInt aDigitalZoomFactor = 0 );
+
+        /**
+        * Start view finder bitmaps.
+        * @param "aSize" Size of the returned view finder bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderBitmapsL( TSize& aSize );
+
+        /**
+        * Start view finder bitmaps.
+        * @param "aSize" Size of the returned view finder bitmap.
+        * @param "aClipRect" Required clip rectangle.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderBitmapsL( TSize& aSize,TRect& aClipRect );
+
+        /**
+        * Stop view finder bitmaps.
+        */
+        virtual void StopViewFinder();
+
+        /**
+        * Test if view finder is active.
+        * @return ETrue if view finder active.
+        */
+        virtual TBool ViewFinderActive() const;
+
+        /**
+        * Start view finder bitmaps using direct screen access.
+        * @param "aWs" Window server session.
+        * @param "aScreenDevice" Screen device.
+        * @param "aWindow" Displayable window.
+        * @param "aScreenRect" Portion of the screen to which view finder data
+        * is to be transferred.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderDirectL(
+            RWsSession& aWs,
+            CWsScreenDevice& aScreenDevice,
+            RWindowBase& aWindow,
+            TRect& aScreenRect );
+
+        /**
+        * Start view finder bitmaps using direct screen access.
+        * @param "aWs" Window server session.
+        * @param "aScreenDevice" Screen device.
+        * @param "aWindow" Displayable window.
+        * @param "aScreenRect" Portion of the screen to which view finder data
+        * is to be transferred.
+        * @param "aClipRect" The rectangle to which the screen will be clipped.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        virtual void StartViewFinderDirectL(
+            RWsSession& aWs,
+            CWsScreenDevice& aScreenDevice,
+            RWindowBase& aWindow,
+            TRect& aScreenRect,
+            TRect& aClipRect );
+
+        /**
+        * Return provider information.
+        * @param @param "aInfo" Reference to variable to where the provider
+        * information is copied.
+        */
+        virtual void ProviderInfo( TVSDataProviderInfo& aInfo );
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual void SetViewFinderMirrorL( TBool aMirror );
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual TBool ViewFinderMirror() const;
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual void FreezeL();
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual void UnfreezeL();
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        virtual TBool IsFrozen() const;
+
+        /**
+        * @See CVSDataProvider::SetContrastL for description.
+        */
+		virtual void SetContrastL( TInt aContrast );
+
+        /**
+        * @See CVSDataProvider::GetContrast for description.
+        */
+		virtual TInt GetContrast( TInt& aContrast ) const;
+
+        /**
+        * @See CVSDataProvider::SetBrightnessL for description.
+        */
+		virtual void SetBrightnessL( TInt aBrightness );
+
+        /**
+        * @See CVSDataProvider::GetBrightness for description.
+        */
+		virtual TInt GetBrightness( TInt& aBrightness ) const;
+
+        /**
+        * @See CVSDataProvider::SetWhiteBalanceL for description.
+        */
+		virtual void SetWhiteBalanceL(
+			CCamera::TWhiteBalance aWhiteBalance = CCamera::EWBAuto);
+
+       	/**
+        * @See CVSDataProvider::GetWhiteBalance for description.
+        */
+		virtual TInt GetWhiteBalance(
+			CCamera::TWhiteBalance& aWhiteBalance ) const;
+
+       	/**
+        * @See CVSDataProvider::GetColorTone for description.
+        */
+        virtual TInt GetColorTone(
+        	CCamera::CCameraImageProcessing::TEffect& aColorTone) const;
+
+       	/**
+        * @See CVSDataProvider::SetColorToneL for description.
+        */
+        virtual void SetColorToneL(
+        	CCamera::CCameraImageProcessing::TEffect aValue );
+
+    protected:    // New functions
+
+    protected:    // Functions from base classes
+
+    private:    // New functions
+
+        /**
+        * See CVSDataProvider for description.
+        */
+        void PrimeL();
+
+    private:
+
+    private:    // Functions from base classes
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void FillBufferL(
+            CMMFBuffer* aBuffer,
+            MVTVideoSink* aConsumer,
+            TMediaId aMediaId );
+
+    private:
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void BufferEmptiedL( CMMFBuffer* aBuffer );
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler );
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourceThreadLogoff();
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourcePrimeL();
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourcePlayL();
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourcePauseL();
+
+        /**
+        * See MDataSource for description.
+        */
+        virtual void SourceStopL();
+
+    private: // Functions from base classes
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void SetFormatL( const TDesC8& aFormat );
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void SetFrameRateL( TReal32 aFrameRate );
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void SetVideoFrameSizeL( const TSize& aSize );
+
+        /**
+        * See MVTVideoInput for description.
+        */
+        virtual void GetVideoFrameSizeL( TSize& aSize ) const;
+
+    private:    // New functions
+
+        /**
+        * Common initialization of the provider (initializes features
+        * that are always needed by the provider).
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void CommonInitializeL();
+
+        /**
+        * Undo common initialization of still image data provider.
+        */
+        void UndoCommonInitialized();
+
+        /**
+        * Loads image that was set in General Settings application.
+        * @param aType Type of of the general settings image.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void GeneralSettingsInitializeL( const TGeneralSettingsImageType aType );
+
+        /**
+        * Initializes this instance as blank image instance.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void BlankImageInitializeL();
+
+        /**
+        * Initializes this instance from image file.
+        * @param aFileName Name of the file from which this intance will be
+        * initialized.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void FileImageInitializeL( const TFileName& aFileName );
+
+        /**
+        * View finder timer callback. This method is called when view finder
+        * needs updating.
+        */
+        void VFTimer();
+
+        /**
+        * protocol timer callback. This method is called when new frame
+        * will be sent to consumer.
+        */
+        void ProtoTimer();
+
+        /**
+        * Method for creating timer for protocol. This method is called
+        * in Proto thread context.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void CreateProtoTimerL();
+
+        /**
+        * Releases protocol timer. This method is called in Protocol thread
+        * context.
+        */
+        void ReleaseProtoTimer();
+
+        /**
+        * Creates YUV buffer from still image. This method is called in Protocol
+        * thread context.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void CreateYUVDataL();
+
+        /**
+        * Release YUV buffer. This method is called in Protocol thread context.
+        */
+        void ReleaseYUVData();
+
+    private:    // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param "aObserver" Pointer to provider observer.
+        */
+        CVSStillImageDataProvider(
+            MVSDataProviderObserver* aObserver,
+            MVSBufferPool* aPool );
+
+        /**
+        * 2nd phase constructor.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void ConstructL();
+
+    private:    // Functions from base classes
+
+        /**
+        * Get video frame size.
+        */
+        virtual void GetVideoFrameSize(
+            TSize& aSize,
+            TInt aSizeIndex,
+            const TDesC8& aFormat );
+
+        /**
+        * Get video frame rate.
+        */
+        virtual void GetVideoFrameRate(
+            TReal32& aRate,
+            TInt aRateIndex,
+            const TDesC8& aFormat,
+            const TSize& aSize );
+
+        /**
+        * Returns current screen display mode.
+        */
+        TDisplayMode DisplayMode() const;
+				
+    private:
+        
+        // from MMultiframeprovider
+        /**
+        * @See MMultiframeprovider for description.
+        */
+        virtual void InitializeReady();
+				
+        /**
+        * @See MMultiframeprovider for description.
+        */
+				virtual void RefreshYUVData( TImageShareDataBuffer& aYUVBitMap );
+				
+				/**
+        * @See MMultiframeprovider for description.
+        */
+				virtual void RefreshViewFinder( TImageShareDataBuffer& aVFBitMap );
+				
+				/**
+        * @See MMultiframeprovider for description.
+        */
+				virtual void NotifyImageHandlingError( TInt aError );
+
+    public: // Data
+
+    protected:  // Data
+				 RCriticalSection iFreezeCS;
+    private:    // Data
+
+        // Provider state
+        enum TProviderState
+            {
+            EPSUninitialized,   // Provider is uninitialized
+            EPSStopped,         // Provider is initialized and stopped
+            EPSPrimed,          // Provider is initialized and ready for playing
+            EPSPlaying,         // Provider is playing
+            EPSInitializing,    // Provider is initializing
+            EPSUndoInitializing // Provider is undoinitializing
+            };
+
+        // Provider state
+        TProviderState iPSState;
+
+        // View finder state
+        enum TViewFinderState
+            {
+            EVFStopped, // View finder is not started
+            EVFPlaying  // View finder started
+            };
+
+        // View finder state
+        TViewFinderState iVFState;
+
+        // Source bitmap's name
+        TFileName iBitmapFileName;
+
+        // Pointer to view finder timer instance
+        CVSFrameRateTimer* iVFTimer; // owned
+
+        // Pointer to protocol timer instance
+        CVSFrameRateTimer* iProtoTimer; // owned, created in Proto thread context!
+
+        // Target image for CVtImageScaler
+        CVtImageBitmap* iScaled;
+        CVtImageBitmap* iYUVBitMap;
+
+        // Pointer to selected view finder image
+        CVtImageBitmap* iVFCurrent;
+        CVtImageBitmap* iVFBitmap;
+
+        // Pointer to active waiter instance
+        CVSActiveWait< CVSStillImageDataProvider >* iActiveWait; // owned
+
+        // Heap descriptor pointer that contains image as YUV
+        HBufC8* iYUVBuffer; // owned, created in Protocol thread context!
+
+        // Frame counter
+        TUint32 iFrameCount;
+
+        // protocol timer update rate
+        TInt iProtoUpdateRate;
+
+        // Rescaling recuirement flag
+        TBool iVFRescalingRequired;
+
+        // FireServer session instance
+        RFs iFs;
+
+        // Current display mode
+        TDisplayMode iDisplayMode;
+        
+        // Viewer instance
+        CMultiframeProvider* iViewer; //owned
+        
+        // Traget VF size
+        TSize iTargetSize;
+                
+        //Record TVSStillImageDataProviderParams::iInitialize in InitializeL(),
+        //used in CancelInitializing call 
+        TVSStillImageDataProviderParams::TInitialize iInitType;
+        
+    };
+
+#endif      // CVSSTILLIMTAGEDATAPROVIDER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/VSPanic.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* 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:  Panic definitions for videosource module.
+*
+*/
+
+
+#ifndef VSPANIC_H
+#define VSPANIC_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+_LIT( KVSPanicCategory, "VideoSource" );
+
+// DATA TYPES
+enum TVSPanic
+    {
+    EVSPanicSwitchAlreadyPending,           // 0
+    EVSPanicProviderNotSet,                 // 1
+    EVSPanicProviderAlreadyInitialized,     // 2
+    EVSPanicProviderNotReady,               // 3
+    EVSPanicOperationNotSupported,          // 4
+    EVSPanicThreadOpenFailure               // 5
+    };
+
+// FUNCTION PROTOTYPES
+extern void Panic( TVSPanic aPanicCode );
+
+#endif // VSPANIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/VideoSourceUids.hrh	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  Uid definition file for Video Source subsystem
+*
+*/
+
+
+
+#ifndef __VIDEOSOURCEUIDS_HRH__
+#define __VIDEOSOURCEUIDS_HRH__
+
+#define KSharedLibraryUidDefine 0x1000008D
+#define KUidVideoSourceLibrary  0x101F8692
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cactivewait.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+
+#ifndef C_ACTIVEWAIT_H
+#define C_ACTIVEWAIT_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+/**
+*  Active waiter class for waiting any active request. When asynchronous
+*  request has been completed a given callback method will be called.
+*
+*  @lib videosource.lib
+*/
+template < class R > class CVSActiveWait: public CActive
+    {
+    private :
+    
+  			typedef void ( R::*TVSActiveWaitCallback) ( TInt );  		
+    
+    public : // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param "aRequester" ?description
+        */
+        inline CVSActiveWait( R* aRequester );
+
+        /**
+        * Destructor.
+        */
+        inline ~CVSActiveWait();
+
+        /**
+        * Initializes the waiter class.
+        * @param "aCallback" Pointer to callback method that will be called
+        * when asynchronous request has been completed.
+        */
+        inline void InitializeWaiter( TVSActiveWaitCallback aCallback );
+
+        /**
+        * Returns pointer to this active object's TRequestStatus member
+        * (iStatus).
+        * @return Pointer to this classes TRequestStatus member (iStatus).
+        */
+        inline TRequestStatus* RequestStatus();
+
+        /**
+        * Signals waiter with given error code.
+        * @param aError Integer error code.
+        */
+        inline void Signal( TInt aError );
+
+    private :    // Functions from base classes
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        inline void RunL();
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        inline void DoCancel();
+
+    private :    // Data
+
+        // Pointer to requester. Callback method call will be made in this
+        // context.
+        R* iRequester; // not owned
+
+        // Pointer to callback method.
+        TVSActiveWaitCallback iCallback;
+    };
+
+#include "cactivewait.inl"
+    
+#endif      // C_ACTIVEWAIT_H
+     
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cactivewait.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ CVSActiveWait ===============================
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::~CVSActiveWait()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+CVSActiveWait< R >::~CVSActiveWait()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() >>"), RThread().Id().operator TUint()));
+    Cancel();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::RequestStatus()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+TRequestStatus* CVSActiveWait< R >::RequestStatus()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() <<"), RThread().Id().operator TUint()));
+    return &iStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::Signal( TInt aError )
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::Signal( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() >>"), RThread().Id().operator TUint()));
+    if( IsActive() )
+        {
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, aError );
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::RunL()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::RunL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() >>"), RThread().Id().operator TUint()));
+    (iRequester->*iCallback)( iStatus.Int() );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::DoCancel()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::DoCancel()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() >>"), RThread().Id().operator TUint()));
+    if ( iStatus == KRequestPending )
+    	{
+    	TRequestStatus* pStatus = &iStatus;
+    	User::RequestComplete( pStatus, KErrCancel );
+    	}
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::CVSActiveWait( CAnimatedImageViewer* aRequester )
+// -----------------------------------------------------------------------------
+//
+template < class R >
+CVSActiveWait< R >::CVSActiveWait( R* aRequester )
+: CActive( EPriorityHigh ), iRequester( aRequester )
+    {
+    __IF_DEBUG(Print(_L("CVSActiveWait::CVSActiveWait() >>")));
+    CActiveScheduler::Add( this );
+    __IF_DEBUG(Print(_L("CVSActiveWait::CVSActiveWait() <<")));
+    }
+// -----------------------------------------------------------------------------
+// CVSActiveWait::InitializeWaiter( TVSActiveWaitCallback aCallback )
+// -----------------------------------------------------------------------------
+//
+template < class R >
+void CVSActiveWait< R >::InitializeWaiter( TVSActiveWaitCallback aCallback )
+    {
+     __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::InitializeWaiter() >>"), RThread().Id().operator TUint()));
+    if ( !IsActive() )
+    	{
+    	iStatus = KRequestPending;
+    	iCallback = aCallback;
+    	__IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::InitializeWaiter() SetActive"), RThread().Id().operator TUint()));
+    	SetActive();
+  		}
+      __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::InitializeWaiter() <<"), RThread().Id().operator TUint()));
+    }
+    
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/capivideosource.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,146 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+/*
+ * CVSController
+*/
+
+// -----------------------------------------------------------------------------
+// CVSController::Observer
+// -----------------------------------------------------------------------------
+//
+inline MVSControllerObserver& CVSController::Observer() const
+    {
+    return *iObserver;
+    }
+
+/*
+ * CVSDataProvider
+*/
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::Observer
+// -----------------------------------------------------------------------------
+//
+inline MVSDataProviderObserver& CVSDataProvider::Observer() const
+    {
+    return *iObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::BufferPool
+// -----------------------------------------------------------------------------
+//
+inline MVSBufferPool& CVSDataProvider::BufferPool() const
+    {
+    return *iPool;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::FillBufferActive
+// -----------------------------------------------------------------------------
+//
+inline TBool CVSDataProvider::FillBufferActive() const
+    {
+    return iFillBufferActive;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::Consumer
+// -----------------------------------------------------------------------------
+//
+inline MVTVideoSink* CVSDataProvider::Consumer() const
+    {
+    return iConsumer;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::MediaId
+// -----------------------------------------------------------------------------
+//
+inline TMediaId CVSDataProvider::MediaId() const
+    {
+    return iMediaId;
+    }
+
+/*
+ * CVSDataSource
+*/
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::Observer
+// -----------------------------------------------------------------------------
+//
+inline MVSDataSourceObserver& CVSDataSource::Observer() const
+    {
+    return *iObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::DataProvider
+// -----------------------------------------------------------------------------
+//
+inline CVSDataProvider& CVSDataSource::DataProvider() const
+    {
+    return *iProvider;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::SwitchProvider
+// -----------------------------------------------------------------------------
+//
+inline CVSDataProvider* CVSDataSource::SwitchProvider(
+    CVSDataProvider* aNewProvider )
+    {
+    CVSDataProvider* oldProvider = iProvider;
+    iProvider = aNewProvider;
+    return oldProvider;
+    }
+
+/*
+ * TVSStillImageDataProviderParams
+ */
+
+// -----------------------------------------------------------------------------
+// TVSStillImageDataProviderParams::TVSStillImageDataProviderParams
+// -----------------------------------------------------------------------------
+//
+TVSStillImageDataProviderParams::TVSStillImageDataProviderParams()
+    : iInitialize( EInitializeAsBlankImage ), iFileName( TPtrC() )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVSStillImageDataProviderParams::TVSStillImageDataProviderParams
+// -----------------------------------------------------------------------------
+//
+TVSStillImageDataProviderParams::TVSStillImageDataProviderParams(
+    const TInitialize aInitialize )
+    : iInitialize( aInitialize ), iFileName( TPtrC() )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVSStillImageDataProviderParams::TVSStillImageDataProviderParams
+// -----------------------------------------------------------------------------
+//
+TVSStillImageDataProviderParams::TVSStillImageDataProviderParams(
+    const TFileName& aFileName )
+    : iInitialize( EInitializeFromFile ), iFileName( aFileName )
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cmultiframedataao.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+#ifndef C_MULTIFRAMEDATAAO_H
+#define C_MULTIFRAMEDATAAO_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "mmultiframeprovider.h"
+// FORWARD DECLARATIONS
+class CMultiframeProvider;
+
+// MACROS
+	
+/**
+*  @lib videosource.lib
+*/
+// ============================ CMultiframeDataAO ===============================
+NONSHARABLE_CLASS( CMultiframeDataAO ) : public CTimer
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param "aRequester" instance to requester
+        */
+        CMultiframeDataAO( CMultiframeProvider* aRequester );
+
+        /**
+        * Destructor.
+        */
+        ~CMultiframeDataAO();
+
+    public: // New functions
+				
+				/**
+        * Sets observer.
+        * @param "aObserever" instance to observer
+        */
+				void SetObserver( MMultiframeprovider* aObserver );
+					
+        /**
+        * Activates CTimer
+        * @param "aUpdateTime" expiration time
+        */
+        void Activate( TTimeIntervalMicroSeconds aUpdateTime, TBool aInit, TBool aVFUpdate );
+        
+       	/**
+        * Updates local buffer.
+        * @param "aLocalBuffer" local buffer
+        */
+        void LocalBuffer( CVtImageBitmap* aLocalBuffer );
+        
+        /**
+        * Updates remote buffer.
+        * @param "aRemoteBuffer" remote buffer
+        */
+        void RemoteBuffer ( CVtImageBitmap* aRemoteBuffer );
+        
+        /**
+        * Cancels looping and completes request in correct thread.
+        */        
+        void CancelTimeLoop();
+
+    private:    // Functions from base classes
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void RunL();
+
+    private:    // Data
+
+        // Pointer to observer.
+        MMultiframeprovider* iObserver; // not owned
+        
+        // Pointer to requester
+        CMultiframeProvider* iRequester;
+        
+        // For updating ViewFinder buffer
+        TImageShareDataBuffer iLocalBuffer;
+        // For updating remote buffer
+        TImageShareDataBuffer iRemoteBuffer;
+        
+        // For updating remote buffer if activated when active
+        TImageShareDataBuffer iRemoteSecondBuffer;
+        
+        // For updating ViewFinder buffer if activated when active
+        TImageShareDataBuffer iLocalSecondBuffer;
+        
+        // Initialization flag
+        TBool iInit;
+        
+        // Delta calc ref point
+       	TTimeIntervalMicroSeconds iTime;
+        
+        // VF update flag
+        TBool iVFUpdate;
+        
+        // Id of thread whose active scheduler this instance is added into.
+        TThreadId iThreadId;
+        
+        // A flag to indecate loop ao must be stopped
+        TBool iRequireStopping;
+    };
+
+#endif //C_MULTIFRAMEDATAAO_H
+
+//  End of File
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cmultiframeloopao.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+
+#ifndef C_MULTIFRAMELOOPAO_H
+#define C_MULTIFRAMELOOPAO_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CMultiframeProvider;
+
+// MACROS
+
+/**
+* @lib videosource.lib
+* Handles data looping in multi frame sharing case.
+*/
+NONSHARABLE_CLASS( CMultiframeloopAO ) : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param "aRequester" instance to requester
+        */
+        CMultiframeloopAO( CMultiframeProvider* aRequester );
+
+        /**
+        * Destructor.
+        */
+        ~CMultiframeloopAO();
+        
+        /**
+        * Decreases number of free bitmaps
+        * @param "aCount" count how many bitmaps to be removed
+        */
+        void RemoveFreeBitmaps( TInt aCount );
+        
+        /**
+        * Increases number of free bitmaps
+        * @param "aCount" count how many bitmaps to be increased
+        */
+        void SetFreeBitmaps( TInt aCount );
+        
+        /**
+        * Cancels looping and completes request in correct thread.
+        */
+        void CancelDataLoop();
+
+    public: // New functions
+
+        /**
+        * Activates looping and completes request in correct thread. 
+        */
+        void Signal( );
+        
+       	/**
+        * Sets frame count.
+        * @param "aCount" frame count
+        */
+        void SetFrameCount( TInt aCount );
+
+    private:    // Functions from base classes
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void RunL();
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void DoCancel();
+
+    private:    // Data
+
+        // Pointer to requester.
+        CMultiframeProvider* iRequester; // not owned
+        
+        // Index of frame to be handled
+        TInt iIndex;
+        
+        // Total nuber of frames
+        TInt iFramecount;
+        
+        // Number of free bitmaps 
+        TInt iFreeBMCount;
+        
+        // Id of thread whose active scheduler this instance is added into.
+        TThreadId iThreadId;
+        
+        // A flag to indecate loop ao must be stopped
+        TBool iRequireStopping;
+    };
+#endif //C_MULTIFRAMELOOPAO_H
+
+// End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/cmultiframeprovider.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,395 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+
+#ifndef C_MULTIFRAMEPROVIDER_H
+#define C_MULTIFRAMEPROVIDER_H
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <gdi.h>
+#include "cactivewait.h"
+#include "cvtimagescaler.h"
+#include "mmultiframeprovider.h"
+
+// FORWARD DECLARATIONS
+
+class CVtImageBitmap;
+class CImageDecoder;
+class CMultiframeloopAO;
+class TScalingMediator;
+class CMultiframeProvider;
+class CMultiframeDataAO;
+
+const TInt KFirstFrameIndx = 0;
+
+// CLASS DECLARATION
+// ============================ TScalingMediator ===============================
+/**
+*  Internal implementation of still scaling mediator 
+*  @lib videosource.lib
+*/
+
+NONSHARABLE_CLASS( TScalingMediator) : public MVtImageScalerObserver
+	{
+	public :
+			TScalingMediator();
+	public :
+			/**
+      * @see MVtImageScalerObserver::ScalingFinished( TInt aError )
+      */
+			void ScalingFinished( TInt aError );
+					
+			/**
+			* Sets waiter observer
+			*/
+			void SetWaiter( CVSActiveWait< CMultiframeProvider >* aWait );
+	private :
+			CVSActiveWait< CMultiframeProvider >* iWait;		
+	};
+
+
+// ============================ CMultiframeProvider ===============================
+/**
+*  Internal implementation of multiframe provider
+*  @lib videosource.lib
+*/
+NONSHARABLE_CLASS( CMultiframeProvider ) : public CBase
+    {
+
+    public :        // Constructors and destructor
+
+        /**
+        * Static factory function create instance of this class.
+        * @param "aObserver" Pointer to data provider observer.
+        * @param  aDisplayMode current display mode
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        static CMultiframeProvider* NewL( MMultiframeprovider* aObserver, TDisplayMode aDisplayMode );
+
+        /**
+        * Destructor.
+        */
+        ~CMultiframeProvider();
+        
+
+    public :        // Functions from base classes
+    		
+    		/**
+        * Initializes this instance from image or multiframe file.
+        * @param aFileName Name of the file from which this intance will be
+        * initialized.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void InitializeL( const TFileName* aFileName );
+    		
+        /**
+        * Cancel initialization of multiframe provider.
+        * @return ETrue if don't need to wait a error message.
+        */
+        TBool CancelInitializing();
+        
+    		/**
+        * Initializes this instance for blank image bitmap.
+        */
+    		void IniatializeBlankL();
+    		
+    		/**
+        * Initializes this instance for Generalsettings image bitmap.
+        */
+    		void IniatializeGSL( const TGeneralSettingsImageType aType );	
+    		/**
+        * Sets ViewFinder size
+        * @param aSize size of target bitmap (view finder)
+        */
+    		void SetVFScalingTargetSize( TSize aSize );
+		
+				/**
+        * Decodes and scales initialized image or multiframe file
+        * @param aFrameindex	index of frame to be decoded and scaled
+        */
+				void ConvertAndScaleL( TInt aFrameIndex );
+				
+				/**
+        * Scales and copies decoded frame for view finder display
+        * @param aSize size of target bitmap ( view fiender )
+        */
+				void ScaleCopy( TSize& aSize, TBool aVFUpdate = EFalse  );
+				
+				/**
+        * Signals looping AO to proceed to next frame
+        */
+				void NextFrame();
+				
+				/**
+        * Clears ViewFinder size
+        */
+				void ClearVFScalingTargetSize();
+				
+				/**
+        * Increases number of data consumers by one
+        */
+				void IncreaseDataConsumer();
+				
+				/**
+        * Decreases number of data consumers by one
+        * and if number is less than one it cancels data looping
+        * mechanism
+        */
+				void DecreaseDataConsumer();
+				
+				/**
+        * Adds used bitmap to free queue
+        */
+				void AddBitmapToFreeQueue();
+				
+				/**
+        * Indicates that second VF buffer needs to be used
+        */
+				void UseSecondVfBuffer();
+				
+				/**
+        * Indicates that VF has been stopped
+        */
+                TBool IsVFStopped();
+
+        /**
+         * Set ViewFinder of Multiframe provider to stop
+         */
+                void SetVFStop();
+
+        /**
+        * Wait for converting function exit 
+        */
+                void WaitForConverting();
+
+        /**
+        * Release converting flag 
+        */
+                void ReleaseForConverting();
+
+		private :    // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param "aObserver" Pointer to data provider observer.
+        * @param aDisplayMode current display mode
+        */
+        CMultiframeProvider( MMultiframeprovider* aObserver, TDisplayMode aDisplayMode  );
+
+        /**
+        * 2nd phase constructor.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void ConstructL();
+        
+        /**
+        * Image conversion finished callback. This method is called when image
+        * conversion is done.
+        * @param "aError" Error code. KErrNone if no error happened, one of the
+        * system wide error codes.
+        * otherwise.
+        */
+        void ConversionFinished( TInt aError );
+
+        /**
+        * Image scaling finished callback. This method is called when image
+        * scaling is done.
+        * @param "aError" Error code. KErrNone if no error happened, one of
+        * the system wide error codes.
+        */
+        void BMSScalingFinished( TInt aError );
+        
+        /**
+        * Scales VF to new size.
+        * @param "aSize" New VF size.
+        * the system wide error codes.
+        */
+        void ScaleVF( const TSize& aSize );
+
+        /**
+        * When view finder frame must be rescaled (wanted view finder size is
+        * neither QCIF nor QQQCIF) this callback will be called when the
+        * rescaling has finished.
+        * @param "aError" Error code. KErrNone if no error happened, one of
+        * the system wide error codes.
+        */
+        void VFRescalingFinished( TInt aError );
+
+        /**
+        * When view finder frames are rescaled this callback method will be
+        * called.
+        * @param "aError" Error code. KErrNone if no error happened, one of
+        * the system wide error codes.
+        */
+        void VFScalingReady();
+        
+        /**
+        * Creates blank bitmap with given size, color mode and color.
+        * @param "aBitmap" Bitmap pointer reference into which pointer to new
+        * isntance will be copied.
+        * @param "aSize" Size of the blank bitmap to be created.
+        * @param "aMode" Color mode for created bitmap.
+        * @param "aColor" Color of created bitmap.
+        * @exception Can leave with one of the system wide error codes.
+        */
+        void CreateBlankBitmapL( CFbsBitmap*& aBitmap, const TSize& aSize, const TDisplayMode& aMode, const TRgb& aColor );
+        
+    public : // Data
+    
+    		TBool iAnimation;
+    		
+    		TBool iConvertAndScale;    
+		
+		protected:  // Data
+				 
+				RCriticalSection iFreezeCS;
+		
+		private : //Data
+		
+        						
+        // Source image for CVtImageScaler
+        CVtImageBitmap* iConverted;
+        
+        // Target image for CVtImageScaler
+        CVtImageBitmap* iScaled;
+				CVtImageBitmap* iBuffer1;
+				CVtImageBitmap* iBuffer2;
+				
+				// Pointer to remote image
+				CVtImageBitmap* iYUVBitMap;
+        
+        // Pointer to QCIF sized view finder image
+        CVtImageBitmap* iVFbitmap;
+        CVtImageBitmap* iFirstVfBuf;
+        CVtImageBitmap* iSecondVfBuf;
+        
+        // Boolean values of VF buffer validation
+        TBool iSecondVFBuffer;
+        TBool iFirstVFBuffer;
+        
+        // Pointer to bitmap loaded from GS
+        CVtImageBitmap* iGSBitmap;
+
+        // Pointer to selected view finder image
+        CVtImageBitmap* iVFCurrent;
+        
+        // Viewer AO instance
+        CMultiframeloopAO* iLoopAo;// owned
+
+        // Initalisation scaling mediator
+        TScalingMediator iInitMediator;
+
+        // ViewFinder scaling scaling mediator
+        TScalingMediator iScalingMediator;
+
+        // Waiter instance for initialisation
+        CVSActiveWait< CMultiframeProvider >* iActiveWaitInit;// owned
+
+        // Waiter instance for scaling
+        CVSActiveWait< CMultiframeProvider >* iActiveWaitScale;// owned
+
+        // Waiter instance for scaling
+        CVSActiveWait< CMultiframeProvider >* iActiveWaitInitScale; // owned
+
+        // VT image scaler instance for initialisation
+        CVtImageScaler*  iVtImageScalerInit; // owned
+
+        // VT image scaler instance for scaling
+        CVtImageScaler*  iVtImageScalerScale; // owned
+
+        // Image decoder instance
+        CImageDecoder* iImageDecoder; // owned
+
+        // Wanted view finder size
+        TSize iWantedVFSize;
+        
+        // FireServer session instance
+        RFs iFs;
+        
+        // Current display mode
+        TDisplayMode iDisplayMode;
+        
+        // Rescaling recuirement flag
+        TBool iVFRescalingRequired;
+        
+        // Multiframe observer instance
+        MMultiframeprovider* iObserver;
+        
+        // VF bitmap size
+        TSize iTargetSize;
+        
+        // Is blank image share
+        TBool iBlank;
+        
+        // Is GS image share
+        TBool iGSImage;
+        
+        // Is second bitmap in use
+        TBool iOldBM;
+        
+        // Pointer to old bitmap
+        CVtImageBitmap* iOldBitmap;
+        
+        // Frame count
+      	TInt iCount;
+      	
+      	// Is initialization ongoing flag
+      	TBool iInitialization;
+      	
+      	// Frame delay
+      	TTimeIntervalMicroSeconds iDelay;
+      	
+      	// Start time for image conversion
+      	TTime iStartTime;
+      	
+      	// Data timer expiration / Frame update time
+      	TTimeIntervalMicroSeconds iFrameUpdateTime;
+      	
+      	// Pointer to data timer AO
+      	CMultiframeDataAO* iDataTimer;
+      	
+      	// Number of data consumers
+      	TInt iNumOfConsumers;
+      	
+      	// Queue for bitmaps that are free for use
+        RPointerArray<CVtImageBitmap> iFreeQueue;
+        
+        // Pointer to bitmap mask
+        CFbsBitmap* iMask;
+        
+        // Pointer to temporary bitmap
+        CVtImageBitmap* iTempBM;
+        
+        TSize iVFSize;
+        
+        // Boolean value of VF buffer update
+        TBool iVFUpdate; 
+        
+        // file handle to default VT image
+        RFile iDefaultImageFile;
+        // Boolean value of VF buffer stopping
+        TBool iIsVfStopped;
+        
+        // Boolean value of VF buffer stopping
+        TBool iWaitForConverting;
+      };
+				
+#endif      // C_MULTIFRAMEPROVIDER_H
+
+// End of File   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/inc/mmultiframeprovider.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+
+#ifndef M_MULTIFRAMEPROVIDER_H
+#define M_MULTIFRAMEPROVIDER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CVtImageBitmap;
+
+// ============================ TImageShareDataBuffer ===============================
+/**
+*	Share buffer class
+* @lib videosource.lib
+*/
+NONSHARABLE_CLASS( TImageShareDataBuffer)
+	{
+	public :
+			CVtImageBitmap* iBitmap;
+			TBool iIsBitmapFree;		
+	};
+
+ // General Settings image type
+ enum TGeneralSettingsImageType
+ 			{
+      EGSStillImage,
+      EGSDefaultStillImage
+      };
+
+// ============================ MMultiframeprovider ===============================
+/**
+*	Multiframe observer API
+* Interface for receiving data and acknowledgements from multiframe provider.
+* @lib videosource.lib
+*/
+class MMultiframeprovider
+	{
+	public:
+	/**
+  * Indicates when initialization of multiframeprovider has finished
+  */
+	virtual void InitializeReady() = 0;
+	
+	/**
+  * Refresh YUV data
+  * @param "aYUVBitMap" reference new YUV data.
+  */
+	virtual void RefreshYUVData( TImageShareDataBuffer& aYUVBitMap ) = 0;
+	
+	/**
+  * Refresh VF data
+  * @param "aVFBitMap" reference new VF data.
+  */
+	virtual void RefreshViewFinder( TImageShareDataBuffer& aVFBitMap ) = 0;
+	
+	/**
+  * Notifies if error occures in multiframeprovider
+  * @param "aError" symbian wide error code.
+  */
+	virtual void NotifyImageHandlingError( TInt aError ) = 0;
+		
+	};
+#endif //M_MULTIFRAMEPROVIDER_H
+
+// End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/rom/VideoSource.iby	Mon Nov 23 14:47:47 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: 
+*       IBY file for VideoSource
+*
+*
+*/
+
+
+#ifndef __VIDEOSOURCE_IBY__
+#define __VIDEOSOURCE_IBY__
+
+#ifdef __CS_VIDEO_TELEPHONY
+
+file=ABI_DIR\BUILD_DIR\VideoSource.dll			SHARED_LIB_DIR\VideoSource.dll
+
+// Enabler for eclipsing ROM binary
+data=ZSYSTEM\install\videosource_stub.sis       system\install\videosource_stub.sis
+
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSCameraDataProvider.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,864 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <fbs.h>
+
+#include "CVSCameraDataProvider.h"
+#include "CVSOnboardCameraDataProvider.h"
+#include "VSPanic.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+static const TInt KQcifWidth = 176;
+static const TInt KQcifHeight = 144;
+static const TReal32 KFrameRate = 15.0;
+static const TInt KFrozenFrameBufferSize = ( KQcifWidth * KQcifHeight ) + ( KQcifWidth * KQcifHeight ) / 2;
+static const TInt KCCameraPriority = 80;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================= CVsFrameBuffer ================================
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::NewL( TInt aSize )
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVsFrameBuffer* CVsFrameBuffer::NewL( TInt aSize )
+    {
+    CVsFrameBuffer* self = new ( ELeave ) CVsFrameBuffer();
+    CleanupStack::PushL( self );
+    self->ConstructL( aSize );
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::~CVsFrameBuffer()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVsFrameBuffer::~CVsFrameBuffer()
+    {
+    delete iBuffer;
+    }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CopyProperties( MFrameBuffer* aSource )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::CopyProperties( MFrameBuffer* aSource )
+    {
+    MFrameBuffer::iIndexOfFirstFrameInBuffer = aSource->iIndexOfFirstFrameInBuffer;
+    MFrameBuffer::iElapsedTime = aSource->iElapsedTime;
+    }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CopyProperties( MCameraBuffer* aSource )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::CopyProperties( MCameraBuffer* aSource )
+    {
+    MCameraBuffer::iIndexOfFirstFrameInBuffer = aSource->iIndexOfFirstFrameInBuffer;
+    MCameraBuffer::iElapsedTime = aSource->iElapsedTime;
+    }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CopyFrameL( MFrameBuffer* aSource )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::CopyFrameL( MFrameBuffer* aSource )
+    {
+    iPtr = *( aSource->DataL( 0 ) );
+    CopyProperties( aSource );
+    }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CopyFrameL( MCameraBuffer* aSource )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::CopyFrameL( MCameraBuffer* aSource )
+	{
+	iPtr = *( aSource->DataL( 0 ) );
+    CopyProperties( aSource );
+	}
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::DataL( TInt aIndex )
+// -----------------------------------------------------------------------------
+//
+TDesC8* CVsFrameBuffer::DataL( TInt aIndex )
+    {
+    if( aIndex != 0 )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    return &iPtr;
+    }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::FrameL( TInt aIndex )
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap* CVsFrameBuffer::FrameL( TInt aIndex )
+    {
+    ( void ) aIndex;
+    User::Leave( KErrNotSupported );
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::Release()
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::Release()
+    {
+    // Nothing to do
+    }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::FrameSize()
+// -----------------------------------------------------------------------------
+//
+TInt CVsFrameBuffer::FrameSize( TInt /*aFrameIndex*/ )
+    {
+    return KErrNotSupported;
+    }
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::ChunkOffsetL()
+// -----------------------------------------------------------------------------
+//
+TInt CVsFrameBuffer::ChunkOffsetL( TInt /*aFrameIndex*/ )
+    {
+    User::Leave( KErrNotSupported );
+    return KErrNotSupported;
+    }
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::ChunkL()
+// -----------------------------------------------------------------------------
+//
+RChunk& CVsFrameBuffer::ChunkL()
+	{
+	User::Leave( KErrNotSupported );
+	RChunk* help = NULL;
+	return *help;
+	}
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::BitmapL()
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap& CVsFrameBuffer::BitmapL(TInt /*aFrameIndex*/ )
+	{
+	CFbsBitmap* helpbit = new (ELeave) CFbsBitmap;
+	CleanupStack::PushL( helpbit );
+	User::Leave( KErrNotSupported );
+	CleanupStack::Pop( helpbit );
+	delete helpbit;
+	return *helpbit;
+	}
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::NumFrames()
+// -----------------------------------------------------------------------------
+//
+TInt CVsFrameBuffer::NumFrames()
+	{
+	return KErrNotSupported;
+	}
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::CVsFrameBuffer()
+// -----------------------------------------------------------------------------
+//
+CVsFrameBuffer::CVsFrameBuffer()
+: iPtr( 0, 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVsFrameBuffer::ConstructL( TInt aSize )
+// -----------------------------------------------------------------------------
+//
+void CVsFrameBuffer::ConstructL( TInt aSize )
+    {
+    iBuffer = HBufC8::NewL( aSize );
+    iPtr.Set( iBuffer->Des() );
+    }
+
+// ========================= CVSCameraDataProvider =============================
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::NewL
+// -----------------------------------------------------------------------------
+//
+CVSCameraDataProvider* CVSCameraDataProvider::NewL(
+    MVSDataProviderObserver* aObserver,
+    TInt aProviderIndex,
+    MVSBufferPool* aPool )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::NewL() >>"), RThread().Id().operator TUint()));
+    CVSCameraDataProvider* self =
+        new (ELeave) CVSOnboardCameraDataProvider( aObserver, aPool );
+    CleanupStack::PushL( self );
+    self->ConstructL( aProviderIndex );
+    CleanupStack::Pop( self );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::NewL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::~CVSCameraDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSCameraDataProvider::~CVSCameraDataProvider()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::~CVSCameraDataProvider() >>"), RThread().Id().operator TUint()));
+    delete iFrozenFrame;
+    delete iFrozenVFFrameCopy;
+    delete iSource;
+    delete iFrozenVFFrameToBeSent;
+    delete iTarget;
+    delete iScaler;
+    delete iCamImgProc;
+    if ( &Camera() != NULL )
+        {
+        Camera().Release();
+        }
+    delete iCamera;
+    iFreezeCS.Close();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::~CVSCameraDataProvider() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::InitializeL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::InitializeL( const TDesC8& /*aInitParams*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::InitializeL() >>"), RThread().Id().operator TUint()));
+    Camera().Reserve();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::InitializeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::DigitalZoomFactor
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::DigitalZoomFactor() const
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::DigitalZoomFactor() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::DigitalZoomFactor() <<"), RThread().Id().operator TUint()));
+    return Camera().DigitalZoomFactor();
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetDigitalZoomFactorL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetDigitalZoomFactorL( TInt aDigitalZoomFactor)
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetDigitalZoomFactorL() >>"), RThread().Id().operator TUint()));
+    Camera().SetDigitalZoomFactorL( aDigitalZoomFactor );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetDigitalZoomFactorL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StartViewFinderBitmapsL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StartViewFinderBitmapsL( TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderBitmapsL() >>"), RThread().Id().operator TUint()));
+    TCameraInfo info;
+    Camera().CameraInfo( info );
+    if ( !(info.iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    if( IsFrozen()&& iHasFrozenVFFrameCopyCreated )
+        {
+        ScaleFrozenBitmapL( aSize );
+        }
+    Camera().StartViewFinderBitmapsL( aSize );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderBitmapsL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StartViewFinderBitmapsL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StartViewFinderBitmapsL( TSize&, TRect& )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderBitmapsL() >>"), RThread().Id().operator TUint()));
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StopViewFinder
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StopViewFinder()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StopViewFinder() >>"), RThread().Id().operator TUint()));
+    Camera().StopViewFinder();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StopViewFinder() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ViewFinderActive
+// -----------------------------------------------------------------------------
+//
+TBool CVSCameraDataProvider::ViewFinderActive() const
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ViewFinderActive() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ViewFinderActive() <<"), RThread().Id().operator TUint()));
+    return Camera().ViewFinderActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StartViewFinderDirectL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StartViewFinderDirectL( RWsSession&,
+    CWsScreenDevice&, RWindowBase&, TRect& )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderDirectL() >>"), RThread().Id().operator TUint()));
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::StartViewFinderDirectL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::StartViewFinderDirectL( RWsSession&,
+    CWsScreenDevice&, RWindowBase&, TRect&, TRect& )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::StartViewFinderDirectL() >>"), RThread().Id().operator TUint()));
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ProviderInfo
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ProviderInfo( TVSDataProviderInfo& aInfo )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfo() >>"), RThread().Id().operator TUint()));
+    Camera().CameraInfo( static_cast< TCameraInfo& >( aInfo ) );
+    aInfo.iFreezeSupported = ETrue;
+    TRAP_IGNORE( ProviderInfoExL( aInfo ) );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfo() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetViewFinderMirrorL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetViewFinderMirrorL( TBool aMirror )
+    {
+    Camera().SetViewFinderMirrorL( aMirror );
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ViewFinderMirror
+// -----------------------------------------------------------------------------
+//
+TBool CVSCameraDataProvider::ViewFinderMirror() const
+    {
+    return Camera().ViewFinderMirror();
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::FreezeL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::FreezeL()
+    {
+    iFreezeCS.Wait();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::FreezeL() >>"), RThread().Id().operator TUint()));
+    if( !IsFrozen() )
+        {
+        iFrozen = ETrue;
+        iFrozenVfFrameReady = EFalse;
+        iFreezePendingFlags = EViewFinderFreezePending | EVideoFrameFreezePending;
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::FreezeL() <<"), RThread().Id().operator TUint()));
+    iFreezeCS.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::UnfreezeL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::UnfreezeL()
+    {
+    iFreezeCS.Wait();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::UnfreezeL() >>"), RThread().Id().operator TUint()));
+    if( IsFrozen() )
+        {
+        iFrozen = EFalse;
+        iFreezePendingFlags = 0;
+        iHasFrozenVFFrameCopyCreated = EFalse;
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::UnfreezeL() <<"), RThread().Id().operator TUint()));
+    iFreezeCS.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::IsFrozen
+// -----------------------------------------------------------------------------
+//
+TBool CVSCameraDataProvider::IsFrozen() const
+    {
+    return iFrozen;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ImageReady
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ImageReady(
+    CFbsBitmap* /*aBitmap*/, HBufC8* /*aData*/, TInt /*aError*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ImageReady() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ImageReady() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::PowerOnComplete
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::PowerOnComplete( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::PowerOnComplete() >>"), RThread().Id().operator TUint()));
+    if ( !iPowerOnComplete )
+        {
+        if ( aError == KErrNone )
+            {
+            iPowerOnComplete = ETrue;
+            iCameraHandle = Camera().Handle();
+            // Setup ECAM so that the returned image is ok even if view finder
+            // is asked before video
+            TCameraInfo info;
+            Camera().CameraInfo( info );
+            if ( !(info.iOptionsSupported &
+                TCameraInfo::EViewFinderBitmapsSupported) )
+                {
+                NotifyError( KErrNotSupported );
+                return; // End debug print is missed
+                }
+            TInt sizeIndex, rateIndex;
+            sizeIndex = rateIndex = 0;
+            for (
+                sizeIndex = 0;
+                sizeIndex < info.iNumVideoFrameSizesSupported;
+                sizeIndex++ )
+                {
+                TSize size;
+                Camera().EnumerateVideoFrameSizes(
+                    size,
+                    sizeIndex,
+                    CCamera::EFormatYUV420Planar );
+                if ( size == TSize( KQcifWidth, KQcifHeight ) )
+                    {
+                    TReal32 rate;
+                    for (
+                        rateIndex = 0;
+                        rateIndex < info.iNumVideoFrameRatesSupported;
+                        rateIndex++ )
+                        {
+                        Camera().EnumerateVideoFrameRates(
+                            rate,
+                            rateIndex,
+                            CCamera::EFormatYUV420Planar,
+                            sizeIndex );
+                        if ( KFrameRate == rate )
+                            {
+                            TRAPD(
+                                err,
+                                Camera().PrepareVideoCaptureL(
+                                    CCamera::EFormatYUV420Planar,
+                                    sizeIndex,
+                                    rateIndex,
+                                    2,
+                                    1) );
+                            if ( err != KErrNone )
+                                {
+                                NotifyError( err );
+                                return; // End debug print is missed
+                                }
+                            break;
+                            }
+                        }
+                    break;
+                    }
+                }
+            Observer().vsProviderReady();
+            }
+        else
+            {
+            NotifyError( aError );
+            }
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::PowerOnComplete() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ViewFinderFrameReady
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ViewFinderFrameReady( CFbsBitmap& aFrame )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ViewFinderFrameReady() >>"), RThread().Id().operator TUint()));
+    if( iFreezePendingFlags & EViewFinderFreezePending )
+        {
+        FreezeViewFinderFrame( aFrame );
+        }
+    if( IsFrozen() && !( iFreezePendingFlags & EViewFinderFreezePending ) && iFrozenVfFrameReady )
+        {
+        Observer().vsViewFinderFrameReady( *iFrozenVFFrameToBeSent );
+        }
+    else if( !IsFrozen() )
+        {
+        Observer().vsViewFinderFrameReady( aFrame );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ViewFinderFrameReady() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ImageBufferReady
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ImageBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt /*aError*/)
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ImageBufferReady() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ImageBufferReady() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ScalingFinished
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ScalingFinished( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ScalingFinished() >>"), RThread().Id().operator TUint()));
+    if( aError == KErrNone )
+        {
+        iFrozenVfFrameReady = ETrue;
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ScalingFinished() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::CVSCameraDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSCameraDataProvider::CVSCameraDataProvider(
+    MVSDataProviderObserver* aObserver,
+    MVSBufferPool* aPool ) :
+        CVSDataProvider( aObserver, aPool )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ConstructL( TInt aProviderIndex )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ConstructL() >>"), RThread().Id().operator TUint()));
+    CVSDataProvider::ConstructL();
+    // New CCamera API imp
+    // Check which API is suported
+    TRAPD( error, iCamera =
+        CCamera::New2L( *this, aProviderIndex, KCCameraPriority ) );
+    // try to create using API
+    if ( error )
+    	{
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ConstructL() New2L failed, using NewL instead"), RThread().Id().operator TUint()));
+    	iCamera = CCamera::NewL( *this, aProviderIndex );
+    	}
+    iFrozenVFFrameCopy = new ( ELeave ) CFbsBitmap();
+    iFrozenVFFrameToBeSent = new ( ELeave ) CFbsBitmap();
+    iScaler = CVtImageScaler::NewL( *this );
+    iFrozenFrame = CVsFrameBuffer::NewL( KFrozenFrameBufferSize );
+    
+    iHasFrozenVFFrameCopyCreated = EFalse;
+    
+    // Camera image processing
+    TRAP( error, iCamImgProc =
+        CCamera::CCameraImageProcessing::NewL( *iCamera ) );
+    User::LeaveIfError( iFreezeCS.CreateLocal() );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ConstructL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::FreezeViewFinderFrame
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::FreezeViewFinderFrame( CFbsBitmap& aFrame )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::FreezeViewFinderFrame() >>"), RThread().Id().operator TUint()));
+
+    TSize frameSize( aFrame.SizeInPixels() );
+
+    TUint scanlineLength( CFbsBitmap::ScanLineLength( frameSize.iWidth, aFrame.DisplayMode() ) );
+
+    TInt result = iFrozenVFFrameCopy->Create( frameSize, aFrame.DisplayMode() );
+
+    if( result != KErrNone )
+        {
+        Observer().vsProviderError( result );
+        return;
+        }
+
+    iFrozenVFFrameCopy->LockHeap();
+    const TUint8* source = reinterpret_cast< TUint8* >( aFrame.DataAddress() );
+    TUint8* dest = reinterpret_cast< TUint8* >( iFrozenVFFrameCopy->DataAddress() );
+    for( TInt y = frameSize.iHeight - 1; y >= 0; y-- )
+        {
+        Mem::Copy( dest, source, scanlineLength );
+        dest += scanlineLength;
+        source += scanlineLength;
+        }
+    iFrozenVFFrameCopy->UnlockHeap();
+    TRAP( result, ScaleFrozenBitmapL( frameSize ) );
+    iFreezePendingFlags &= ~EViewFinderFreezePending;
+    iHasFrozenVFFrameCopyCreated = ETrue;
+    if( result != KErrNone )
+        {
+        Observer().vsProviderError( result );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::FreezeViewFinderFrame() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ScaleFrozenBitmapL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ScaleFrozenBitmapL( TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ScaleFrozenBitmapL() >>"), RThread().Id().operator TUint()));
+    iFrozenVfFrameReady = EFalse;
+    delete iSource; iSource = 0;
+    iSource = CVtImageBitmap::NewL( iFrozenVFFrameCopy->Handle() );
+    User::LeaveIfError( iFrozenVFFrameToBeSent->Create( aSize, iFrozenVFFrameCopy->DisplayMode() ) );
+    delete iTarget; iTarget = 0;
+    iTarget = CVtImageBitmap::NewL( iFrozenVFFrameToBeSent->Handle() );
+    iScaler->Cancel();
+    iScaler->ScaleL( *iSource, *iTarget );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ScaleFrozenBitmapL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::ProviderInfoExL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::ProviderInfoExL( TVSDataProviderInfo& aInfo )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfoExL() >>"), RThread().Id().operator TUint()));
+    aInfo.iSupportedColorTones = CCamera::CCameraImageProcessing::EEffectNone;
+    // Check if colortone is suported and set colortone values
+    if ( iCamImgProc )
+    	{
+        RArray< TUid > uids;
+        CleanupClosePushL( uids );
+        iCamImgProc->GetSupportedTransformationsL( uids );
+        if ( uids.Find( KUidECamEventImageProcessingEffect ) != KErrNotFound )
+            {
+            TValueInfo type;
+            RArray< TInt > values;
+            CleanupClosePushL( values );
+            iCamImgProc->GetTransformationSupportedValuesL(
+                KUidECamEventImageProcessingEffect, values, type );
+            if ( ( type == EBitField ) && ( values.Count() > 0 ) )
+                {
+                aInfo.iSupportedColorTones = values[ 0 ];
+                }
+            else
+                {
+                __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfoExL() valueType is NOT bitfield, fix me"), RThread().Id().operator TUint()));
+                }
+            CleanupStack::PopAndDestroy(); // values.Close()
+            }
+        else
+            {
+            __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfoExL() camera image processing not supported"), RThread().Id().operator TUint()));
+            }
+        CleanupStack::PopAndDestroy(); // uids.Close()
+    	}
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::ProviderInfoExL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetContrastL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetContrastL( TInt aContrast )
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetContrastL() >>"), RThread().Id().operator TUint()));
+    Camera().SetContrastL(aContrast);
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetContrastL() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::GetContrast
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::GetContrast( TInt& aContrast ) const
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetContrast() >>"), RThread().Id().operator TUint()));
+	TInt result( KErrNotSupported );
+	TCameraInfo info;
+    Camera().CameraInfo( info );
+	if ( info.iOptionsSupported & TCameraInfo::EContrastSupported )
+		{
+    	aContrast = Camera().Contrast();
+		__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetContrast() %d"), RThread().Id().operator TUint(), aContrast));
+		result = KErrNone;
+		}
+     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetContrast() <<"), RThread().Id().operator TUint()));
+     return result;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetBrightnessL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetBrightnessL( TInt aBrightness )
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetBrightnessL() >>"), RThread().Id().operator TUint()));
+    Camera().SetBrightnessL( aBrightness );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetBrightnessL() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::GetBrightness
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::GetBrightness( TInt& aBrightness ) const
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetBrightness() >>"), RThread().Id().operator TUint()));
+	TInt result( KErrNotSupported );
+	TCameraInfo info;
+    Camera().CameraInfo( info );
+	if ( info.iOptionsSupported & TCameraInfo::EBrightnessSupported )
+		{
+    	aBrightness =  Camera().Brightness();
+		__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetBrightness() %d"), aBrightness));
+    	result = KErrNone;
+		}
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetBrightness() <<"), RThread().Id().operator TUint()));
+ 	return result;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetWhiteBalanceL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetWhiteBalanceL( CCamera::TWhiteBalance
+    aWhiteBalance )
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetWhiteBalanceL() >>"), RThread().Id().operator TUint()));
+    Camera().SetWhiteBalanceL( aWhiteBalance );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetWhiteBalanceL() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::GetWhiteBalance
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::GetWhiteBalance( CCamera::TWhiteBalance&
+    aWhiteBalance) const
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetWhiteBalance() >>"),RThread().Id().operator TUint() ) );
+    aWhiteBalance = Camera().WhiteBalance();
+    __IF_DEBUG(Print(_L("WhiteBalance[%d]: CVSCameraDataProvider::GetWhiteBalance() %d"), aWhiteBalance ) );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetWhiteBalance() <<"), RThread().Id().operator TUint() ) );
+    return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::SetColorToneL
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::SetColorToneL(
+    CCamera::CCameraImageProcessing::TEffect aValue )
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetColorToneL() >>"), RThread().Id().operator TUint()));
+	if ( iCamImgProc )
+		{
+		iCamImgProc->SetTransformationValue( KUidECamEventImageProcessingEffect, aValue );
+		}
+	else
+		{
+		//Set colortone that is not suported -> Leave
+		__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetColorToneL() LEAVE"), RThread().Id().operator TUint()));
+		User::Leave( KErrNotSupported );
+		}
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::SetColorToneL() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::GetColorTone
+// -----------------------------------------------------------------------------
+//
+TInt CVSCameraDataProvider::GetColorTone(
+	CCamera::CCameraImageProcessing::TEffect& aColorTone ) const
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetColorTone() >>"), RThread().Id().operator TUint()));
+	TInt result( KErrNotSupported );
+	if ( iCamImgProc )
+		{
+		aColorTone =
+		    static_cast< CCamera::CCameraImageProcessing::TEffect >(
+		        iCamImgProc->TransformationValue(
+		            KUidECamEventImageProcessingEffect ) );
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetColorTone() %d"), RThread().Id().operator TUint(), aColorTone));
+		result = KErrNone;
+		}
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::GetColorTone() <<"), RThread().Id().operator TUint()));
+	return 	result;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSCameraDataProvider::CancelInitializing
+// -----------------------------------------------------------------------------
+//
+void CVSCameraDataProvider::CancelInitializing()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::CancelInitializing() >>"), RThread().Id().operator TUint()));
+    //There is a blank implemention.
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSCameraDataProvider::CancelInitializing() <<"), RThread().Id().operator TUint()));
+    return;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSController.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CApiVideoSource.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVSController::CVSController()
+// -----------------------------------------------------------------------------
+//
+CVSController::CVSController()
+    {
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSControllerImp.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,168 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+
+#include "CVSControllerImp.h"
+#include "VSPanic.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Panics current thread.
+// -----------------------------------------------------------------------------
+//
+void Panic( TVSPanic aPanicCode )
+    {
+    User::Panic( KVSPanicCategory(), aPanicCode );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVSController::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSController* CVSController::NewL( MVSControllerObserver* aObserver )
+    {
+    __IF_DEBUG(Print(_L("VideoSource: CVSController::NewL() entering")));
+    if ( aObserver == NULL )
+        {
+        User::Leave( KErrArgument );
+        }
+    CVSController* self = CVSControllerImp::NewL();
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop( self );
+    __IF_DEBUG(Print(_L("VideoSource: CVSController::NewL() returning")));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSControllerImp::ConstructL( MVSControllerObserver* aObserver )
+    {
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ConstructL() entering")));
+    iObserver = aObserver;
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ConstructL() returning")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::NewL
+// -----------------------------------------------------------------------------
+//
+CVSControllerImp* CVSControllerImp::NewL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::NewL() entering")));
+    CVSControllerImp* self = new (ELeave) CVSControllerImp;
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::NewL() returning")));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::~CVSControllerImp
+// -----------------------------------------------------------------------------
+//
+CVSControllerImp::~CVSControllerImp()
+    {
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::~CVSControllerImp() entering")));
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::~CVSControllerImp() returning")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::CreateDataSourceL
+// -----------------------------------------------------------------------------
+//
+CVSDataSource* CVSControllerImp::CreateDataSourceL( MVSDataSourceObserver* aObserver )
+    {
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataSourceL() entering")));
+    CVSDataSource* p = CVSDataSource::NewSourceL( aObserver );
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataSourceL() returning")));
+    return p;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::ProvidersAvailable
+// -----------------------------------------------------------------------------
+//
+TInt CVSControllerImp::ProvidersAvailable()
+    {
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProvidersAvailable() entering")));
+    TInt count = CVSDataProvider::ProvidersAvailable();
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProvidersAvailable() returning")));
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::ProviderInfoL
+// -----------------------------------------------------------------------------
+//
+void CVSControllerImp::ProviderInfoL(
+    TInt aProviderIndex,
+    TVSDataProviderInfo& aInfo )
+    {
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProviderInfo() entering")));
+    if (aProviderIndex >= ProvidersAvailable() || aProviderIndex < 0)
+        {
+        User::Leave( KErrNotSupported );
+        }
+    CVSDataProvider::ProviderInfoL( aProviderIndex, aInfo );
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProviderInfo() returning")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSControllerImp::CreateDataProviderL
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider* CVSControllerImp::CreateDataProviderL(
+    TInt aProviderIndex,
+    MVSDataProviderObserver* aObserver,
+    MVSBufferPool* aPool )
+    {
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataProviderL() entering")));
+    if (aProviderIndex >= ProvidersAvailable() || aProviderIndex < 0)
+        {
+        User::Leave( KErrArgument );
+        }
+    if ( aObserver == NULL )
+        {
+        User::Leave( KErrArgument );
+        }
+    CVSDataProvider* p =
+        CVSDataProvider::NewL( aProviderIndex, aObserver, aPool );
+    __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataProviderL() returning")));
+    return p;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSDataProvider.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,543 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include <badesca.h>
+#include <e32svr.h>
+#include <featmgr.h>
+#include "CApiVideoSource.h"
+#include "CVSCameraDataProvider.h"
+#include "CVSStillImageDataProvider.h"
+#include "CVSOnboardCameraDataProvider.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+class TSizeCount
+    {
+    public:
+        TInt    iCount;
+        TSize   iSize;
+    };
+
+class TRateCount
+    {
+    public:
+        TInt    iCount;
+        TReal32 iRate;
+    };
+
+// LOCAL FUNCTION PROTOTYPES
+
+static TInt TSizeCountTLinearOrderFunc( 
+    const TSizeCount& aSizeCount1, const TSizeCount& aSizeCount2 );
+static TBool TSizeCountTIdentityRelationFunc( 
+    const TSizeCount& aSizeCount1, const TSizeCount& aSizeCount2 );
+static TInt TRateCountTLinearOrderFunc( 
+    const TRateCount& aRateCount1, const TRateCount& aRateCount2 );
+static TBool TRateCountTIdentityRelationFunc( 
+    const TRateCount& aRateCount1, const TRateCount& aRateCount2 );
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TSizeCountTLinearOrderFunc: Used in RArray<TSizeCount)::InsertInOrder
+// -----------------------------------------------------------------------------
+//
+static TInt TSizeCountTLinearOrderFunc( 
+    const TSizeCount& aSizeCount1,
+    const TSizeCount& aSizeCount2 )
+    {
+    if ( aSizeCount1.iSize == aSizeCount2.iSize )
+        {
+        return 0;
+        }
+    else
+        {
+        // It is assumed that width and height fit in 16-bit, if they don't,
+        // use TInt64
+        TInt32 s1 = 
+            ( aSizeCount1.iSize.iWidth & 0xffff ) << 16 | 
+            ( aSizeCount1.iSize.iHeight & 0xffff );
+        TInt32 s2 = 
+            ( aSizeCount2.iSize.iWidth & 0xffff ) << 16 | 
+            ( aSizeCount2.iSize.iHeight & 0xffff );
+        return s1 - s2;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TSizeCountTIdentityRelationFunc: Used in RArray<TSizeCount)::Find
+// -----------------------------------------------------------------------------
+//
+static TBool TSizeCountTIdentityRelationFunc( 
+    const TSizeCount& aSizeCount1, 
+    const TSizeCount& aSizeCount2 )
+    {
+    if ( aSizeCount1.iSize == aSizeCount2.iSize )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TRateCountTLinearOrderFunc: Used in RArray<TRateCount)::InsertInOrder
+// -----------------------------------------------------------------------------
+//
+static TInt TRateCountTLinearOrderFunc( 
+    const TRateCount& aRateCount1, 
+    const TRateCount& aRateCount2 )
+    {
+    if ( aRateCount1.iRate > aRateCount2.iRate ) 
+        {
+        return 1;
+        }
+        
+    if ( aRateCount1.iRate < aRateCount2.iRate )
+        {
+        return -1;
+        }
+        
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// TRateCountTIdentityRelationFunc: Used in RArray<TRateCount)::Find
+// -----------------------------------------------------------------------------
+//
+static TBool TRateCountTIdentityRelationFunc( 
+    const TRateCount& aRateCount1, 
+    const TRateCount& aRateCount2 )
+    {
+    if ( aRateCount1.iRate == aRateCount2.iRate )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::NewL
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider* CVSDataProvider::NewL( 
+    TInt aProviderIndex, 
+    MVSDataProviderObserver* aObserver, 
+    MVSBufferPool* aPool )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NewL() [aProviderIndex = %d] >>"), RThread().Id().operator TUint(), aProviderIndex));
+    
+    CVSDataProvider* self = NULL;
+    
+    // Is it ecam
+    TInt count = CamerasAvailable();
+    
+    // < 0 == error
+    if( count < 0 )
+        {
+        User::Leave( count );
+        }
+
+    if ( aProviderIndex < count )
+        {
+        self = CVSCameraDataProvider::NewL( aObserver, aProviderIndex, aPool );
+        }
+    else
+        {
+        // Is it still image
+        count += 1;
+
+        if ( aProviderIndex == ( count - 1) )
+            {
+            self = CVSStillImageDataProvider::NewL( aObserver, aPool );
+            }
+        else
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NewL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::~CVSDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider::~CVSDataProvider()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::~CVSDataProvider() >>"), RThread().Id().operator TUint()));
+    delete iErrorNotifier;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::~CVSDataProvider() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::ProvidersAvailable
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataProvider::ProvidersAvailable()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProvidersAvailable() >>"), RThread().Id().operator TUint()));
+    
+    // Count ecams
+    TInt numProviders = CamerasAvailable();
+
+    // < 0 == error
+    if ( numProviders < 0 )
+        {
+        numProviders = 1; // only still image provider
+        }
+    else
+        {
+        numProviders += 1; // add still
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProvidersAvailable() [numProviders = %d] <<"), RThread().Id().operator TUint(), numProviders));
+
+    return numProviders;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::ProviderInfoL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::ProviderInfoL( 
+    TInt aProviderIndex, 
+    TVSDataProviderInfo& aInfo )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProviderInfoL() >>"), RThread().Id().operator TUint()));
+    CVSDataProvider* provider = NewL( aProviderIndex, NULL, NULL);
+    provider->ProviderInfo( aInfo );
+    delete provider;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProviderInfoL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::SetFillBufferParams
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::SetFillBufferParams( 
+    MVTVideoSink* aConsumer, 
+    TMediaId aMediaId )
+    {
+    iConsumer = aConsumer;
+    iMediaId = aMediaId;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::NotifyError
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::NotifyError( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NotifyError() >>"), RThread().Id().operator TUint()));
+    iErrorNotifier->NotifyError( &Observer(), aError );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NotifyError() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::CVSDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSDataProvider::CVSDataProvider( 
+    MVSDataProviderObserver* aObserver, 
+    MVSBufferPool* aPool ) : 
+        iObserver( aObserver ), 
+        iPool ( aPool )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::CVSDataProvider() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::CVSDataProvider() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::ConstructL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ConstructL() >>"), RThread().Id().operator TUint()));
+    iErrorNotifier = CProviderErrorNotifierAO::NewL();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ConstructL() <<"), RThread().Id().operator TUint()));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::TimeToPlay
+// -----------------------------------------------------------------------------
+//
+const TTimeIntervalMicroSeconds& CVSDataProvider::TimeToPlay()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::TimeToPlay() >>"), RThread().Id().operator TUint()));
+
+    TTime now;
+    now.HomeTime();
+
+    TTimeIntervalMicroSeconds timeToPlay( now.MicroSecondsFrom( iStartTime ) );
+
+    if( timeToPlay <= iPreviousTimeToPlay )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::TimeToPlay(): *WARNING* Time warp backwards! Correcting.."), RThread().Id().operator TUint()));
+        iPreviousTimeToPlay = 
+            TTimeIntervalMicroSeconds( iPreviousTimeToPlay.Int64() + 1 );
+        }
+    else
+        {
+        iPreviousTimeToPlay = timeToPlay;
+        }
+
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::TimeToPlay() <<"), RThread().Id().operator TUint()));
+    return iPreviousTimeToPlay;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::ResetStartTime
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::ResetStartTime()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ResetStartTime() >>"), RThread().Id().operator TUint()));
+    iStartTime.HomeTime();
+    iPreviousTimeToPlay = iStartTime.MicroSecondsFrom( iStartTime );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ResetStartTime() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::CamerasAvailable()
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataProvider::CamerasAvailable()
+    {
+    TRAPD( result, FeatureManager::InitializeLibL() );
+    
+    if( result != KErrNone )
+        {
+        return result;
+        }
+    
+    TInt count( 0 );
+
+    if( FeatureManager::FeatureSupported( KFeatureIdCamera ) )
+        {
+        count = CCamera::CamerasAvailable();
+        }
+
+    FeatureManager::UnInitializeLib();
+
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::SwitchFrom
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::SwitchFrom( const CVSDataProvider& anOldProvider )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::SwitchFrom() >>"), RThread().Id().operator TUint()));
+    iStartTime = anOldProvider.iStartTime;
+    iPreviousTimeToPlay = anOldProvider.iPreviousTimeToPlay;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::SwitchFrom() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::EnumerateVideoFrameFormatsL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::EnumerateVideoFrameFormatsL( 
+    CDesC8Array* aSupportedFormats )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameFormats() >>"), RThread().Id().operator TUint()));
+    TInt providerCount = ProvidersAvailable();    
+    TInt countOfProvidersThatSupportYUV420Planar = 0;
+    for ( TInt i = 0; i < providerCount; i++ )
+        {
+        TVSDataProviderInfo info;
+        ProviderInfoL( i, info );
+        if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+            {
+            countOfProvidersThatSupportYUV420Planar++;
+            }
+        }
+    if( providerCount > 0 && 
+        providerCount <= countOfProvidersThatSupportYUV420Planar )
+        {
+        aSupportedFormats->AppendL( KVtVideoMIMETypeYUV420 );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameFormats() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::EnumerateVideoFrameSizesL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::EnumerateVideoFrameSizesL( 
+    RArray<TSize>& aSupportedSizes, 
+    const TDesC8& aFormat )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameSizes() >>"), RThread().Id().operator TUint()));
+    RArray<TSizeCount> sizeCountArray;
+    CleanupClosePushL( sizeCountArray );
+    TInt providerCount = ProvidersAvailable();
+    for ( TInt i = 0; i < providerCount; i++ )
+        {
+        CVSDataProvider* p = CVSDataProvider::NewL( i, NULL, NULL );
+        CleanupStack::PushL( p );
+        TVSDataProviderInfo info;
+        ProviderInfoL( i, info );
+        for ( TInt j = 0; j < info.iNumVideoFrameSizesSupported; j++ )
+            {
+            TSize size;
+            p->GetVideoFrameSize( size, j, aFormat );
+            if ( size != TSize(0,0) )
+                {
+                TSizeCount sizeCount;
+                sizeCount.iCount = 1;
+                sizeCount.iSize = size;
+                TInt err = sizeCountArray.InsertInOrder( 
+                    sizeCount, 
+                    TLinearOrder<TSizeCount>( TSizeCountTLinearOrderFunc ) );
+                if ( err == KErrAlreadyExists )
+                    {
+                    TInt idx = sizeCountArray.Find( 
+                        sizeCount, 
+                        TIdentityRelation<TSizeCount>( 
+                            TSizeCountTIdentityRelationFunc ) );
+                    if ( idx == KErrNotFound )
+                        {
+                        User::Leave( KErrUnknown );
+                        }
+                    else
+                        {
+                        // Increment count of providers that supports the size
+                        sizeCountArray[idx].iCount++;
+                        }
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy(); // p
+        }
+    aSupportedSizes.Reset();
+    for ( TInt k = 0; k < sizeCountArray.Count(); k++ )
+        {
+        // Do all providers support the size
+        if ( providerCount > 0 && providerCount <= sizeCountArray[k].iCount ) 
+            {
+            User::LeaveIfError( 
+                aSupportedSizes.Append( sizeCountArray[k].iSize ) );
+            }
+        }
+    CleanupStack::PopAndDestroy( ); // sizeCountArray
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameSizes() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataProvider::EnumerateVideoFrameRatesL
+// -----------------------------------------------------------------------------
+//
+void CVSDataProvider::EnumerateVideoFrameRatesL( 
+    RArray<TReal32>& aSupportedRates, 
+    const TDesC8& aFormat, 
+    const TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameRates() >>"), RThread().Id().operator TUint()));
+    RArray<TRateCount> rateCountArray;
+    CleanupClosePushL( rateCountArray );
+    TInt providerCount = ProvidersAvailable();
+    __IF_DEBUG(Print(_L("   LOOKING FOR COMMON SUPPORTED RATES, PROVIDER COUNT: %d"), providerCount));
+    for ( TInt i = 0; i < providerCount; i++ )
+        {
+        __IF_DEBUG(Print(_L("      PROVIDER %d"), i));
+        CVSDataProvider* p = CVSDataProvider::NewL( i, NULL, NULL );
+        CleanupStack::PushL( p );
+        TVSDataProviderInfo info;
+        ProviderInfoL( i, info );
+        __IF_DEBUG(Print(_L("         info.iNumVideoFrameRatesSupported: %d"), info.iNumVideoFrameRatesSupported));
+        for ( TInt j = 0; j < info.iNumVideoFrameRatesSupported; j++ )
+            {
+            TReal32 rate = 0.0;
+            p->GetVideoFrameRate( rate, j, aFormat, aSize );
+            __IF_DEBUG(Print(_L("         RATE FOR RATE INDEX %d IS %f"), j, rate));
+            if ( rate != 0.0 )
+                {
+                TRateCount rateCount;
+                rateCount.iCount = 1;
+                rateCount.iRate = rate;
+                TInt err = rateCountArray.InsertInOrder( 
+                    rateCount, 
+                    TLinearOrder<TRateCount>( TRateCountTLinearOrderFunc ) );
+                if ( err == KErrAlreadyExists )
+                    {
+                    TInt idx = rateCountArray.Find( 
+                        rateCount, 
+                        TIdentityRelation<TRateCount>( 
+                            TRateCountTIdentityRelationFunc ) );
+                    if ( idx == KErrNotFound )
+                        {
+                        User::Leave( KErrUnknown );
+                        }
+                    else
+                        {
+                        // Increment count of providers that supports the rate
+                        rateCountArray[idx].iCount++;
+                        }
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy(); // p
+        }
+    aSupportedRates.Reset();
+    for ( TInt k = 0; k < rateCountArray.Count(); k++ )
+        {
+        // Do all providers support the rate
+        if ( providerCount > 0 && providerCount <= rateCountArray[k].iCount )
+            {
+            User::LeaveIfError( 
+                aSupportedRates.Append( rateCountArray[k].iRate ) );
+            }
+        }
+    CleanupStack::PopAndDestroy( ); // rateCountArray
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameRates() <<"), RThread().Id().operator TUint()));
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSDataSourceImp.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1315 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <fbs.h>
+#include <e32svr.h>
+#include <badesca.h>
+#include <mmfdatasourcesink.hrh>
+
+#include "CVSMMFDataBuffer.h"
+#include "CVSDataSourceImp.h"
+#include "VSPanic.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+static const TInt KQcifWidth = 176;
+static const TInt KQcifHeight = 144;
+
+ // 4:2:0 planar and 32 bytes extra
+ static const TInt KSourceBufferSize =
+    ( KQcifWidth * KQcifHeight ) + ( ( KQcifWidth * KQcifHeight ) / 2 ) + 12;
+
+// Granularity for video frame format array
+static const TInt KNoOfSupportedFormats = 4;
+
+// How many sequential FillBufferL calls is supported
+static const TInt KNoOfSupportedBuffers = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================ CVSProviderSwitchAO ============================
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::NewL
+// -----------------------------------------------------------------------------
+//
+CVSProviderSwitchAO* CVSProviderSwitchAO::NewL(
+    CVSDataSourceImp* aDataSourceImp )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::NewL() >>"), RThread().Id().operator TUint()));
+    CVSProviderSwitchAO* self =
+        new ( ELeave ) CVSProviderSwitchAO( aDataSourceImp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::NewL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::ConstructL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ConstructL() >>"), RThread().Id().operator TUint()));
+    User::LeaveIfError( iSwitchCs.CreateLocal() );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ConstructL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::CVSProviderSwitchAO
+// -----------------------------------------------------------------------------
+//
+CVSProviderSwitchAO::CVSProviderSwitchAO( CVSDataSourceImp* aDataSourceImp )
+: CActive( EPriorityStandard ), iDataSourceImp( aDataSourceImp )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::CVSProviderSwitchAO() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::CVSProviderSwitchAO() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::~CVSProviderSwitchAO
+// -----------------------------------------------------------------------------
+//
+CVSProviderSwitchAO::~CVSProviderSwitchAO()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::~CVSProviderSwitchAO() >>"), RThread().Id().operator TUint()));
+    iSwitchCs.Close();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::~CVSProviderSwitchAO() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::ThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CVSProviderSwitchAO::ThreadLogon( MAsyncEventHandler& aEventHandler )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ThreadLogon() >>"), RThread().Id().operator TUint()));
+    iEventHandler = &aEventHandler;
+    RThread me;
+    iThreadId = me.Id();
+    CActiveScheduler::Add( this );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ThreadLogon() <<"), RThread().Id().operator TUint()));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::ThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::ThreadLogoff()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ThreadLogoff() >>"), RThread().Id().operator TUint()));
+    if( RThread().Id().operator TUint() == iThreadId )
+        {
+        Deque();
+        iThreadId = 0;
+        iNewProvider = NULL;
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::ThreadLogoff() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::InitiateProviderSwitch
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::InitiateProviderSwitch(
+    CVSDataProvider* aNewProvider )
+    {
+    iSwitchCs.Wait();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::InitiateProviderSwitch() >>"), RThread().Id().operator TUint()));
+    iNewProvider = aNewProvider;
+    iStatus = KRequestPending;
+    SetActive();
+    Signal( KErrNone );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::InitiateProviderSwitch() <<"), RThread().Id().operator TUint()));
+    iSwitchCs.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::RunL
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::RunL()
+    {
+    iSwitchCs.Wait();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::RunL() >>"), RThread().Id().operator TUint()));
+    if( iStatus.Int() == KErrNone )
+        {
+        if ( iDataSourceImp->SwitchPending() )
+            {
+            Panic( EVSPanicSwitchAlreadyPending );
+            }
+        TRAPD(
+            leaveCode,
+            iDataSourceImp->DoProviderSwitchL( iNewProvider, *iEventHandler ) );
+        if ( leaveCode != KErrNone )
+            {
+            iDataSourceImp->ProviderSwitchError( leaveCode );
+            }
+        }
+    else
+        {
+        iNewProvider = NULL;
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::RunL() <<"), RThread().Id().operator TUint()));
+    iSwitchCs.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::DoCancel()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::DoCancel() >>"), RThread().Id().operator TUint()));
+    // Nothing to do here. This AO is always signalled when it's activated.
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::DoCancel() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSProviderSwitchAO::Signal
+// -----------------------------------------------------------------------------
+//
+void CVSProviderSwitchAO::Signal( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::Signal() >>"), RThread().Id().operator TUint()));
+    if( IsActive() )
+        {
+        TRequestStatus* pStatus = &iStatus;
+        RThread me;
+        if( me.Id() == iThreadId )
+            {
+            User::RequestComplete( pStatus, aError );
+            }
+        else
+            {
+            if( me.Open( iThreadId ) == KErrNone )
+                {
+                *pStatus = KRequestPending;
+                me.RequestComplete( pStatus, aError );
+                me.Close();
+                }
+            else
+                {
+                Panic( EVSPanicThreadOpenFailure );
+                }
+            }
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSProviderSwitchAO::Signal() <<"), RThread().Id().operator TUint()));
+    }
+
+// ============================ CVSDataSourceObserverAO ========================
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::CVSDataSourceObserverAO
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceObserverAO::CVSDataSourceObserverAO()
+: CActive( EPriorityStandard )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::CVSDataSourceObserverAO() >>"), RThread().Id().operator TUint()));
+    RThread me;
+    iThreadId = me.Id();
+    CActiveScheduler::Add( this );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::CVSDataSourceObserverAO() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::~CVSDataSourceObserverA
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceObserverAO::~CVSDataSourceObserverAO()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::~CVSDataSourceObserverAO() >>"), RThread().Id().operator TUint()));
+    Cancel();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::~CVSDataSourceObserverAO() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::vsProviderSwitchDone
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceObserverAO::vsProviderSwitchDone(
+    MVSDataSourceObserver& aObserver,
+    CVSDataProvider* aOldProvider )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::vsProviderSwitchDone() >>"), RThread().Id().operator TUint()));
+    iObserver = &aObserver;
+    iOldProvider = aOldProvider;
+    iStatus = KRequestPending;
+    SetActive();
+    Signal( KErrNone );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::vsProviderSwitchDone() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::RunL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceObserverAO::RunL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::RunL() >>"), RThread().Id().operator TUint()));
+    if( iStatus.Int() == KErrNone )
+        {
+        iObserver->vsProviderSwitchDone( iOldProvider );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::RunL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceObserverAO::DoCancel()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::DoCancel() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::DoCancel() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceObserverAO::Signal
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceObserverAO::Signal( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::Signal() >>"), RThread().Id().operator TUint()));
+    TRequestStatus* pStatus = &iStatus;
+    RThread me;
+    if( me.Id() == iThreadId )
+        {
+        User::RequestComplete( pStatus, aError );
+        }
+    else
+        {
+        if( me.Open( iThreadId ) == KErrNone )
+            {
+            *pStatus = KRequestPending;
+            me.RequestComplete( pStatus, aError );
+            me.Close();
+            }
+        else
+            {
+            Panic( EVSPanicThreadOpenFailure );
+            }
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceObserverAO::Signal() <<"), RThread().Id().operator TUint()));
+    }
+
+
+
+// =============================== CVSDataSource ===============================
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::NewSourceL
+// -----------------------------------------------------------------------------
+//
+CVSDataSource* CVSDataSource::NewSourceL( MVSDataSourceObserver* aObserver )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::NewSourceL() >>"), RThread().Id().operator TUint()));
+    if ( aObserver == NULL )
+        {
+        User::Leave( KErrArgument );
+        }
+    CVSDataSource* self = CVSDataSourceImp::NewSourceL();
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop( self );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::NewSourceL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::CVSDataSource
+// -----------------------------------------------------------------------------
+//
+CVSDataSource::CVSDataSource() : MVTVideoSource( KNullUid )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::CVSDataSource() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::CVSDataSource() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSource::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSource::ConstructL( MVSDataSourceObserver* aObserver )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::ConstructL() >>"), RThread().Id().operator TUint()));
+    iObserver = aObserver;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSource::ConstructL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::NewSourceL
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceImp* CVSDataSourceImp::NewSourceL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::NewSourceL() >>"), RThread().Id().operator TUint()));
+    CVSDataSourceImp* self = new (ELeave) CVSDataSourceImp;
+    CleanupStack::PushL( self );
+    self->ConstructSourceL( KNullDesC8 );
+    CleanupStack::Pop( self );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::NewSourceL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SwitchDataProviderL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SwitchDataProviderL(
+    CVSDataProvider* aNewProvider )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SwitchDataProviderL() >>"), RThread().Id().operator TUint()));
+    if ( aNewProvider == NULL )
+        {
+        __IF_DEBUG(Print(_L("SwitchDataProviderL(): NULL argument, leaving.")));
+        User::Leave( KErrArgument );
+        }
+    // Is new provider same as old, then no need to change provider
+    if ( aNewProvider == &DataProvider() )
+        {
+        __IF_DEBUG(Print(_L("SwitchDataProviderL(): New provider same as old: 0x%x"), aNewProvider));
+        Observer().vsProviderSwitchDone( aNewProvider );
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SwitchDataProvider() <<"), RThread().Id().operator TUint()));
+        return;
+        }
+    // If Protocol is in the currently initializing itself then complete this switch
+    // request when Protocol ready (from SourcePlayL). No need to protect
+    // iProtoInitOngoing test with CS.
+    if ( iProtoInitOngoing )
+        {
+        __IF_DEBUG(Print(_L("PROTOCOL INIT ONGOING, PENDING SWITCH FOR A WHILE")));
+        iProtoInitCS.Wait();
+        iProviderSwitchRequestDuringProtoInit = ETrue;
+        iNewProvider = aNewProvider;
+        iProtoInitCS.Signal();
+        return;
+        }
+    // Switch provider
+    if ( iThreadLogonCalled )
+        {
+        iProviderSwitchAO->InitiateProviderSwitch( aNewProvider );
+        }
+    else
+        {
+        CVSDataProvider* oldProvider = SwitchProvider( aNewProvider );
+        Observer().vsProviderSwitchDone( oldProvider );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SwitchDataProviderL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::PauseSending
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::PauseSending()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::PauseSending() >>"), RThread().Id().operator TUint()));
+    iPauseCs.Wait();
+    iSendingPaused = ETrue;
+    iPauseCs.Signal();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::PauseSending() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::ResumeSending
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::ResumeSending()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::ResumeSending() >>"), RThread().Id().operator TUint()));
+    iPauseCs.Wait();
+    iSendingPaused = EFalse;
+    iPauseCs.Signal();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::ResumeSending() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::~CVSDataSourceImp
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceImp::~CVSDataSourceImp()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::~CVSDataSourceImp() >>"), RThread().Id().operator TUint()));
+    delete iDataSourceObserverAO;
+    delete iProviderSwitchAO;
+    iProtoMimeTypes.Close();
+    delete iSupportedVideoFormats;
+    iSupportedVideoSizes.Close();
+    iSupportedFrameRates.Close();
+    // Assuming no need to use critical section here
+    iFreeQueue.Close();
+    iActiveQueue.Close();
+    iAllocatedBuffers.ResetAndDestroy();
+    iQueueCs.Close();
+    iPauseCs.Close();
+    iProtoInitCS.Close();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::~CVSDataSourceImp() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::FillBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::FillBufferL(
+    CMMFBuffer* aBuffer,
+    MVTVideoSink* aConsumer,
+    TMediaId aMediaId )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL() >>"), RThread().Id().operator TUint()));
+
+    if ( aBuffer == NULL || aConsumer == NULL )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    if ( aBuffer->Type() != KUidMmfDataBuffer )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    DataProvider().SetFillBufferParams( aConsumer, aMediaId );
+
+    iPauseCs.Wait();
+    const TBool sendingPaused( iSendingPaused );
+    iPauseCs.Signal();
+
+    if( iSwitchOngoing )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): Switch ongoing"), RThread().Id().operator TUint()));
+        // queues are locked by us -> it's safe to modify queues without
+        // locking
+        User::LeaveIfError(
+            FreeBufferNoWait( static_cast<CVSMMFDataBuffer*>( aBuffer ) ) );
+        }
+    else if( iSwitchPending )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): Switch pending"), RThread().Id().operator TUint()));
+        FreeBufferL( static_cast<CVSMMFDataBuffer*>( aBuffer ) );
+        TRAPD(
+            err,
+            DoProviderSwitchL(
+                iProviderSwitchAO->NewDataProvider(),
+                iProviderSwitchAO->EventHandler() ) );
+        if( err != KErrNone )
+            {
+            __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): Error in switch = %d"), RThread().Id().operator TUint(), err));
+            // Not leaving from here (it was provider switch related error),
+            // let VT take care of the rest
+            ProviderSwitchError( err );
+            }
+        }
+    else if( sendingPaused )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): Sending Paused"), RThread().Id().operator TUint()));
+        // queues are locked by us -> it's safe to modify queues without
+        // locking
+        User::LeaveIfError(
+            FreeBufferNoWait( static_cast<CVSMMFDataBuffer*>( aBuffer ) ) );
+        }
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL(): No switch -> normal FillBufferL()"), RThread().Id().operator TUint()));
+        FreeBufferL( static_cast<CVSMMFDataBuffer*>( aBuffer ) );
+        DataProvider().FillBufferL( aBuffer, aConsumer, aMediaId );
+        }
+
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FillBufferL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::BufferEmptiedL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::BufferEmptiedL() >>"), RThread().Id().operator TUint()));
+    User::Leave( KErrNotSupported );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::BufferEmptiedL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CanCreateSourceBuffer
+// -----------------------------------------------------------------------------
+//
+TBool CVSDataSourceImp::CanCreateSourceBuffer()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CanCreateSourceBuffer() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CanCreateSourceBuffer) <<"), RThread().Id().operator TUint()));
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CreateSourceBufferL
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CVSDataSourceImp::CreateSourceBufferL(
+    TMediaId /*aMediaId*/,
+    TBool &aReference )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL() >>"), RThread().Id().operator TUint()));
+    if ( iRequestedBufferCount >= KNoOfSupportedBuffers )
+        {
+        User::Leave( KErrOverflow );
+        }
+    aReference = ETrue;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL(): Returning buffer: %d [0x%08x]"), RThread().Id().operator TUint(), iRequestedBufferCount + 1, iAllocatedBuffers[ iRequestedBufferCount ]));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL() <<"), RThread().Id().operator TUint()));
+    return iAllocatedBuffers[ iRequestedBufferCount++ ];
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CreateSourceBufferL
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CVSDataSourceImp::CreateSourceBufferL(
+    TMediaId /*aMediaId*/,
+    CMMFBuffer& /*aSinkBuffer*/,
+    TBool &aReference )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL() >>"), RThread().Id().operator TUint()));
+    if ( iRequestedBufferCount >= KNoOfSupportedBuffers )
+        {
+        User::Leave( KErrOverflow );
+        }
+    aReference = ETrue;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL(): Returning buffer: %d [0x%08x]"), RThread().Id().operator TUint(), iRequestedBufferCount + 1, iAllocatedBuffers[ iRequestedBufferCount ]));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CreateSourceBufferL() <<"), RThread().Id().operator TUint()));
+    return iAllocatedBuffers[ iRequestedBufferCount++ ];
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourceThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourceThreadLogon( MAsyncEventHandler& aEventHandler )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceThreadLogon() >>"), RThread().Id().operator TUint()));
+    __ASSERT_DEBUG( (&DataProvider()) != NULL,
+        Panic( EVSPanicProviderNotSet ) );
+    TInt err( KErrNone );
+    if( !iFbsStarted )
+        {
+        // Caller does not start the FBS server when compiled on proxy mode
+        // so we have to take care of that by ourself.
+        err = FbsStartup();
+        if( err == KErrNone )
+            {
+            err = RFbsSession::Connect();
+            if( err == KErrNone )
+                {
+                iFbsStarted = ETrue;
+                }
+            }
+        }
+    if( !iThreadLogonCalled && ( err == KErrNone ) )
+        {
+        err = DataProvider().SourceThreadLogon( aEventHandler );
+        if (err != KErrNone)
+            {
+            return err;
+            }
+        iProviderSwitchAO->ThreadLogon( aEventHandler );
+        iThreadLogonCalled = ETrue;
+        iProtoInitOngoing = ETrue;
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceThreadLogon() <<"), RThread().Id().operator TUint()));
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourceThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SourceThreadLogoff()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceThreadLogoff() >>"), RThread().Id().operator TUint()));
+
+    iThreadLogonCalled = EFalse;
+
+    if ( iProviderSwitchRequestDuringProtoInit )
+        {
+        __IF_DEBUG(Print(_L("PROTOCOL INIT FAILED, NOW COMPLETING THE SWITCH REQUEST WITH ERROR")));
+        iProviderSwitchRequestDuringProtoInit = EFalse;
+        ProviderSwitchError( KErrAbort );
+        }
+
+    if( &DataProvider() )
+        {
+        DataProvider().SourceThreadLogoff();
+        }
+
+    iSwitchOngoing = iSwitchPending = EFalse;
+
+    iProtoInitOngoing = EFalse;
+
+    // If provider switch ongoing complete it
+    if ( iProviderSwitchAO->NewDataProvider() != NULL )
+        {
+        CVSDataProvider* oldProvider =
+            SwitchProvider( iProviderSwitchAO->NewDataProvider() );
+        Observer().vsProviderSwitchDone( oldProvider );
+        }
+
+    iProviderSwitchAO->ThreadLogoff();
+
+    delete iFormat; iFormat = 0;
+
+    iCallFlags = 0;
+
+    // Clear iFreeQueue
+    while( iFreeQueue.Count() )
+        {
+        iFreeQueue.Remove( 0 );
+        }
+
+    // Clear iActiveQueue
+    while( iActiveQueue.Count() )
+        {
+        iActiveQueue.Remove( 0 );
+        }
+
+    // Set frame buffer to NULL for all buffers
+    for( TInt i = 0; i < iRequestedBufferCount; i++ )
+        {
+        TInt err = KErrNone;
+        // Does not leave when framebuffer is set to NULL
+        // Both type of buffers needs to be nulled
+        TRAP( err, iAllocatedBuffers[i]->SetFrameBufferL( ( MCameraBuffer* )NULL ));
+		TRAP( err, iAllocatedBuffers[i]->SetFrameBufferL( ( MFrameBuffer* )NULL ));        }
+
+    // All pre-created buffers are free again
+    iRequestedBufferCount = 0;
+
+    if( iFbsStarted )
+        {
+        RFbsSession::Disconnect();
+        iFbsStarted = EFalse;
+        }
+
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceThreadLogoff() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourcePrimeL
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourcePrimeL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePrimeL() >>"), RThread().Id().operator TUint()));
+    TRAPD( result, DataProvider().SourcePrimeL() );
+    if( ( result == KErrNone ) || ( result == KRequestPending ) )
+        {
+        iDSState = CVSDataSourceImp::EPrimed;
+        }
+    else
+        {
+        User::Leave( result );
+        }
+    iProtoInitOngoing = EFalse;
+    // If provider switch was requested when Proto was  initializing itself then
+    // fill switch request now
+    iProtoInitCS.Wait();
+    if ( iProviderSwitchRequestDuringProtoInit )
+        {
+        __IF_DEBUG(Print(_L("PROTOCOL INIT READY, NOW COMPLETING THE SWITCH REQUEST")));
+        iProviderSwitchRequestDuringProtoInit = EFalse;
+        iProviderSwitchAO->InitiateProviderSwitch( iNewProvider );
+        iNewProvider = NULL;
+        }
+    iProtoInitCS.Signal();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePrimeL() <<"), RThread().Id().operator TUint()));
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourcePlayL
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourcePlayL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL() >>"), RThread().Id().operator TUint()));
+    if( !iSwitchOngoing )
+        {
+        DataProvider().SourcePlayL();
+        }
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL(): Switch ongoing -> updating state only, play will be called after switch"), RThread().Id().operator TUint()));
+        }
+    iDSState = CVSDataSourceImp::EPlaying;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL() <<"), RThread().Id().operator TUint()));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourcePauseL
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourcePauseL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePauseL() >>"), RThread().Id().operator TUint()));
+    if( !iSwitchOngoing )
+        {
+        DataProvider().SourcePauseL();
+        }
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL(): Switch ongoing -> updating state only"), RThread().Id().operator TUint()));
+        }
+    iDSState = CVSDataSourceImp::EPrimed;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePauseL() <<"), RThread().Id().operator TUint()));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SourceStopL
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::SourceStopL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceStopL() >>"), RThread().Id().operator TUint()));
+    if( !iSwitchOngoing )
+        {
+        DataProvider().SourceStopL();
+        }
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourcePlayL(): Switch ongoing -> updating state only"), RThread().Id().operator TUint()));
+        }
+    iDSState = CVSDataSourceImp::EStopped;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SourceStopL() <<"), RThread().Id().operator TUint()));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::ConstructSourceL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::ConstructSourceL( const TDesC8& /*aInitData*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::ConstructSourceL() >>"), RThread().Id().operator TUint()));
+    iYuv420PlanarDesc.Zero();
+    iYuv420PlanarDesc.Append( KVtVideoMIMETypeYUV420 );
+    User::LeaveIfError( iProtoMimeTypes.Append( &iYuv420PlanarDesc ) );
+    iProviderSwitchAO = CVSProviderSwitchAO::NewL( this );
+    iDataSourceObserverAO = new (ELeave) CVSDataSourceObserverAO();
+    iSupportedVideoFormats =
+        new (ELeave) CDesC8ArrayFlat( KNoOfSupportedFormats );
+    // Get formats supported by all providers
+    CVSDataProvider::EnumerateVideoFrameFormatsL( iSupportedVideoFormats );
+    // Get video frame sizes for specified format supported by all providers
+    TInt i, j;
+    i = j = 0;
+    for ( i = 0; i < iSupportedVideoFormats->Count(); i++ )
+        {
+        TPtrC8 format = iSupportedVideoFormats->MdcaPoint( i );
+        RArray<TSize> sizeArray;
+        CleanupClosePushL( sizeArray );
+        CVSDataProvider::EnumerateVideoFrameSizesL( sizeArray, format );
+        for ( j = 0; j < sizeArray.Count(); j++ )
+            {
+            TVSFrameSize sizePerFormat;
+            sizePerFormat.iFormat.Set( format );
+            sizePerFormat.iSize = sizeArray[j];
+            User::LeaveIfError( iSupportedVideoSizes.Append( sizePerFormat ) );
+            }
+        CleanupStack::PopAndDestroy(); // sizeArray
+        }
+    // Get video frame rates for specified frame format and size supported
+    // by all providers
+    for ( i = 0; i < iSupportedVideoSizes.Count(); i++ )
+        {
+        RArray<TReal32> rateArray;
+        CleanupClosePushL( rateArray );
+        CVSDataProvider::EnumerateVideoFrameRatesL(
+            rateArray,
+            iSupportedVideoSizes[i].iFormat,
+            iSupportedVideoSizes[i].iSize );
+        for ( j = 0; j < rateArray.Count(); j++ )
+            {
+            TVSFrameRate framePerSizeAndFormat;
+            framePerSizeAndFormat.iFormat.Set(
+                iSupportedVideoSizes[i].iFormat );
+            framePerSizeAndFormat.iSize = iSupportedVideoSizes[i].iSize;
+            framePerSizeAndFormat.iRate = rateArray[j];
+            User::LeaveIfError( iSupportedFrameRates.Append(
+                framePerSizeAndFormat ) );
+            }
+        CleanupStack::PopAndDestroy(); // rateArray
+        }
+    // Create queue criticalsection
+    User::LeaveIfError( iQueueCs.CreateLocal() );
+    // Create VTEng-Protocol guard
+    User::LeaveIfError( iPauseCs.CreateLocal() );
+    // Pre-create buffers
+    for( i = 0; i < KNoOfSupportedBuffers; i++ )
+        {
+        User::LeaveIfError( iFreeQueue.Append( 0 ) );
+        User::LeaveIfError( iActiveQueue.Append( 0 ) );
+        CVSMMFDataBuffer* buffer = CVSMMFDataBuffer::NewL( KSourceBufferSize );
+        CleanupStack::PushL( buffer );
+        User::LeaveIfError( iAllocatedBuffers.Append( buffer ) );
+        CleanupStack::Pop(); // buffer
+        }
+    for( i = 0; i < KNoOfSupportedBuffers; i++ )
+        {
+        iFreeQueue.Remove( 0 );
+        iActiveQueue.Remove( 0 );
+        }
+    // Init critical sections
+    User::LeaveIfError( iProtoInitCS.CreateLocal() );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::ConstructSourceL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::GetMultimediaTypesL
+// -----------------------------------------------------------------------------
+//
+const RArray<TDesC8*>& CVSDataSourceImp::GetMultimediaTypesL() const
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetMultimediaTypeL() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetMultimediaTypeL() <<"), RThread().Id().operator TUint()));
+    return iProtoMimeTypes;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SetFormatL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SetFormatL( const TDesC8& aFormat )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetFormatL() >>"), RThread().Id().operator TUint()));
+    if ( &DataProvider() == NULL )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    TBool supported = EFalse;
+    for ( TInt i = 0; i < iSupportedVideoFormats->Count(); i++ )
+        {
+        TPtrC8 format = iSupportedVideoFormats->MdcaPoint( i );
+        if ( aFormat == format )
+            {
+            supported = ETrue;
+            break;
+            }
+        }
+    if ( !supported )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    DataProvider().SetFormatL( aFormat );
+    delete iFormat; iFormat = 0;
+    iFormat = aFormat.AllocL();
+    iCallFlags |= ESetFormatCalled;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetFormatL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SetFrameRateL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SetFrameRateL( TReal32 aFrameRate )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetFrameRateL() >>"), RThread().Id().operator TUint()));
+    if ( &DataProvider() == NULL )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    TBool supported = EFalse;
+    for ( TInt i = 0; i < iSupportedFrameRates.Count(); i++ )
+        {
+        TVSFrameRate rate = iSupportedFrameRates[i];
+        if ( rate.iFormat == iFormat->Des() && rate.iSize == iSize)
+            {
+            if ( aFrameRate == rate.iRate )
+                {
+                supported = ETrue;
+                break;
+                }
+            }
+        }
+    if ( !supported )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    DataProvider().SetFrameRateL( aFrameRate );
+    iFrameRate = aFrameRate;
+    iCallFlags |= ESetFrameRateCalled;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetFrameRateL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::SetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::SetVideoFrameSizeL( const TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetVideoFrameSizeL() >>"), RThread().Id().operator TUint()));
+    if ( &DataProvider() == NULL )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    TBool supported = EFalse;
+    for ( TInt i = 0; i < iSupportedVideoSizes.Count(); i++ )
+        {
+        TVSFrameSize size = iSupportedVideoSizes[i];
+        if ( size.iFormat == iFormat->Des() )
+            {
+            if ( aSize == size.iSize )
+                {
+                supported = ETrue;
+                break;
+                }
+            }
+        }
+    if ( !supported )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    DataProvider().SetVideoFrameSizeL( aSize );
+    iSize = aSize;
+    iCallFlags |= ESetSizeCalled;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::SetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::GetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::GetVideoFrameSizeL( TSize& aSize ) const
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetVideoFrameSizeL() >>"), RThread().Id().operator TUint()));
+    if ( &DataProvider() == NULL )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    DataProvider().GetVideoFrameSizeL( aSize );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::DoProviderSwitchL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::DoProviderSwitchL(
+    CVSDataProvider* aNewProvider,
+    MAsyncEventHandler& aEventHandler )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::DoProviderSwitchL() >>"), RThread().Id().operator TUint()));
+
+    iQueueCs.Wait();
+
+    // If there are entries in iActiveQueue wait until they are freed by Protocol
+    if ( iActiveQueue.Count() > 0 )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::DoProviderSwitchL(): activequeue count > 0, <<"), RThread().Id().operator TUint()));
+        iSwitchPending = ETrue;
+        iQueueCs.Signal();
+        return;
+        }
+    else
+        {
+        iSwitchPending = EFalse;
+        }
+
+    iSwitchOngoing = ETrue;
+
+    /*
+     * THE FOLLOWING CALLS USE CActiveSchedulerWait WHICH MEANS SOME OTHER
+     * OBJECT MAY RUN IN BETWEEN THE FOLLOWING CALLS I.E. THESE CALLS ARE NOT
+     * SYNCHRONOUS.
+     */
+
+    User::LeaveIfError( aNewProvider->SourceThreadLogon( aEventHandler ) );
+
+    // Is format set by the Protocol
+    if ( iCallFlags & ESetFormatCalled )
+        {
+        aNewProvider->SetFormatL( *iFormat );
+        }
+    // Is size set by the Protocol
+    if ( iCallFlags & ESetSizeCalled )
+        {
+        aNewProvider->SetVideoFrameSizeL( iSize );
+        }
+    // Is framerate set by the Protocol
+    if ( iCallFlags & ESetFrameRateCalled )
+        {
+        aNewProvider->SetFrameRateL( iFrameRate );
+        }
+    // Stop old provider
+    if ( &DataProvider() != NULL )
+        {
+        switch( iDSState )
+            {
+        case EPlaying:
+            DataProvider().SourcePauseL();
+            DataProvider().SourceStopL();
+            break;
+
+        case EPrimed:
+            DataProvider().SourceStopL();
+            break;
+
+        default:
+            break;
+            };
+        DataProvider().SourceThreadLogoff();
+        }
+
+    // Set new provider state according to current state
+    switch ( iDSState )
+        {
+        case EStopped:
+            break;
+
+        case EPrimed:
+        case EPlaying:
+            aNewProvider->PrimeL();
+
+            // check if SourcePlayL() was called during prime
+            if( iDSState == EPlaying )
+                {
+                aNewProvider->SourcePlayL();
+                aNewProvider->SwitchFrom( DataProvider() );
+                }
+            // or SourceStopL()
+            else if( iDSState == EStopped )
+                {
+                aNewProvider->SourceStopL();
+                }
+            break;
+        }
+    /*
+     * THE FOLLOWING CALLS ARE SUPPOSED TO BE SYNCHRONOUS IN THAT THEY DO NOT
+     * LET ACTIVE SCHEDULER RUN SOME OTHER OBJECT.
+     */
+
+    // Complete switch
+    CVSDataProvider* oldProvider = SwitchProvider( aNewProvider );
+
+    // Set consumer and media id
+    DataProvider().SetFillBufferParams(
+        oldProvider->Consumer(),
+        oldProvider->MediaId() );
+
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::DoProviderSwitchL(): iFreeQueue.Count() = %d, iActiveQueue.Count() = %d"), RThread().Id().operator TUint(), iFreeQueue.Count(), iActiveQueue.Count() ));
+
+    // If old provider has pending FillBufferL() calls -> call FillBufferL()
+    // for new provider if it is in Playing state.
+	if( iDSState == EPlaying )
+		{
+        for ( TInt i = 0; i < iFreeQueue.Count(); i++ )
+            {
+            iFreeQueue[ i ]->Reset();
+            DataProvider().FillBufferL(
+                iFreeQueue[i],
+                DataProvider().Consumer(),
+                DataProvider().MediaId() );
+    		}
+        }
+
+    // Buffers that are being used by Protocol are set to be needing a reset
+    for ( TInt i = 0; i < iActiveQueue.Count(); i++ )
+        {
+        iActiveQueue[ i ]->SetNeedsReset( ETrue );
+        }
+
+    iSwitchOngoing = EFalse;
+
+    iQueueCs.Signal();
+
+    iDataSourceObserverAO->vsProviderSwitchDone( Observer(), oldProvider );
+    iProviderSwitchAO->NewDataProvider() = NULL;
+
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::DoProviderSwitchL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CVSDataSourceImp
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::ProviderSwitchError( TInt aError )
+    {
+    DataProvider().NotifyError( aError );
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::CVSDataSourceImp
+// -----------------------------------------------------------------------------
+//
+CVSDataSourceImp::CVSDataSourceImp()
+: iFreeQueue( KNoOfSupportedBuffers ), iActiveQueue( KNoOfSupportedBuffers )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CVSDataSourceImp() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::CVSDataSourceImp() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::GetBufferL
+// -----------------------------------------------------------------------------
+//
+CVSMMFDataBuffer* CVSDataSourceImp::GetBufferL( TBool aRemove )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL() >>"), RThread().Id().operator TUint()));
+    if( !iQueueCs.IsBlocked() )
+        {
+        iPauseCs.Wait();
+        const TBool sendingPaused( iSendingPaused );
+        iPauseCs.Signal();
+
+        iQueueCs.Wait();
+
+        // while switch is pending, always return NULL we don't want to let
+        // buffer float around
+        if( iSwitchPending || sendingPaused )
+            {
+            iQueueCs.Signal();
+            __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL(): Switch pending or sending paused -> returning NULL"), RThread().Id().operator TUint()));
+            return 0;
+            }
+
+        // If no buffers in free (FillBufferL is called) queue -> return NULL
+        if( !iFreeQueue.Count() )
+            {
+            iQueueCs.Signal();
+            __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL(): NO free buffers -> returning NULL"), RThread().Id().operator TUint()));
+            return 0;
+            }
+        // Otherwise get first buffer
+        CVSMMFDataBuffer* temp = iFreeQueue[ 0 ];
+        // Move to active (BufferFilledL is called) queue if requested
+        if( aRemove )
+            {
+            iFreeQueue.Remove( 0 );
+            TInt err = iActiveQueue.Append( temp );
+            if ( err != KErrNone )
+                {
+                iQueueCs.Signal();
+                User::Leave( err );
+                }
+            }
+        iQueueCs.Signal();
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL() returning [$%x]"), RThread().Id().operator TUint(), temp));
+        return temp;
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::GetBufferL(): blocked, returning [$%08x]"), RThread().Id().operator TUint(), 0));
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::FreeBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSDataSourceImp::FreeBufferL( CVSMMFDataBuffer* aBuffer )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FreeBufferL() >>"), RThread().Id().operator TUint()));
+    iQueueCs.Wait();
+    TInt err = FreeBufferNoWait( aBuffer );
+    iQueueCs.Signal();
+    User::LeaveIfError( err );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FreeBufferL() <<"), RThread().Id().operator TUint()));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVSDataSourceImp::FreeBufferNoWait( CVSMMFDataBuffer* aBuffer )
+// -----------------------------------------------------------------------------
+//
+TInt CVSDataSourceImp::FreeBufferNoWait( CVSMMFDataBuffer* aBuffer )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FreeBufferNoWait() >>"), RThread().Id().operator TUint()));
+
+    // Append buffer into free (FillBufferL is called) queue
+    TInt err( KErrNone );
+
+    // Try finding buffer from active (BufferFilledL is called) queue
+    TInt actIdx = iActiveQueue.Find( aBuffer );
+
+    // If it is found, remove it from there
+    if( actIdx != KErrNotFound )
+        {
+        iActiveQueue.Remove( actIdx );
+        TRAP( err, aBuffer->ReleaseL() );
+        if( err != KErrNone )
+            {
+            return err;
+            }
+        }
+
+    if( iFreeQueue.Find( aBuffer ) == KErrNotFound )
+        {
+        err = iFreeQueue.Append( aBuffer );
+        }
+
+#ifdef _DEBUG
+    TBuf<256> b;
+    TInt i;
+    b = _L("Active: ");
+    for( i = 0; i < iActiveQueue.Count(); i++ )
+        {
+        if( i > 0 )
+            {
+            b.Append( _L(", ") );
+            }
+        TBuf<16> b1;
+        b1.Format( _L("[$%08x]"), iActiveQueue[i] );
+        b.Append( b1 );
+        }
+    RDebug::Print( b );
+
+    b = _L("Free  : ");
+    for( i = 0; i < iFreeQueue.Count(); i++ )
+        {
+        if( i > 0 )
+            {
+            b.Append( _L(", ") );
+            }
+        TBuf<16> b1;
+        b1.Format( _L("[$%08x]"), iFreeQueue[i] );
+        b.Append( b1 );
+        }
+    RDebug::Print( b );
+#endif
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataSourceImp::FreeBufferNoWait() <<"), RThread().Id().operator TUint()));
+
+    return err;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSMMFDataBuffer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,343 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <ecam.h>
+#include <e32debug.h>
+#include "CVSMMFDataBuffer.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ CVSMMFDataBuffer ===============================
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSMMFDataBuffer* CVSMMFDataBuffer::NewL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NewL() >>"), RThread().Id().operator TUint()));
+    CVSMMFDataBuffer* self = new ( ELeave ) CVSMMFDataBuffer;
+    CleanupStack::PushL(self);
+    self->ConstructL( KMMFDataBufferDefaultBufferSize );
+    CleanupStack::Pop(); // self
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NewL <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSMMFDataBuffer* CVSMMFDataBuffer::NewL( TInt aMaxBufferSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NewL() >>"), RThread().Id().operator TUint()));
+    CVSMMFDataBuffer* self = new ( ELeave ) CVSMMFDataBuffer;
+    CleanupStack::PushL(self);
+    self->ConstructL( aMaxBufferSize );
+    CleanupStack::Pop(); // self
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NewL <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::~CVSMMFDataBuffer
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVSMMFDataBuffer::~CVSMMFDataBuffer()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::~CVSMMFDataBuffer() >>"), RThread().Id().operator TUint()));
+    delete[] iData;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::~CVSMMFDataBuffer() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::ReAllocBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::ReAllocBufferL( TInt aMaxBufferSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::ReAllocBufferL() >>"), RThread().Id().operator TUint()));
+    if ( !iIsBufferSet )
+        {
+        TUint8* tmp = new (ELeave) TUint8[aMaxBufferSize];
+        delete[] iData;
+        iData = tmp;
+        iPtr.Set( iData, 0, aMaxBufferSize );
+        iMaxBufferSize = aMaxBufferSize;
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::ReAllocBufferL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::NeedsReset
+// -----------------------------------------------------------------------------
+//
+TBool CVSMMFDataBuffer::NeedsReset() const
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::NeedsReset() ><"), RThread().Id().operator TUint()));
+    return iNeedsReset;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetNeedsReset
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetNeedsReset( TBool aNeedsReset )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetNeedsReset() >>"), RThread().Id().operator TUint()));
+    iNeedsReset = aNeedsReset;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetNeedsReset() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::Reset
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::Reset()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Reset() >>"), RThread().Id().operator TUint()));
+    iPtr.Zero();
+    SetNeedsReset( EFalse );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Reset() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::Data
+// -----------------------------------------------------------------------------
+//
+TDes8& CVSMMFDataBuffer::Data()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Data() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Data() <<"), RThread().Id().operator TUint()));
+    return iPtr;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::Data
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CVSMMFDataBuffer::Data() const
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Data() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Data() <<"), RThread().Id().operator TUint()));
+    return iPtr;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetStatus
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetStatus( TBufferStatus aStatus )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetStatus() >>"), RThread().Id().operator TUint()));
+    CMMFBuffer::SetStatus( aStatus );
+    if ( iStatus == EBeingFilled )
+        {
+        Reset();
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetStatus() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetRequestSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetRequestSizeL( TInt aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetRequestSizeL() >>"), RThread().Id().operator TUint()));
+    if ( aSize < 0 )
+        {
+        User::Leave( KErrUnderflow );
+        }
+    else if ( aSize > iPtr.MaxLength() )
+        {
+        User::Leave( KErrOverflow );
+        }
+    else
+        {
+        iRequestSize = aSize;
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetRequestSizeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::BufferSize
+// -----------------------------------------------------------------------------
+//
+TUint CVSMMFDataBuffer::BufferSize() const
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::BufferSize() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::BufferSize() <<"), RThread().Id().operator TUint()));
+    return iPtr.Length();
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetPosition
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetPosition( TUint aPosition )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetPosition() >>"), RThread().Id().operator TUint()));
+    if ( aPosition <= (TUint)iPtr.Length() )
+        {
+        iPosition = aPosition;
+        }
+    else
+        {
+        iPosition = (TUint)iPtr.Length();   // Tried to position beyond end of
+                                            // data
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetPosition() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetFrameBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetFrameBufferL( MFrameBuffer* aFrameBuffer )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetFrameBuffer() >>"), RThread().Id().operator TUint()));
+    iFrameBuffer = aFrameBuffer;
+    //Buffer is valid
+    iIsBufferSet = ETrue;
+    if ( aFrameBuffer == NULL )
+        {
+        iPtr.Set( iData, 0, iMaxBufferSize );
+        }
+    else
+        {
+        Reset();
+        TPtrC8 ptr( *iFrameBuffer->DataL( 0 ) );
+        iPtr.Set((TUint8*)ptr.Ptr(), ptr.Size(), ptr.Size());
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetFrameBuffer() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetFrameBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetFrameBufferL( MCameraBuffer* aCameraBuffer )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetFrameBuffer() >>"), RThread().Id().operator TUint()));
+    iCameraBuffer = aCameraBuffer;
+    //Buffer is valid
+    iIsBufferSet = ETrue;
+    if ( aCameraBuffer == NULL )
+        {
+        iPtr.Set( iData, 0, iMaxBufferSize );
+        }
+    else
+        {
+        Reset();
+        // Take the latest frame data from buffer should be always 0,
+        // but if buffer contains more than 1 frame could be something else
+        TPtrC8 ptr( *iCameraBuffer->DataL( iCameraBuffer->NumFrames() - 1 ) );
+        iPtr.Set((TUint8*)ptr.Ptr(), ptr.Size(), ptr.Size());
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetFrameBuffer() <<"), RThread().Id().operator TUint()));
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::ReleaseL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::ReleaseL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Release() >>"), RThread().Id().operator TUint()));
+    if( iFrameBuffer )
+        {
+        iFrameBuffer->Release();
+        SetFrameBufferL( (MFrameBuffer*)NULL );
+        }
+    else if( iCameraBuffer )
+    	{
+    	iCameraBuffer->Release();
+        SetFrameBufferL( (MCameraBuffer*)NULL );
+    	}
+    else
+        {
+        if ( iPtr.Ptr() != iData )
+            {
+            iPtr.Set( iData, 0, iMaxBufferSize );
+            }
+        if( NeedsReset() )
+            {
+            Reset();
+            }
+        }
+
+    //Buffer is no longer valid
+    iIsBufferSet = EFalse;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::Release() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::SetBufferOffset
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::SetBufferOffset( TInt aOffset )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetBufferOffset() >>"), RThread().Id().operator TUint()));
+    if ( !iIsBufferSet )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetBufferOffset(): Length = %d, Offset = %d"), RThread().Id().operator TUint(), iPtr.Length(), aOffset));
+        iPtr.Set( iData + aOffset, iPtr.Length() - aOffset, iMaxBufferSize );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::SetBufferOffset() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::CVSMMFDataBuffer
+// -----------------------------------------------------------------------------
+//
+CVSMMFDataBuffer::CVSMMFDataBuffer() :
+    CMMFDataBuffer( KUidMmfDataBuffer ), iPtr(0,0,0), iIsBufferSet(EFalse)
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::CVSMMFDataBuffer() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::CVSMMFDataBuffer() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSMMFDataBuffer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVSMMFDataBuffer::ConstructL( TInt aMaxBufferSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::ConstructL() >>"), RThread().Id().operator TUint()));
+    iData = new (ELeave) TUint8[aMaxBufferSize];
+    iPtr.Set( iData, 0, aMaxBufferSize );
+    iMaxBufferSize = aMaxBufferSize;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSMMFDataBuffer::ConstructL() <<"), RThread().Id().operator TUint()));
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSOnboardCameraDataProvider.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1007 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <fbs.h>
+#include "CVSOnboardCameraDataProvider.h"
+#include "CVSDataSourceImp.h"
+#include "VSPanic.h"
+#include "CVSMMFDataBuffer.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+const TInt KQCIFWidth = 176;
+const TInt KQCIFHeight = 144;
+
+// MACROS
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================ CProviderErrorNotifierAO =======================
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::NewL
+// -----------------------------------------------------------------------------
+//
+CProviderErrorNotifierAO* CProviderErrorNotifierAO::NewL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NewL() >>"), RThread().Id().operator TUint()));
+    CProviderErrorNotifierAO* self = new ( ELeave ) CProviderErrorNotifierAO();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NewL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::~CProviderErrorNotifierAO
+// -----------------------------------------------------------------------------
+//
+CProviderErrorNotifierAO::~CProviderErrorNotifierAO()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::~CProviderErrorNotifierAO() >>"), RThread().Id().operator TUint()));
+    Cancel();
+    iCS.Close();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::~CProviderErrorNotifierAO() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::NotifyError
+// -----------------------------------------------------------------------------
+//
+void CProviderErrorNotifierAO::NotifyError(
+    MVSDataProviderObserver* aObserver,
+    TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NotifyError() >>"), RThread().Id().operator TUint()));
+    iCS.Wait();
+    iObserver = aObserver;
+    iError = aError;
+    TRequestStatus* statusP = &iStatus;
+    RThread thread;
+    if( thread.Open( iThreadId ) == KErrNone )
+        {
+        *statusP = KRequestPending;
+        thread.RequestComplete( statusP, KErrNone );
+        thread.Close();
+        }
+    else
+        {
+        Panic( EVSPanicThreadOpenFailure );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NotifyError() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::CProviderErrorNotifierAO
+// -----------------------------------------------------------------------------
+//
+CProviderErrorNotifierAO::CProviderErrorNotifierAO() :
+    CActive( EPriorityNormal )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::CProviderErrorNotifierAO() >>"), RThread().Id().operator TUint()));
+    CActiveScheduler::Add( this );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::CProviderErrorNotifierAO() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CProviderErrorNotifierAO::ConstructL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::ConstructL() >>"), RThread().Id().operator TUint()));
+    iCS.CreateLocal();
+    iThreadId = RThread().Id();
+    iStatus = KRequestPending;
+    SetActive();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::ConstructL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CProviderErrorNotifierAO::DoCancel()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::DoCancel() >>"), RThread().Id().operator TUint()));
+    if( iStatus == KRequestPending )
+        {
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrCancel );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::DoCancel() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CProviderErrorNotifierAO::RunL
+// -----------------------------------------------------------------------------
+//
+void CProviderErrorNotifierAO::RunL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::RunL() >>"), RThread().Id().operator TUint()));
+    TInt err = iStatus.Int();
+    if ( err == KErrCancel )
+        {
+        return;
+        }
+    if ( iObserver != NULL )
+        {
+        iObserver->vsProviderError( iError );
+        }
+    iStatus = KRequestPending;
+    SetActive();
+    iCS.Signal();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::RunL() <<"), RThread().Id().operator TUint()));
+    }
+
+// ============================ CSyncCameraReserve =============================
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::CSyncCameraReserve
+// -----------------------------------------------------------------------------
+//
+CSyncCameraReserve::CSyncCameraReserve() : CActive( EPriorityNormal )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::CSyncCameraReserve() >>"), RThread().Id().operator TUint()));
+    CActiveScheduler::Add( this );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::CSyncCameraReserve() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::StartL
+// -----------------------------------------------------------------------------
+//
+void CSyncCameraReserve::StartL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::StartL() >>"), RThread().Id().operator TUint()));
+    SetActive();
+    iStatus = KRequestPending;
+    iWait.Start();
+    User::LeaveIfError( iStatus.Int() );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::StartL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::NewL
+// -----------------------------------------------------------------------------
+//
+CSyncCameraReserve* CSyncCameraReserve::NewL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::NewL() >>"), RThread().Id().operator TUint()));
+    CSyncCameraReserve* self = new ( ELeave ) CSyncCameraReserve();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::NewL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CSyncCameraReserve::DoCancel()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::DoCancel() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::DoCancel() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CSyncCameraReserve::RunL
+// -----------------------------------------------------------------------------
+//
+void CSyncCameraReserve::RunL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::RunL() >>"), RThread().Id().operator TUint()));
+    iWait.AsyncStop();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::RunL() <<"), RThread().Id().operator TUint()));
+    }
+
+// ============================ CVSOnboardCameraDataProvider ===================
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider(
+    MVSDataProviderObserver* aObserver, MVSBufferPool* aPool ) :
+        CVSCameraDataProvider( aObserver, aPool ),iCameraLost( EFalse )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider() >>"), RThread().Id().operator TUint()));
+    iState = EStopped;
+    iFormat = CCamera::EFormatYUV420Planar;
+    iDublicatedBitmap = new CFbsBitmap();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider
+// -----------------------------------------------------------------------------
+//
+CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider() >>"), RThread().Id().operator TUint()));
+    delete iDublicatedBitmap;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::PrimeL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::PrimeL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::PrimeL() >>"), RThread().Id().operator TUint()));
+
+    const TBool primeable( iCameraDuplicate && ( iState == EStopped ) );
+
+    if ( !primeable )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    iAsynchronousReserveIssued = EFalse;
+    iCameraDuplicate->Reserve();
+    iSyncReserve->StartL(); // Returns when from ReserveComplete() has been
+                            // signalled iSyncReserve
+
+    // Reserve ok, prepare capture next
+    iCameraDuplicate->PrepareVideoCaptureL(
+        iFormat,
+        iFrameSizeIndex,
+        iFrameRateIndex,
+        2,
+        1 );
+
+    SetVideoFrameSizeL( TSize( KQCIFWidth, KQCIFHeight ) );
+
+    iState = EPrimed;
+
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::PrimeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::FillBufferL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::FillBufferL(
+    CMMFBuffer* /*aBuffer*/,
+    MVTVideoSink* /*aConsumer*/,
+    TMediaId /*aMediaId*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FillBufferL() >>"), RThread().Id().operator TUint()));
+    if ( iState != EPlaying )
+        {
+        User::Leave( KErrNotReady );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FillBufferL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::BufferEmptiedL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::BufferEmptiedL() >>"), RThread().Id().operator TUint()));
+    User::Leave( KErrNotSupported );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::BufferEmptiedL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourceThreadLogon
+// -----------------------------------------------------------------------------
+//
+TInt CVSOnboardCameraDataProvider::SourceThreadLogon(
+    MAsyncEventHandler& aEventHandler )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogon() >>"), RThread().Id().operator TUint()));
+    TInt err = KErrNone;
+    iEventHandler = &aEventHandler;
+    if ( iCameraDuplicate )
+        {
+        Panic( EVSPanicProviderAlreadyInitialized );
+        }
+    TRAP( err, iCameraDuplicate =
+        CCamera::NewDuplicate2L( (MCameraObserver2&)*this, iCameraHandle) );
+
+    if ( err != KErrNone )
+        {
+        TRAP( err, iCameraDuplicate =
+        CCamera::NewDuplicateL( (MCameraObserver&)*this, iCameraHandle) );
+        if (err != KErrNone)
+        	{
+        	return err;
+        	}
+        }
+    iCameraLost = EFalse;
+
+    TCameraInfo info;
+    iCameraDuplicate->CameraInfo( info );
+    if ( !(info.iOptionsSupported & TCameraInfo::EVideoCaptureSupported) )
+        {
+        delete iCameraDuplicate;
+        iCameraDuplicate = NULL;
+        return KErrNotSupported;
+        }
+    if ( iSyncReserve == NULL )
+        {
+        TRAP( err, iSyncReserve = CSyncCameraReserve::NewL() );
+        if ( err != KErrNone )
+            {
+            delete iCameraDuplicate;
+            iCameraDuplicate = NULL;
+            }
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogon() <<"), RThread().Id().operator TUint()));
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourceThreadLogoff
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourceThreadLogoff()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogoff() >>"), RThread().Id().operator TUint()));
+    delete iCameraDuplicate;
+    iCameraDuplicate = NULL;
+    iState = EStopped;
+    delete iSyncReserve;
+    iSyncReserve = NULL;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogoff() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourcePrimeL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourcePrimeL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePrimeL() >>"), RThread().Id().operator TUint()));
+    const TBool primeable( iCameraDuplicate && ( iState == EStopped ) );
+    if ( !primeable )
+        {
+        User::Leave( KErrNotReady );
+        }
+    iAsynchronousReserveIssued = ETrue;
+    iCameraDuplicate->Reserve();
+    User::Leave( KRequestPending );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePrimeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourcePlayL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourcePlayL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePlayL() >>"), RThread().Id().operator TUint()));
+    if ( iState != EPrimed )
+        {
+        User::Leave( KErrNotReady );
+        }
+    ResetStartTime();
+    iCameraDuplicate->StartVideoCapture();
+    iState = EPlaying;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePlayL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourcePauseL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourcePauseL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePauseL() >>"), RThread().Id().operator TUint()));
+    if ( iState != EPlaying )
+        {
+        return;
+        }
+    iCameraDuplicate->StopVideoCapture();
+    iState = EPrimed;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePauseL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SourceStopL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SourceStopL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceStopL() >>"), RThread().Id().operator TUint()));
+    if ( iState == EStopped )
+        {
+        return;
+        }
+    SourcePauseL();
+    iCameraDuplicate->Release();
+    iState = EStopped;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceStopL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SetFormatL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SetFormatL( const TDesC8& aFormat )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFormatL() >>"), RThread().Id().operator TUint()));
+    if ( !iCameraDuplicate )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    TCameraInfo info;
+    iCameraDuplicate->CameraInfo( info );
+    if ( aFormat == KVtVideoMIMETypeYUV420 )
+        {
+        if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+            {
+            iFormat = CCamera::EFormatYUV420Planar;
+            }
+        else
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFormatL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SetFrameRateL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SetFrameRateL( TReal32 aFrameRate )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFrameRateL() >>"), RThread().Id().operator TUint()));
+    if ( !iCameraDuplicate )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    TCameraInfo info;
+    iCameraDuplicate->CameraInfo( info );
+    TBool found = EFalse;
+    for ( TInt i = 0; i < info.iNumVideoFrameRatesSupported; i++ )
+        {
+        TReal32 rate = 0;
+        iCameraDuplicate->EnumerateVideoFrameRates(
+            rate,
+            i,
+            iFormat,
+            iFrameSizeIndex );
+        if ( rate == aFrameRate )
+            {
+            iFrameRateIndex = i;
+            found = ETrue;
+            break;
+            }
+        }
+    if ( !found )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFrameRateL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::SetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::SetVideoFrameSizeL( const TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetVideoFrameSizeL() >>"), RThread().Id().operator TUint()));
+    if ( !iCameraDuplicate )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    TCameraInfo info;
+    iCameraDuplicate->CameraInfo( info );
+    TBool found = EFalse;
+    for ( TInt i = 0; i < info.iNumVideoFrameSizesSupported; i++ )
+        {
+        TSize size;
+        iCameraDuplicate->EnumerateVideoFrameSizes( size, i, iFormat );
+        if ( size == aSize )
+            {
+            iFrameSizeIndex = i;
+            iFrameSize = size;
+            found = ETrue;
+            break;
+            }
+        }
+    if ( !found )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::GetVideoFrameSizeL
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::GetVideoFrameSizeL( TSize& aSize ) const
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::GetVideoFrameSizeL() >>"), RThread().Id().operator TUint()));
+    aSize = iFrameSize;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::GetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::ReserveComplete
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::ReserveComplete( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ReserveComplete() >>"), RThread().Id().operator TUint()));
+    if ( !iReserverComplete )
+        {
+        if ( aError == KErrNone )
+            {
+            iReserverComplete = ETrue;
+            Camera().PowerOn();
+            }
+        else
+            {
+            NotifyError( aError );
+            }
+        }
+    else
+        {
+        if( iAsynchronousReserveIssued )
+            {
+            iAsynchronousReserveIssued = EFalse;
+
+            if( aError == KErrNone && iCameraDuplicate )
+                {
+                // Reserve ok, prepare capture next
+                TRAP(
+                     aError,
+                     iCameraDuplicate->PrepareVideoCaptureL(
+                     iFormat,
+                     iFrameSizeIndex,
+                     iFrameRateIndex,
+                     2,
+                     1 ) );
+
+                if( aError == KErrNone )
+                    {
+                    TRAP( aError, SetVideoFrameSizeL( TSize( KQCIFWidth, KQCIFHeight ) ) );
+
+                    if( aError == KErrNone )
+                        {
+                        // Everything ok in PrimeL()
+                        iState = EPrimed;
+                        }
+                    }
+                }
+            TMMFEvent event( TUid::Uid( KVtUidDataSrcPrime ), aError );
+            iEventHandler->SendEventToClient( event );
+            }
+        else
+            {
+            TRequestStatus* statusP = &iSyncReserve->iStatus;
+            User::RequestComplete( statusP, aError );
+            }
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ReserveComplete() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::FrameBufferReady
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::FrameBufferReady(
+    MFrameBuffer* aFrameBuffer,
+    TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FrameBufferReady() >>"), RThread().Id().operator TUint()));
+
+    iFreezeCS.Wait();
+
+    if ( aError == KErrNone )
+        {
+        if( iFreezePendingFlags & EVideoFrameFreezePending )
+            {
+            FreezeFrame( aFrameBuffer );
+            }
+
+        CVSMMFDataBuffer* buffer = NULL;
+
+        TRAPD( err, buffer = BufferPool().GetBufferL( ETrue ) );
+
+        if( err == KErrNone )
+            {
+            if ( buffer )
+                {
+                MFrameBuffer* frameBufferToBeUsed = aFrameBuffer;
+
+                if( IsFrozen() && !( iFreezePendingFlags & EVideoFrameFreezePending ) )
+                    {
+                    iFrozenFrame->CopyProperties( aFrameBuffer );
+                    aFrameBuffer->Release();
+                    frameBufferToBeUsed = iFrozenFrame;
+                    }
+
+                TRAP( err, buffer->SetFrameBufferL( frameBufferToBeUsed ) );
+
+                if ( err != KErrNone )
+                    {
+                    TInt leaveCode = KErrNone;
+                    TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+                    }
+                else
+                    {
+                    buffer->SetTimeToPlay( TimeToPlay() );
+                    buffer->SetFrameNumber( aFrameBuffer->iIndexOfFirstFrameInBuffer );
+                    TRAP( err, Consumer()->BufferFilledL( buffer ) );
+                    if ( err != KErrNone )
+                        {
+                        TInt leaveCode = KErrNone;
+                        TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+                        }
+                    }
+                }
+            else
+                {
+                aFrameBuffer->Release();
+                }
+            }
+
+        if( err != KErrNone )
+            {
+            NotifyError( err );
+            }
+        }
+    else
+        {
+        NotifyError( aError );
+        }
+
+    iFreezeCS.Signal();
+
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FrameBufferReady() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::GetVideoFrameSize
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::GetVideoFrameSize(
+    TSize& aSize,
+    TInt aSizeIndex,
+    const TDesC8& aFormat )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameSize() >>"), RThread().Id().operator TUint()));
+    TCameraInfo info;
+    Camera().CameraInfo( info );
+    if ( aFormat == KVtVideoMIMETypeYUV420 )
+        {
+        if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+            {
+            Camera().EnumerateVideoFrameSizes( aSize, aSizeIndex, CCamera::EFormatYUV420Planar );
+            }
+        else
+            {
+            aSize.SetSize( 0, 0 );
+            }
+        }
+    else
+        {
+        aSize.SetSize( 0, 0 );
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameSize() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::GetVideoFrameRate
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::GetVideoFrameRate(
+    TReal32& aRate,
+    TInt aRateIndex,
+    const TDesC8& aFormat,
+    const TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameRate() >>"), RThread().Id().operator TUint()));
+    TCameraInfo info;
+    Camera().CameraInfo( info );
+    if ( aFormat == KVtVideoMIMETypeYUV420 )
+        {
+        if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+            {
+            TBool found = EFalse;
+            for ( TInt i = 0; i < info.iNumVideoFrameSizesSupported; i++ )
+                {
+                TSize size;
+                Camera().EnumerateVideoFrameSizes(
+                    size,
+                    i,
+                    CCamera::EFormatYUV420Planar );
+                if ( size == aSize )
+                    {
+                    Camera().EnumerateVideoFrameRates(
+                        aRate,
+                        aRateIndex,
+                        CCamera::EFormatYUV420Planar,
+                        i );
+                    found = ETrue;
+                    break;
+                    }
+                }
+            if ( !found )
+                {
+                aRate = 0.0;
+                }
+            }
+        else
+            {
+            aRate = 0.0;
+            }
+        }
+    else
+        {
+        aRate = 0.0;
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameRate() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::FreezeFrame
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::FreezeFrame( MFrameBuffer* aFrameBuffer )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() >>"), RThread().Id().operator TUint()));
+
+    TRAPD( error, iFrozenFrame->CopyFrameL( aFrameBuffer ) );
+
+    if( error != KErrNone )
+        {
+        Observer().vsProviderError( error );
+        }
+    else
+        {
+        iFreezePendingFlags &= ~EVideoFrameFreezePending;
+        }
+
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() <<"), RThread().Id().operator TUint()));
+    }
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::FreezeFrame
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::FreezeFrame( MCameraBuffer* aCameraBuffer )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() >>"), RThread().Id().operator TUint()));
+
+    TRAPD( error, iFrozenFrame->CopyFrameL( aCameraBuffer ) );
+
+    if( error != KErrNone )
+        {
+        Observer().vsProviderError( error );
+        }
+    else
+        {
+        iFreezePendingFlags &= ~EVideoFrameFreezePending;
+        }
+
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::HandleEvent
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::HandleEvent( const TECAMEvent& aEvent )
+	{
+	__IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() event %d>>"),
+    	RThread().Id().operator TUint(), aEvent.iEventType  ));
+  __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() iErrorCode %d>"),
+    	RThread().Id().operator TUint(), aEvent.iErrorCode  ));
+  //Needs to handled first
+  if( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+		{
+		iCameraLost = ETrue;
+		__IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() Camera lost>>"),
+    		RThread().Id().operator TUint()));
+		NotifyError( KVsErrCameraNoLongerReserved );
+		}
+  //Do not care errors that occures if camera is lost
+  if ( aEvent.iErrorCode != KErrNone  )
+			{
+			if ( iCameraLost )
+				{
+				__IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() Camera lost error<<"),
+				RThread().Id().operator TUint()));
+				return;
+				}
+			}
+	// Gets called twice for both threads
+	if ( aEvent.iEventType == KUidECamEventReserveComplete )
+		{
+		ReserveComplete( aEvent.iErrorCode );
+		}
+	else if( aEvent.iEventType == KUidECamEventPowerOnComplete  )
+		{
+		PowerOnComplete( aEvent.iErrorCode );
+		}
+	__IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::ViewFinderReady
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::ViewFinderReady( MCameraBuffer& aCameraBuffer,TInt aError )
+	{
+	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() error %d >>"), RThread().Id().operator TUint(), aError ));
+	// If error occures notify observer
+	if ( aError != KErrNone && !iCameraLost )
+		{
+		NotifyError( aError );
+		return;
+		}
+	// If camera has been lost do nothing
+  	// because event to indicate cameralost has come or is coming
+	else if ( iCameraLost )
+		{
+		__IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() Camera lost<<"),
+			RThread().Id().operator TUint()));
+		return;
+		}
+	// If there is more than 1 frame in buffer
+	// something has went wrong and error (-38) has occured
+	if ( aCameraBuffer.NumFrames() > 1 )
+		{
+		__IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() FRAMES [%d] IN BUFFER >>"),
+			RThread().Id().operator TUint(), aCameraBuffer.NumFrames()));
+		}
+
+	//Duplicate camera buffers the newest bitmap
+	//In case of error release buffer and notify observer
+	if ( !iDublicatedBitmap )
+		{
+		aCameraBuffer.Release();
+		NotifyError( KErrBadDescriptor );
+		return;
+		}
+	iDublicatedBitmap->BeginDataAccess();
+	TRAPD( err, iDublicatedBitmap->Duplicate( aCameraBuffer.BitmapL( aCameraBuffer.NumFrames() - 1 ).Handle() ) );
+	iDublicatedBitmap->EndDataAccess();
+	if( err != KErrNone )
+		{
+		aCameraBuffer.Release();
+		NotifyError( KErrBadDescriptor );
+		return;
+		}
+
+    // Send dublicated bitmap to UI
+    ViewFinderFrameReady( *iDublicatedBitmap );
+
+    //Release camera buffer for further usage
+    aCameraBuffer.Release();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() <<"),
+    	RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVSOnboardCameraDataProvider::VideoBufferReady
+// -----------------------------------------------------------------------------
+//
+void CVSOnboardCameraDataProvider::VideoBufferReady( MCameraBuffer& aCameraBuffer,TInt aError )
+	{
+	 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() >>"), RThread().Id().operator TUint()));
+
+    iFreezeCS.Wait();
+
+	// If there is more than 1 frame in buffer
+	// print it out
+	// calculate delta which indicates how many frames are skipped
+	TInt delta = 0;
+	if ( aCameraBuffer.NumFrames() > 1 )
+		{
+		__IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() FRAMES [%d] IN BUFFER >>"),
+			RThread().Id().operator TUint(), aCameraBuffer.NumFrames()));
+		delta = aCameraBuffer.NumFrames() - 1;
+		}
+
+    if ( aError == KErrNone )
+        {
+        if( iFreezePendingFlags & EVideoFrameFreezePending )
+            {
+            FreezeFrame( &aCameraBuffer );
+            }
+
+        CVSMMFDataBuffer* buffer = NULL;
+
+        TRAPD( err, buffer = BufferPool().GetBufferL( ETrue ) );
+
+        if( err == KErrNone )
+            {
+            if ( buffer )
+                {
+                MCameraBuffer* cameraBufferToBeUsed = &aCameraBuffer;
+
+                if( IsFrozen() && !( iFreezePendingFlags & EVideoFrameFreezePending ) )
+                    {
+                    iFrozenFrame->CopyProperties( &aCameraBuffer );
+                    ( &aCameraBuffer )->Release();
+                    cameraBufferToBeUsed = iFrozenFrame;
+                    }
+
+                TRAP( err, buffer->SetFrameBufferL( cameraBufferToBeUsed ) );
+
+                if ( err != KErrNone )
+                    {
+                    TInt leaveCode = KErrNone;
+                    TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+                    }
+                else
+                    {
+                    buffer->SetTimeToPlay( TimeToPlay() );
+                    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() iIndexOfFirstFrameInBuffer [%d]>>"),
+										RThread().Id().operator TUint(), aCameraBuffer.iIndexOfFirstFrameInBuffer + delta));
+                    buffer->SetFrameNumber( ( &aCameraBuffer )->iIndexOfFirstFrameInBuffer + delta );
+                    TRAP( err, Consumer()->BufferFilledL( buffer ) );
+                    if ( err != KErrNone )
+                        {
+                        TInt leaveCode = KErrNone;
+                        TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+                        }
+                    }
+                }
+            else
+                {
+                ( &aCameraBuffer )->Release();
+                }
+            }
+        else
+            {
+            NotifyError( err );
+            }
+        }
+	else
+    	{
+    	__IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() Camera lost"),
+			RThread().Id().operator TUint()));
+    	if ( !iCameraLost )
+    		{
+    		NotifyError( aError );
+    		}
+    	}
+    iFreezeCS.Signal();
+
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() <<"), RThread().Id().operator TUint()));
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/CVSStillImageDataProvider.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1190 @@
+/*
+* 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:  Video Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <bautils.h>
+#include <imageconversion.h>
+#include <cvtimageconverter.h>
+#include <rphcltserver.h>
+#include <cphcltimagehandler.h>
+#include <w32std.h>
+
+#include "CVSStillImageDataProvider.h"
+#include "CVSDataSourceImp.h"
+#include "VSPanic.h"
+#include "cvtimagebitmap.h"
+#include "CVSMMFDataBuffer.h"
+
+#include "cmultiframeprovider.h"
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+static const TInt KMinZoom = 0;
+static const TInt KMaxZoom = 0;
+static const TInt KMaxDigitalZoom = 0;
+static const TReal32 KMinZoomFactor = 0.0;
+static const TReal32 KMaxZoomFactor = 0.0;
+static const TReal32 KMaxDigitalZoomFactor = 1.0;
+static const TInt KNumVideoSizesSupported = 1;
+static const TInt KNumVideoFrameSizesSupported = 1;
+static const TInt KNumVideoFrameRatesSupported = 1;
+static const TInt KMaxFramesPerBufferSupported = 1;
+static const TInt KQcifWidth = 176;
+static const TInt KQcifHeight = 144;
+static const TReal32 KFrameRate = 15.0;
+static const TUint32 KVSViewFinderUpdateRate = 1000000/15; // 15 times per second
+
+// TYPE DEFINITIONS
+
+// Timer expired callback
+
+typedef void (CVSStillImageDataProvider::*TTimerElapsed) ();
+
+// INTERNAL CLASSES
+
+/**
+*  Timer class that calls given callback method when timer request has been
+*  completed. If the timer request is cancelled then callback will not be
+*  called.
+*
+*  @lib videosource.lib
+*/
+class CVSFrameRateTimer : public CTimer
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Static factory function to create instance of this class.
+        * @param "aRequester" ?description
+        * @exception Can leave with one of the system wide error codes.
+        * @return Pointer to new instance.
+        */
+        static CVSFrameRateTimer* NewL( CVSStillImageDataProvider* aRequester );
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * Starts timer request. When timer request has been completed given
+        * callback method will be called.
+        * @param "anInterval" Interval after which event is to occur,
+        * in microseconds.
+        * @param "aFunction" Callback method that will be called when timer
+        * request has been completed.
+        */
+        void After(
+            TTimeIntervalMicroSeconds32 anInterval,
+            TTimerElapsed aFunction  );
+
+    public: // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        ~CVSFrameRateTimer();
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // Constructors and destrcutor
+
+        /**
+        * Constructor.
+        * @param "aRequester" ?description
+        */
+        CVSFrameRateTimer( CVSStillImageDataProvider* aRequester );
+
+    private:    // New functions
+
+    private:    // Functions from base classes
+
+        /**
+        * From CActive. See CActive for description.
+        */
+        void RunL();
+
+    public: // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Pointer to requester (i.e. through which callback call will be made)
+        CVSStillImageDataProvider* iRequester; // not owned
+
+        // Pointer to callback method.
+        TTimerElapsed iFunction;
+    };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================ CVSFrameRateTimer ==============================
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::NewL( CVSStillImageDataProvider* aRequester )
+// -----------------------------------------------------------------------------
+//
+CVSFrameRateTimer* CVSFrameRateTimer::NewL(
+    CVSStillImageDataProvider* aRequester )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::NewL() >>"), RThread().Id().operator TUint()));
+    CVSFrameRateTimer* self = new (ELeave) CVSFrameRateTimer( aRequester );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::NewL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::CVSFrameRateTimer( CVSStillImageDataProvider* aRequester )
+// -----------------------------------------------------------------------------
+//
+CVSFrameRateTimer::CVSFrameRateTimer( CVSStillImageDataProvider* aRequester )
+: CTimer( EPriorityStandard ), iRequester( aRequester )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::CVSFrameRateTimer() >>"), RThread().Id().operator TUint()));
+    // Added to CActiveScheduler in CVSStillImageDataProvider::InitializeL
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::CVSFrameRateTimer() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::After(
+//  TTimeIntervalMicroSeconds32 anInterval, TTimerElapsed aFunction )
+// -----------------------------------------------------------------------------
+//
+void CVSFrameRateTimer::After(
+    TTimeIntervalMicroSeconds32 anInterval,
+    TTimerElapsed aFunction )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::After() >>"), RThread().Id().operator TUint()));
+    if ( iFunction == aFunction )
+    	{
+    	if ( !IsActive() )
+    		{
+      	iFunction = aFunction;
+    		CTimer::After( anInterval );
+    		}
+    	}
+    else
+    	{
+    	if ( !IsActive() )
+    		{
+      	iFunction = aFunction;
+    		CTimer::After( anInterval );
+    		}
+    	else
+    		{
+    			User::Panic(_L("VideoSource"),KErrGeneral);
+    		}
+    	}
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::After() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::~CVSFrameRateTimer()
+// -----------------------------------------------------------------------------
+//
+CVSFrameRateTimer::~CVSFrameRateTimer()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::~CVSFrameRateTimer() >>"), RThread().Id().operator TUint()));
+    Cancel();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::~CVSFrameRateTimer() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSFrameRateTimer::RunL()
+// -----------------------------------------------------------------------------
+//
+void CVSFrameRateTimer::RunL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::RunL() >>"), RThread().Id().operator TUint()));
+    if( iStatus.Int() == KErrNone )
+        {
+        (iRequester->*iFunction)();
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSFrameRateTimer::RunL() <<"), RThread().Id().operator TUint()));
+    }
+
+// ============================ CVSStillImageDataProvider ===============================
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::NewL(
+//  MVSDataProviderObserver* aObserver, MVSBufferPool* aPool )
+// -----------------------------------------------------------------------------
+//
+CVSStillImageDataProvider* CVSStillImageDataProvider::NewL(
+    MVSDataProviderObserver* aObserver,
+    MVSBufferPool* aPool )
+    {
+    __IF_DEBUG(Print(_L("VideoSource: [%d] CVSStillImageDataProvider::NewL() >>"), RThread().Id().operator TUint()));
+    CVSStillImageDataProvider* self =
+    new (ELeave) CVSStillImageDataProvider( aObserver, aPool );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __IF_DEBUG(Print(_L("VideoSource: [%d] CVSStillImageDataProvider::NewL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::~CVSStillImageDataProvider()
+// -----------------------------------------------------------------------------
+//
+CVSStillImageDataProvider::~CVSStillImageDataProvider()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::~CVSStillImageDataProvider() this %x >>"), RThread().Id().operator TUint(), this));
+    iFs.Close();
+    delete iVFTimer;
+    delete iActiveWait;
+    delete iViewer;
+    iFreezeCS.Close();
+    delete iScaled;
+    ReleaseYUVData();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::~CVSStillImageDataProvider() this %x <<"), RThread().Id().operator TUint(), this));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::InitializeL( const TDesC8& aInitParams )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::InitializeL( const TDesC8& aInitParams )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::InitializeL() >>"), RThread().Id().operator TUint()));
+
+    CommonInitializeL();
+
+    TPckgBuf< TVSStillImageDataProviderParams > pb;
+    pb.Copy( aInitParams );
+
+    iInitType = pb().iInitialize;
+    iPSState = EPSInitializing;
+
+    switch( pb().iInitialize )
+        {
+        /** Initialize from blank image */
+        case TVSStillImageDataProviderParams::EInitializeAsBlankImage:
+            BlankImageInitializeL();
+            break;
+
+        /** Initialize from General Settings */
+        case TVSStillImageDataProviderParams::EInitializeFromGeneralSettings:
+            GeneralSettingsInitializeL( EGSStillImage );
+            break;
+
+        /** Initilaize from General Settings*/
+        case TVSStillImageDataProviderParams::EInitializeAsDefaultStillImage:
+            GeneralSettingsInitializeL( EGSDefaultStillImage );
+            break;
+
+        /** Initialize from file */
+        case TVSStillImageDataProviderParams::EInitializeFromFile:
+            FileImageInitializeL( pb().iFileName );
+            break;
+        }
+
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::InitializeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CommonInitializeL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::CommonInitializeL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CommonInitializeL() >>"), RThread().Id().operator TUint()));
+    iVFTimer = CVSFrameRateTimer::NewL( this );
+    CActiveScheduler::Add( iVFTimer );
+    iActiveWait = new (ELeave) CVSActiveWait< CVSStillImageDataProvider > ( this );
+
+    //Create viewer
+    iViewer = CMultiframeProvider::NewL( this , iDisplayMode );
+    User::LeaveIfError( iFreezeCS.CreateLocal() );
+
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CommonInitializeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GeneralSettingsInitializeL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::GeneralSettingsInitializeL( const TGeneralSettingsImageType aType )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GeneralSettingsInitializeL() >>"), RThread().Id().operator TUint()));
+		iViewer->IniatializeGSL( aType );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GeneralSettingsInitializeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::BlankImageInitializeL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::BlankImageInitializeL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::BlankImageInitializeL() %x >>"), RThread().Id().operator TUint(), this));
+		iViewer->IniatializeBlankL();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::BlankImageInitializeL() %x <<"), RThread().Id().operator TUint(), this));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::FileImageInitializeL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::FileImageInitializeL( const TFileName& aFileName )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::FileImageInitializeL(): %S >>"), RThread().Id().operator TUint(), &aFileName ));
+		iViewer->InitializeL( &aFileName );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::FileImageInitializeL() %x <<"), RThread().Id().operator TUint(), this));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::DigitalZoomFactor() const
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::DigitalZoomFactor() const
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::DigitalZoomFactor() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::DigitalZoomFactor() <<"), RThread().Id().operator TUint()));
+    return KMaxDigitalZoom;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetDigitalZoomFactorL(
+//  TInt /*aDigitalZoomFactor*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetDigitalZoomFactorL(
+    TInt /*aDigitalZoomFactor*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SetDigitalZoomFactorL() >>"), RThread().Id().operator TUint()));
+    User::Leave( KErrNotSupported );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SetDigitalZoomFactorL() <<"), RThread().Id().operator TUint()));
+    }
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StartViewFinderBitmapsL( TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StartViewFinderBitmapsL( TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderBitmapsL() >>"), RThread().Id().operator TUint()));
+    __ASSERT_DEBUG( iPSState > EPSUninitialized,
+        Panic( EVSPanicProviderNotReady ) );
+    iVFState = EVFPlaying;
+    iViewer->ClearVFScalingTargetSize();
+    iTargetSize = aSize;
+    iViewer->SetVFScalingTargetSize( aSize );
+    iViewer->ScaleCopy( aSize, ETrue );
+    iViewer->IncreaseDataConsumer();
+    iViewer->NextFrame();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderBitmapsL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StartViewFinderBitmapsL(
+//  TSize& /*aSize*/, TRect& /*aClipRect*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StartViewFinderBitmapsL(
+    TSize& /*aSize*/,
+    TRect& /*aClipRect*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderBitmapsL() >>"), RThread().Id().operator TUint()));
+    User::Leave( KErrNotSupported );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderBitmapsL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StopViewFinder()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StopViewFinder()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StopViewFinder() >>"), RThread().Id().operator TUint()));
+    // Make sure scaler is cancelled (just in case!)
+    iViewer->ClearVFScalingTargetSize();
+    iViewer->DecreaseDataConsumer();
+    iViewer->SetVFStop();
+    // No double stopping..
+    if( iVFState != EVFStopped )
+        {
+        iVFState = EVFStopped;
+        iVFTimer->Cancel();
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StopViewFinder() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ViewFinderActive() const
+// -----------------------------------------------------------------------------
+//
+TBool CVSStillImageDataProvider::ViewFinderActive() const
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ViewFinderActive() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ViewFinderActive() <<"), RThread().Id().operator TUint()));
+    return ( iVFState == EVFPlaying );
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StartViewFinderDirectL(
+//  RWsSession& /*aWs*/, CWsScreenDevice& /*aScreenDevice*/,
+//  RWindowBase& /*aWindow*/, TRect& /*aScreenRect*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StartViewFinderDirectL(
+    RWsSession& /*aWs*/,
+    CWsScreenDevice& /*aScreenDevice*/,
+    RWindowBase& /*aWindow*/,
+    TRect& /*aScreenRect*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderDirectL() >>"), RThread().Id().operator TUint()));
+    User::Leave(KErrNotSupported);
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderDirectL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::StartViewFinderDirectL(
+//  RWsSession& /*aWs*/, CWsScreenDevice& /*aScreenDevice*/,
+//  RWindowBase& /*aWindow*/, TRect& /*aScreenRect*/, TRect& /*aClipRect*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::StartViewFinderDirectL(
+    RWsSession& /*aWs*/,
+    CWsScreenDevice& /*aScreenDevice*/,
+    RWindowBase& /*aWindow*/,
+    TRect& /*aScreenRect*/,
+    TRect& /*aClipRect*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderDirectL() >>"), RThread().Id().operator TUint()));
+    User::Leave(KErrNotSupported);
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::StartViewFinderDirectL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ProviderInfo( TVSDataProviderInfo& aInfo )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ProviderInfo( TVSDataProviderInfo& aInfo )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ProviderInfo() >>"), RThread().Id().operator TUint()));
+    Mem::FillZ( &aInfo, sizeof( aInfo ) );
+    aInfo.iHardwareVersion = TVersion( 0, 0, 0 );
+    aInfo.iSoftwareVersion = TVersion( 0, 0, 0 );
+    aInfo.iOrientation = TCameraInfo::EOrientationUnknown;
+    aInfo.iOptionsSupported = TCameraInfo::EViewFinderBitmapsSupported    |
+                              TCameraInfo::EVideoCaptureSupported;
+    aInfo.iFlashModesSupported = CCamera::EFlashNone;
+    aInfo.iExposureModesSupported = CCamera::EExposureAuto;
+    aInfo.iWhiteBalanceModesSupported = CCamera::EWBAuto;
+    aInfo.iMinZoom = KMinZoom;
+    aInfo.iMaxZoom = KMaxZoom;
+    aInfo.iMaxDigitalZoom = KMaxDigitalZoom;
+    aInfo.iMinZoomFactor = KMinZoomFactor;
+    aInfo.iMaxZoomFactor = KMaxZoomFactor;
+    aInfo.iMaxDigitalZoomFactor = KMaxDigitalZoomFactor;
+    aInfo.iImageFormatsSupported = CCamera::EFormatFbsBitmapColor64K |
+                                   CCamera::EFormatFbsBitmapColor16M;
+    aInfo.iNumVideoFrameSizesSupported = KNumVideoSizesSupported;
+    aInfo.iNumVideoFrameSizesSupported = KNumVideoFrameSizesSupported;
+    aInfo.iNumVideoFrameRatesSupported = KNumVideoFrameRatesSupported;
+    aInfo.iVideoFrameFormatsSupported = CCamera::EFormatYUV420Planar;
+    aInfo.iMaxFramesPerBufferSupported = KMaxFramesPerBufferSupported;
+    aInfo.iFreezeSupported = EFalse;
+
+    aInfo.iSupportedColorTones =
+        CCamera::CCameraImageProcessing::EEffectNone;
+
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ProviderInfo() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetViewFinderMirrorL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetViewFinderMirrorL( TBool /*aMirror*/ )
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ViewFinderMirror
+// -----------------------------------------------------------------------------
+//
+TBool CVSStillImageDataProvider::ViewFinderMirror() const
+    {
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::FreezeL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::FreezeL()
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::UnfreezeL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::UnfreezeL()
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::IsFrozen
+// -----------------------------------------------------------------------------
+//
+TBool CVSStillImageDataProvider::IsFrozen() const
+    {
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::PrimeL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::PrimeL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::PrimeL() &%x >>"), RThread().Id().operator TUint(), this));
+    SourcePrimeL();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::PrimeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::FillBufferL(
+//  CMMFBuffer* aBuffer, MVTVideoSink* aConsumer, TMediaId aMediaId )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::FillBufferL(
+    CMMFBuffer* /*aBuffer*/,
+    MVTVideoSink* /*aConsumer*/,
+    TMediaId /*aMediaId*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::FillBufferL() &%x >>"), RThread().Id().operator TUint(),this));
+    if ( iPSState != EPSPlaying )
+        {
+        User::Leave( KErrNotReady );
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::FillBufferL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::BufferEmptiedL() >>"), RThread().Id().operator TUint()));
+    User::Leave( KErrNotSupported );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::BufferEmptiedL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourceThreadLogon(
+//  MAsyncEventHandler& /*aEventHandler*/ )
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::SourceThreadLogon(
+    MAsyncEventHandler& /*aEventHandler*/ )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceThreadLogon() &%x >>"), RThread().Id().operator TUint(),this));
+    __ASSERT_DEBUG( iPSState > EPSUninitialized,
+        Panic( EVSPanicProviderNotReady ) );
+    TRAPD( err, CreateProtoTimerL() );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceThreadLogon() <<"), RThread().Id().operator TUint()));
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourceThreadLogoff()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourceThreadLogoff()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceThreadLogoff() &%x >>"), RThread().Id().operator TUint(),this));
+    ReleaseProtoTimer();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceThreadLogoff() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourcePrimeL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourcePrimeL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePrimeL() &%x >>"), RThread().Id().operator TUint(),this));
+    iPSState = EPSPrimed;
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePrimeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourcePlayL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourcePlayL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePlayL() &%x  >>"), RThread().Id().operator TUint(),this));
+    iPSState = EPSPlaying;
+    iFrameCount = 0;
+    ResetStartTime();
+    iViewer->IncreaseDataConsumer();
+    iProtoTimer->After( iProtoUpdateRate, &CVSStillImageDataProvider::ProtoTimer );
+    iViewer->NextFrame();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePlayL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourcePauseL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourcePauseL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePauseL() &%x >>"), RThread().Id().operator TUint(),this));
+    if ( iProtoTimer != NULL )
+    	{
+    	iProtoTimer->Cancel();
+    	}
+    iPSState = EPSPrimed;
+    iViewer->DecreaseDataConsumer();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourcePauseL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SourceStopL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SourceStopL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceStopL() &%x >>"), RThread().Id().operator TUint(),this));
+    if ( iProtoTimer != NULL )
+    	{
+    	iProtoTimer->Cancel();
+    	}
+    iPSState = EPSStopped;
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SourceStopL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetFormatL( const TDesC8& aFormat )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetFormatL( const TDesC8& aFormat )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetFormatL() &%x >>"), RThread().Id().operator TUint(),this));
+    if ( aFormat != KVtVideoMIMETypeYUV420 )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetFormatL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetFrameRateL( TReal32 aFrameRate )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetFrameRateL( TReal32 aFrameRate )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetFrameRateL() &%x >>"), RThread().Id().operator TUint(),this));
+    if ( aFrameRate != KFrameRate )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    iProtoUpdateRate = static_cast<TInt>( 1000000.0 / aFrameRate );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetFrameRateL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetVideoFrameSizeL( const TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetVideoFrameSizeL( const TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetVideoFrameSizeL() &%x >>"), RThread().Id().operator TUint(),this));
+    if( aSize != TSize( KQcifWidth, KQcifHeight ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::SetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetVideoFrameSizeL( TSize& aSize ) const
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::GetVideoFrameSizeL( TSize& aSize ) const
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::GetVideoFrameSizeL() &%x >>"), RThread().Id().operator TUint(),this));
+    aSize = TSize( KQcifWidth, KQcifHeight );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::GetVideoFrameSizeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::VFTimer()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::VFTimer()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::VFTimer() >>"), RThread().Id().operator TUint()));
+    if( iVFState == EVFPlaying )
+        {
+        Observer().vsViewFinderFrameReady( iVFBitmap->Bitmap() );
+        iVFTimer->After( KVSViewFinderUpdateRate, &CVSStillImageDataProvider::VFTimer );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::VFTimer() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ProtoTimer()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ProtoTimer()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer() this %x >>"), RThread().Id().operator TUint(), this));
+    iFrameCount++;
+    CVSMMFDataBuffer* buffer = NULL;
+    TRAPD( err, buffer = BufferPool().GetBufferL( ETrue ) );
+    if ( err != KErrNone )
+        {
+        NotifyError( err );
+        }
+    if( buffer )
+        {
+        buffer->SetFrameNumber( iFrameCount );
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer(): iFrameCount %d"), RThread().Id().operator TUint(), iFrameCount));
+        buffer->SetTimeToPlay( TimeToPlay() );
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer(): SetTimeToPlay() = $%08x:$%08x"), RThread().Id().operator TUint(), I64HIGH( buffer->TimeToPlay().Int64() ), I64LOW( buffer->TimeToPlay().Int64() ) ));
+       iFreezeCS.Wait();
+       buffer->Data() = *iYUVBuffer;
+       iFreezeCS.Signal();
+       TRAPD( err, Consumer()->BufferFilledL( buffer ) );
+       if( err != KErrNone )
+          {
+          TInt leaveCode = KErrNone;
+          TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) );
+          NotifyError( err );
+          }
+       }
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer(): GetBufferL() returned NULL"), RThread().Id().operator TUint()));
+        }
+    // Just to make sure that we're actually playing. We also check that
+    // iProtoTimer still exists BECAUSE BufferFilledL() may call
+    // SourceThreadLogoff() if a switch is pending
+    if( iProtoTimer && ( iPSState == EPSPlaying ) )
+        {
+        iProtoTimer->After( iProtoUpdateRate, &ProtoTimer );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ProtoTimer() this %x <<"), RThread().Id().operator TUint(), this));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CreateProtoTimerL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::CreateProtoTimerL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::CreateProtoTimerL() >>"), RThread().Id().operator TUint()));
+    iProtoTimer = CVSFrameRateTimer::NewL( this );
+    CActiveScheduler::Add( iProtoTimer );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::CreateProtoTimerL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ReleaseProtoTimer()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ReleaseProtoTimer()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ReleaseProtoTimer() >>"), RThread().Id().operator TUint()));
+    delete iProtoTimer;
+    iProtoTimer = 0;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ReleaseProtoTimer() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CreateYUVDataL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::CreateYUVDataL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::CreateYUVDataL() this %x >>"), RThread().Id().operator TUint(), this));
+    CVSFbsBitmapIYUVConverter* conv =
+    CVSFbsBitmapIYUVConverter::NewL( iYUVBitMap->Bitmap() );
+    CleanupStack::PushL( conv );
+    conv->ProcessL();
+    iFreezeCS.Wait();
+    ReleaseYUVData();
+    iYUVBuffer = conv->YUVData().AllocL();
+    iFreezeCS.Signal();
+    CleanupStack::PopAndDestroy(); //  conv
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::CreateYUVDataL() iYUVBuffer %x <<"), RThread().Id().operator TUint(), iYUVBuffer));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ReleaseYUVData()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ReleaseYUVData()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ReleaseYUVData() >>"), RThread().Id().operator TUint()));
+    delete iYUVBuffer;
+    iYUVBuffer = 0;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CVSStillImageDataProvider::ReleaseYUVData() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CVSStillImageDataProvider(
+//  MVSDataProviderObserver* aObserver )
+// -----------------------------------------------------------------------------
+//
+CVSStillImageDataProvider::CVSStillImageDataProvider(
+    MVSDataProviderObserver* aObserver,
+    MVSBufferPool* aPool ) :
+        CVSDataProvider( aObserver, aPool ), iProtoUpdateRate( 1000000.0 / KFrameRate )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CVSStillImageDataProvider() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CVSStillImageDataProvider() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::ConstructL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ConstructL() this %x >>"), RThread().Id().operator TUint(), this));
+    CVSDataProvider::ConstructL();
+    User::LeaveIfError( iFs.Connect() );
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    CleanupClosePushL( wsSession );
+    CWsScreenDevice* wsScreenDevice = new ( ELeave ) CWsScreenDevice( wsSession );
+    CleanupStack::PushL( wsScreenDevice );
+    User::LeaveIfError( wsScreenDevice->Construct() );
+    iDisplayMode = wsScreenDevice->DisplayMode();/* = EColor16MU;*/
+    CleanupStack::PopAndDestroy( 2 ); // wsSession, wsScreenDevice
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::ConstructL() this %x <<"), RThread().Id().operator TUint(), this));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetVideoFrameSize(
+//  TSize& aSize, TInt /*aSizeIndex*/, const TDesC8& aFormat )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::GetVideoFrameSize(
+    TSize& aSize,
+    TInt /*aSizeIndex*/,
+    const TDesC8& aFormat )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GetVideoFrameSize() >>"), RThread().Id().operator TUint()));
+    if ( aFormat == KVtVideoMIMETypeYUV420 )
+        {
+        aSize.SetSize( KQcifWidth, KQcifHeight );
+        }
+    else
+        {
+        aSize.SetSize( 0, 0 );
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GetVideoFrameSize() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetVideoFrameRate(
+//  TReal32& aRate, TInt /*aRateIndex*/, const TDesC8& aFormat,
+//  const TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::GetVideoFrameRate(
+    TReal32& aRate,
+    TInt /*aRateIndex*/,
+    const TDesC8& aFormat,
+    const TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GetVideoFrameRate() >>"), RThread().Id().operator TUint()));
+    if ( aFormat == KVtVideoMIMETypeYUV420 &&
+        aSize == TSize( KQcifWidth, KQcifHeight ) )
+        {
+        aRate = KFrameRate;
+        }
+    else
+        {
+        aRate = 0.0;
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::GetVideoFrameRate() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::DisplayMode
+// -----------------------------------------------------------------------------
+//
+TDisplayMode CVSStillImageDataProvider::DisplayMode() const
+	{
+#ifdef _DEBUG
+    TUint threadId( RThread().Id() );
+    switch( iDisplayMode )
+        {
+        case EColor4K:
+            RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = EColor4K" ), threadId );
+            break;
+        case EColor64K:
+            RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = EColor64K" ), threadId );
+            break;
+        case EColor16M:
+            RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = EColor16M" ), threadId );
+            break;
+        case EColor16MU:
+            RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = EColor16MU" ), threadId );
+            break;
+        default:
+            RDebug::Print( _L( "VideoSource [%d]: DisplayMode() = %d" ), threadId, iDisplayMode );
+            break;
+        }
+#endif // _DEBUG
+    return iDisplayMode;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetContrastL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetContrastL(TInt /*aContrast*/)
+	{
+	__IF_DEBUG(Print(_L("VideoSource [%d]:CVSStillImageDataProvider::SetContrastL() LEAVE"), RThread().Id().operator TUint()));
+	User::Leave( KErrNotSupported );
+	}
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetContrast
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::GetContrast(TInt& /*aContrast*/) const
+	{
+	return KErrNotSupported;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetBrightnessL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetBrightnessL(TInt /*aBrightness*/)
+	{
+	__IF_DEBUG(Print(_L("VideoSource [%d]:CVSStillImageDataProvider::SetBrightnessL() LEAVE"), RThread().Id().operator TUint()));
+	User::Leave( KErrNotSupported );
+	}
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetBrightness
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::GetBrightness(TInt& /*aBrightness*/ ) const
+	{
+	return KErrNotSupported;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetWhiteBalanceL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetWhiteBalanceL( CCamera::TWhiteBalance /*aWhiteBalance*/ )
+	{
+	__IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SetWhiteBalanceL() LEAVE"), RThread().Id().operator TUint()));
+	User::Leave( KErrNotSupported );
+	}
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetWhiteBalance
+// -----------------------------------------------------------------------------
+//
+ TInt CVSStillImageDataProvider::GetWhiteBalance(CCamera::TWhiteBalance& /*aWhiteBalance*/) const
+	{
+	return KErrNotSupported;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::SetColorToneL
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::SetColorToneL( CCamera::CCameraImageProcessing::TEffect /*aValue*/ )
+	{
+	__IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::SetColorToneL() LEAVE"), RThread().Id().operator TUint()));
+	User::Leave( KErrNotSupported );
+	}
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::GetColorTone
+// -----------------------------------------------------------------------------
+//
+TInt CVSStillImageDataProvider::GetColorTone( CCamera::CCameraImageProcessing::TEffect& /*aColorTone*/ ) const
+	{
+	return KErrNotSupported;
+	}
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::InitializeReady
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::InitializeReady()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::InitializeReady()>> "), RThread().Id().operator TUint()));
+    if ( EPSUndoInitializing == iPSState )
+        {
+        NotifyError(KErrCancel);
+        UndoCommonInitialized();
+        iPSState = EPSUninitialized;
+        }
+    else
+        {
+        iPSState = EPSStopped;
+        Observer().vsProviderReady();
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::InitializeReady()<< "), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::RefreshYUVData
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::RefreshYUVData( TImageShareDataBuffer& aYUVBitMap )
+	{
+	__IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshYUVData()>> "), RThread().Id().operator TUint()));
+		iYUVBitMap = aYUVBitMap.iBitmap;
+		//Create YUV buffer only in play state
+		TRAP_IGNORE ( CreateYUVDataL() );
+		aYUVBitMap.iIsBitmapFree = ETrue;
+		__IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshYUVData()<< "), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::RefreshViewFinder
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::RefreshViewFinder( TImageShareDataBuffer& aVFBitMap )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshViewFinder()>> "), RThread().Id().operator TUint()));
+    iVFBitmap = aVFBitMap.iBitmap;
+    aVFBitMap.iIsBitmapFree = ETrue;
+    // Allow VF refresh only if size is what
+    // has beed aquired and play state is on
+    if ( ( iTargetSize == iVFBitmap->Size() ) && ( iVFState == EVFPlaying ) )
+        {
+        iVFTimer->After( 1, &VFTimer );
+        }
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshViewFinder() conditon doesn't match, iVFState[%d] "), RThread().Id().operator TUint(), iVFState));
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::RefreshViewFinder()<< "), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::NotifyImageHandlingError
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::NotifyImageHandlingError( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::NotifyImageHandlingError()>> "), RThread().Id().operator TUint()));
+    NotifyError( aError );
+    if ( ( KErrCancel == aError ) && ( EPSUndoInitializing == iPSState ) )
+        {
+        UndoCommonInitialized();
+        iPSState = EPSUninitialized;
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::NotifyImageHandlingError()<< "), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CancelInitializing
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::CancelInitializing()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CancelInitializing()>> "), RThread().Id().operator TUint()));
+    if ( iPSState != EPSInitializing )
+        {
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CancelInitializing(), iPSState is not valid,%d>> "), RThread().Id().operator TUint(), iPSState));
+        return;
+        }
+    
+    if ( iInitType != TVSStillImageDataProviderParams::EInitializeFromFile )
+        {
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CancelInitializing(), iInitType is not valid,%d>> "), RThread().Id().operator TUint(), iInitType));
+        return;
+        }
+    if ( iViewer->CancelInitializing() )
+        {
+        // In this condition, convert was cancelled , no any message will receive from multiframe provider, 
+        // so delete multiFrame provider, and change IPSState, NotifyError to VT Engine
+        NotifyError(KErrCancel);
+        UndoCommonInitialized();
+        iPSState = EPSUninitialized;
+        }
+    else
+        {
+        // In this condition, cnverting is finished, and Scale will cancel(CVtImageScaler->Cancel()), but in CVtImageScaler::DoCancel(),
+        // there is a error notify exist, so we must wait the error message from multiframe provider,
+        // we change the iPSState to EPSUndoInitializing for waiting error message.
+        // Error message will be received in function CVSStillImageDataProvider::NotifyImageHandlingError
+        iPSState = EPSUndoInitializing;
+        }
+    
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::CancelInitializing()<< "), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::UndoCommonInitialized
+// -----------------------------------------------------------------------------
+//
+void CVSStillImageDataProvider::UndoCommonInitialized()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::UndoCommonInitialized()>> "), RThread().Id().operator TUint()));
+
+    iFreezeCS.Close();
+    if ( NULL != iVFTimer )
+        {
+        iVFTimer->Cancel();
+        }
+    
+    delete iViewer;
+    iViewer = NULL;
+    
+    delete iActiveWait;
+    iActiveWait = NULL;
+    
+    delete iVFTimer;
+    iVFTimer = NULL;
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSStillImageDataProvider::UndoCommonInitialized()<< "), RThread().Id().operator TUint()));
+
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/cactivewait.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cactivewait.h"
+
+const TInt KFirstFrameIndx = 0;
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ CVSActiveWait ===============================
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::~CVSActiveWait()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+CVSActiveWait< R >::~CVSActiveWait()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() >>"), RThread().Id().operator TUint()));
+    Cancel();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::~CVSActiveWait() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::RequestStatus()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+TRequestStatus* CVSActiveWait< R >::RequestStatus()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RequestStatus() <<"), RThread().Id().operator TUint()));
+    return &iStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::Signal( TInt aError )
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::Signal( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() >>"), RThread().Id().operator TUint()));
+    if( IsActive() )
+        {
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, aError );
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::Signal() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::RunL()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::RunL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() >>"), RThread().Id().operator TUint()));
+    (iRequester->*iCallback)( iStatus.Int() );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::RunL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CVSActiveWait::DoCancel()
+// -----------------------------------------------------------------------------
+//
+template <class R>
+void CVSActiveWait< R >::DoCancel()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() >>"), RThread().Id().operator TUint()));
+    TRequestStatus* pStatus = &iStatus;
+    User::RequestComplete( pStatus, KErrCancel );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CVSActiveWait::DoCancel() <<"), RThread().Id().operator TUint()));
+    }
+    
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/cmultiframedataao.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmultiframedataao.h"
+#include "mmultiframeprovider.h"
+#include "cmultiframeprovider.h"
+#include "VSPanic.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+// ============================ CMultiframeDataAO ===============================
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::CMultiframeDataAO( CMultiframeProvider* aRequester )
+// -----------------------------------------------------------------------------
+//
+CMultiframeDataAO::CMultiframeDataAO( CMultiframeProvider* aRequester )
+: CTimer( EPriorityHigh ), iRequester( aRequester )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::CMultiframeDataAO() >>"), RThread().Id().operator TUint()));
+    RThread me;
+    iThreadId = me.Id();
+    CActiveScheduler::Add( this );
+    TRAP_IGNORE(CTimer::ConstructL());
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::CMultiframeDataAO() <<"), RThread().Id().operator TUint()));
+    }
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::SetObserver( MMultiframeprovider* aObserever )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::SetObserver( MMultiframeprovider* aObserver )
+	  {
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::SetObserver() >>"), RThread().Id().operator TUint()));
+	  iObserver = aObserver;
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::SetObserver() <<"), RThread().Id().operator TUint()));	
+	  }
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::~CMultiframeDataAO()
+// -----------------------------------------------------------------------------
+//
+CMultiframeDataAO::~CMultiframeDataAO()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::~CMultiframeDataAO() >>"), RThread().Id().operator TUint()));
+    Cancel();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::~CMultiframeDataAO() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::Activate( )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::Activate( TTimeIntervalMicroSeconds aUpdateTime, TBool aInit, TBool aVFUpdate )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::Activate() >>"), RThread().Id().operator TUint()));
+			
+    TTimeIntervalMicroSeconds32 time = aUpdateTime.Int64();
+    iInit = aInit;
+    iVFUpdate = aVFUpdate;
+    if ( !IsActive() )
+    	  {
+    	  CTimer::After( time );
+  		  }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::Activate() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::LocalBuffer( )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::LocalBuffer( CVtImageBitmap* aLocalBuffer )
+	  {
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::LocalBuffer() >>"), RThread().Id().operator TUint()));	
+		iLocalBuffer.iBitmap = aLocalBuffer;
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::LocalBuffer() <<"), RThread().Id().operator TUint()));
+	  }
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::RemoteBuffer( )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::RemoteBuffer( CVtImageBitmap* aRemoteBuffer )
+	  {
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RemoteBuffer() >>"), RThread().Id().operator TUint()));		
+		iRemoteBuffer.iBitmap = aRemoteBuffer;
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RemoteBuffer() <<"), RThread().Id().operator TUint()));	
+	  }
+	
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::RunL()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::RunL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RunL() >>"), RThread().Id().operator TUint()));
+
+    //stop loop ao
+    if (iRequireStopping)
+        {
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RunL() cancel by flag"), RThread().Id().operator TUint()));
+        iRequireStopping = EFalse;
+        return;
+        }
+
+    if ( !iVFUpdate )
+        {
+        iObserver->RefreshYUVData( iRemoteBuffer );
+        }	
+    iObserver->RefreshViewFinder( iLocalBuffer );
+    iRequester->UseSecondVfBuffer();
+    if ( iInit )
+        {
+        iObserver->InitializeReady(); 	
+        }
+    if ( !iVFUpdate )
+        {	
+        iRequester->AddBitmapToFreeQueue();
+        }
+    if ( !iInit && !iVFUpdate )  
+        {				
+        iRequester->NextFrame();
+        }			
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::RunL() <<"), RThread().Id().operator TUint()));	
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeDataAO::CancelTimeLoop()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeDataAO::CancelTimeLoop()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::CancelTimeLoop >>"), RThread().Id().operator TUint()));        
+    if ( IsActive() )
+        {
+        if ( iStatus == KRequestPending )
+            {
+            RThread me;
+            if ( me.Id() == iThreadId )
+                {
+                Cancel();
+                iRequireStopping = EFalse;
+                }
+            else
+                {
+                iRequireStopping = ETrue;
+                }
+            }
+        else
+            {
+            iRequireStopping = ETrue;
+            }
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeDataAO::CancelTimeLoop <<"), RThread().Id().operator TUint()));                    
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/cmultiframeloopao.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,233 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmultiframeloopao.h"
+#include "cmultiframeprovider.h"
+#include "VSPanic.h"
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+// ============================ CMultiframeloopAO ===============================
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::CMultiframeloopAO( CMultiframeProvider* aRequester )
+// -----------------------------------------------------------------------------
+//
+CMultiframeloopAO::CMultiframeloopAO( CMultiframeProvider* aRequester )
+: CActive( EPriorityLow ), iRequester( aRequester ), iFreeBMCount(0), iRequireStopping(EFalse)
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::CMultiframeloopAO() >>"), RThread().Id().operator TUint()));
+    RThread me;
+    iThreadId = me.Id();
+    CActiveScheduler::Add( this );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::CMultiframeloopAO() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::~CMultiframeloopAO()
+// -----------------------------------------------------------------------------
+//
+CMultiframeloopAO::~CMultiframeloopAO()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::~CMultiframeloopAO() >>"), RThread().Id().operator TUint()));
+    Cancel();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::~CMultiframeloopAO() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::Signal( )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeloopAO::Signal( )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::Signal() >>"), RThread().Id().operator TUint()));
+    iRequester->iAnimation = ETrue;	
+    if ( !IsActive() )
+        {
+        SetActive();
+        TRequestStatus* pStatus = &iStatus;
+        RThread me;
+        if ( me.Id() == iThreadId )
+            {
+            User::RequestComplete( pStatus, KErrNone );
+            }
+        else
+            {
+            if ( me.Open( iThreadId ) == KErrNone )
+                {
+                *pStatus = KRequestPending;
+                me.RequestComplete( pStatus, KErrNone );
+                me.Close();
+                }
+            else
+                {
+                Panic( EVSPanicThreadOpenFailure );
+                }
+            }
+        }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::Signal() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::RunL()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeloopAO::RunL()
+    {
+    iRequester->WaitForConverting();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() >>"), RThread().Id().operator TUint()));
+
+    //stop loop ao
+    if (iRequireStopping)
+        {
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() CANCEL CALLED,stop by flag"), RThread().Id().operator TUint()));
+        iRequireStopping = EFalse;
+        iRequester->ReleaseForConverting();
+        return;
+        }
+
+    // Cancel is handled in this way because
+    if ( iStatus ==  KErrCancel)
+        {
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() CANCEL CALLED IN PROTO THREAD STOP LOOPPING"), RThread().Id().operator TUint()));
+        iRequester->ReleaseForConverting();
+        return;	
+        }
+
+    //If free bitmaps proceed next frame
+    if ( iFreeBMCount > 0 )
+        {	
+        ++iIndex;
+        // Loop animation starting from first frame 				
+        if ( iIndex > iFramecount - 1 )
+            {
+            iIndex = KFirstFrameIndx;	
+            }	
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() RunL index %d"), RThread().Id().operator TUint(), iIndex));	
+        iRequester->ConvertAndScaleL( iIndex );					
+        }
+    //Wait until free bitmaps to proceed 		
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() NO FREE BMs"), RThread().Id().operator TUint()));
+        iStatus = KRequestPending;
+        SetActive();
+        }	
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RunL() <<"), RThread().Id().operator TUint()));
+    iRequester->ReleaseForConverting();
+    }
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::RemoveFreeBitmaps()
+// -----------------------------------------------------------------------------
+//     
+void CMultiframeloopAO::RemoveFreeBitmaps( TInt aCount )
+	  {
+		__IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RemoveFreeBitmaps() >>"), RThread().Id().operator TUint()));
+		iFreeBMCount = iFreeBMCount - aCount;	
+		__IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::RemoveFreeBitmaps() frames %d <<"), RThread().Id().operator TUint(), aCount));	
+	  }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::SetFreeBitmaps()
+// -----------------------------------------------------------------------------
+//     
+void CMultiframeloopAO::SetFreeBitmaps( TInt aCount )
+	  {
+		__IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::SetFreeBitmaps() >>"), RThread().Id().operator TUint()));
+		iFreeBMCount = iFreeBMCount + aCount;		
+		if ( IsActive() && iStatus == KRequestPending)
+				{
+				TRequestStatus* pStatus = &iStatus;
+  			User::RequestComplete( pStatus, KErrNone );		
+				}
+	
+		__IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::SetFreeBitmaps() frames %d <<"), RThread().Id().operator TUint(), aCount));	
+	  }	    
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::SetFrameCount()
+// -----------------------------------------------------------------------------
+//    
+void CMultiframeloopAO::SetFrameCount( TInt aCount )
+	  {
+		__IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::SetFrameCount() >>"), RThread().Id().operator TUint()));	
+		iFramecount = aCount;
+		iIndex = 0;
+		__IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::SetFrameCount() frames %d <<"), RThread().Id().operator TUint(), aCount));	
+	  }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::CancelDataLoop()
+// -----------------------------------------------------------------------------
+//
+ void CMultiframeloopAO::CancelDataLoop()
+     {
+     __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::CancelDataLoop() >>"), RThread().Id().operator TUint()));		
+     if ( IsActive() )
+         {
+         if ( iStatus == KRequestPending )
+             {
+             RThread me;
+             if ( me.Id() == iThreadId )
+                 {
+                 Cancel();
+                 }
+             else
+                 {
+                 if ( me.Open( iThreadId ) == KErrNone )
+                     {
+                     TRequestStatus* pStatus = &iStatus;
+                     *pStatus = KRequestPending;
+                     me.RequestComplete( pStatus, KErrCancel );
+                     me.Close();
+                     }
+                 else
+                     {
+                     Panic( EVSPanicThreadOpenFailure );
+                     }
+                 }
+             }
+         else
+             {
+             iRequireStopping = ETrue;
+             }
+         }
+     __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::CancelDataLoop() <<"), RThread().Id().operator TUint()));					
+     }
+
+// -----------------------------------------------------------------------------
+// CMultiframeloopAO::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeloopAO::DoCancel()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::DoCancel() >>"), RThread().Id().operator TUint()));
+    if ( iStatus == KRequestPending )
+    	  {
+    	  TRequestStatus* pStatus = &iStatus;
+    	  User::RequestComplete( pStatus, KErrCancel );
+    	  }
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeloopAO::DoCancel() <<"), RThread().Id().operator TUint()));
+    }   
+
+// End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/VideoSource/src/cmultiframeprovider.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1019 @@
+/*
+* Copyright (c) 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 Source subsystem.
+*
+*/
+
+
+// INCLUDE FILES
+#include <imageconversion.h>
+#include <cvtimageconverter.h>
+#include <rphcltserver.h>
+#include <cphcltimagehandler.h>
+#include <bautils.h>
+
+#include "cmultiframeprovider.h"
+#include "cmultiframeloopao.h"
+#include "cmultiframedataao.h"
+
+#include "CVSStillImageDataProvider.h"
+#include "cvtimagebitmap.h"
+
+static const TInt KQcifWidth = 176;
+static const TInt KQcifHeight = 144;
+
+// Default bitmap size is VGA
+static const TInt KDefaultBitmapSizeWidth = 640;
+static const TInt KDefaultBitmapSizeHeight = 480;
+
+// MACROS
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// ============================ TScalingMediator ===============================
+
+// -----------------------------------------------------------------------------
+// TScalingMediator::TScalingMediator( )
+// -----------------------------------------------------------------------------
+//
+TScalingMediator::TScalingMediator()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TScalingMediator::ScalingFinished( )
+// -----------------------------------------------------------------------------
+//
+void TScalingMediator::ScalingFinished( TInt aError )
+		{
+		__IF_DEBUG(Print(_L("TScalingMediator::ScalingFinished() >>")));
+    iWait->Signal( aError );
+   	__IF_DEBUG(Print(_L("TScalingMediator::ScalingFinished() error %d <<"), aError));
+		}
+// -----------------------------------------------------------------------------
+// TScalingMediator::ScalingFinished( )
+// -----------------------------------------------------------------------------
+//
+void TScalingMediator::SetWaiter( CVSActiveWait< CMultiframeProvider >* aWait )
+			{
+			iWait = aWait;
+			}
+
+// ============================ CMultiframeProvider ===============================
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::NewL( )
+// -----------------------------------------------------------------------------
+//
+CMultiframeProvider* CMultiframeProvider::NewL( MMultiframeprovider* aObserver, TDisplayMode aDisplayMode )
+    {
+    __IF_DEBUG(Print(_L("VideoSource: [%d] CMultiframeProvider::NewL() >>"), RThread().Id().operator TUint()));
+    CMultiframeProvider* self =
+    new (ELeave) CMultiframeProvider( aObserver, aDisplayMode );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __IF_DEBUG(Print(_L("VideoSource: [%d] CMultiframeProvider::NewL() <<"), RThread().Id().operator TUint()));
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::CMultiframeProvider(
+//  MVSDataProviderObserver* aObserver )
+// -----------------------------------------------------------------------------
+//
+CMultiframeProvider::CMultiframeProvider(
+    MMultiframeprovider* aObserver , TDisplayMode aDisplayMode ): iDisplayMode( aDisplayMode ), iObserver( aObserver ), iBlank( EFalse ), iGSImage( EFalse )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::CMultiframeProvider() >>"), RThread().Id().operator TUint()));
+    //Set target VF size QCIF as default
+    iTargetSize.SetSize( KQcifWidth , KQcifHeight );
+    iVFSize.SetSize( KQcifWidth , KQcifHeight );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::CMultiframeProvider() <<"), RThread().Id().operator TUint()));
+    }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::~CMultiframeProvider()
+// -----------------------------------------------------------------------------
+//
+CMultiframeProvider::~CMultiframeProvider()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::~CMultiframeProvider() >>"), RThread().Id().operator TUint()));
+    iFs.Close();
+    iFreezeCS.Close();
+    delete iImageDecoder; iImageDecoder = 0;
+    delete iVtImageScalerInit;
+    delete iVtImageScalerScale;
+    delete iActiveWaitInit;
+    delete iActiveWaitScale;
+    delete iActiveWaitInitScale;
+    delete iConverted;
+    delete iMask;
+    delete iTempBM;
+    delete iDataTimer;
+    delete iLoopAo;
+    if ( iScaled != iBuffer1 && iScaled != iBuffer2 )
+        {
+    	  delete iScaled;
+        }
+    delete iGSBitmap;
+    if ( !iBlank || !iGSImage )
+    	  {
+    	  delete iBuffer1;
+		    delete iBuffer2;
+    	  }
+    delete iFirstVfBuf;
+    delete iSecondVfBuf;
+    iFreeQueue.Close();
+    iDefaultImageFile.Close();
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::~CMultiframeProvider() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ConstructL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConstructL() >>"), RThread().Id().operator TUint()));
+    User::LeaveIfError( iFs.Connect() );
+    User::LeaveIfError( iFreezeCS.CreateLocal() );
+
+    // Create waiters and mediators for scaling purposes
+    iActiveWaitInit = new (ELeave) CVSActiveWait< CMultiframeProvider >( this );
+    iActiveWaitScale = new (ELeave) CVSActiveWait< CMultiframeProvider >( this );
+    iActiveWaitInitScale = new (ELeave) CVSActiveWait< CMultiframeProvider >( this );
+    iInitMediator.SetWaiter( iActiveWaitInitScale );
+    iScalingMediator.SetWaiter( iActiveWaitScale );
+    iVtImageScalerInit = CVtImageScaler::NewL( iInitMediator, CVtImageScaler::EBilinear );
+    iVtImageScalerScale = CVtImageScaler::NewL( iScalingMediator, CVtImageScaler::EBilinear );
+		iDataTimer = new (ELeave) CMultiframeDataAO( this );
+		iDataTimer->SetObserver( iObserver );
+    iLoopAo = new (ELeave) CMultiframeloopAO( this );
+    iFirstVfBuf = CVtImageBitmap::NewL( TSize( KQcifWidth >> 2, KQcifHeight >> 2 ), iDisplayMode );
+    iSecondVfBuf = CVtImageBitmap::NewL( TSize( KQcifWidth >> 2, KQcifHeight >> 2 ), iDisplayMode );
+    iSecondVFBuffer = EFalse;
+    iFirstVFBuffer = ETrue;
+    iIsVfStopped = EFalse;
+    iWaitForConverting = EFalse;
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConstructL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::IniatializeGSL()
+//
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::IniatializeGSL( const TGeneralSettingsImageType aType )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::IniatializeGSL() >>"), RThread().Id().operator TUint()));
+	  if ( aType == EGSStillImage )
+        {
+        // Open connection to phone server
+        RPhCltServer phoneClient;
+        User::LeaveIfError( phoneClient.Connect() );
+        CleanupClosePushL( phoneClient );
+    
+    	  CPhCltImageHandler* stillH = CPhCltImageHandler::NewL();
+        CleanupStack::PushL( stillH );
+    
+    	  // Load images
+    	  CPhCltImageParams* imageParams;
+        imageParams = stillH->CPhCltBaseImageParamsL( EPhCltTypeVTStill );
+        CleanupStack::PushL( imageParams );
+        User::LeaveIfError( stillH->LoadImages( imageParams ) );
+    
+        // Duplicate to image
+    	  if( imageParams->Count() > 0 )
+           {
+           __IF_DEBUG(Print(_L("iImageCount > 0")));
+           iGSBitmap = CVtImageBitmap::NewL( imageParams->GetImageL( 0 ) );
+           }
+        else
+           {
+           __IF_DEBUG(Print(_L("iImageCount <= 0 -> User::Leave( KErrNotFound )")));
+           User::Leave( KErrNotFound );
+           }
+        // Cleanup
+    	  CleanupStack::PopAndDestroy( 3 ); // phoneClient, stillH, imageParams
+    	  iScaled = CVtImageBitmap::NewL( TSize( KQcifWidth, KQcifHeight ), iDisplayMode );
+    		
+        // If bitmap has different display mode than screen, then new bitmap
+        // is created and image is converted to screen's display mode
+        if ( iGSBitmap->Bitmap().DisplayMode() != iDisplayMode || 
+                iGSBitmap->Bitmap().ExtendedBitmapType() != KNullUid )
+            {
+            CVtImageBitmap* temp = CVtImageBitmap::NewL(
+                iGSBitmap->Bitmap().SizeInPixels(), iDisplayMode );
+            CleanupStack::PushL( temp );
+            // Color conversion is done by blitting it to other bitmap
+            CFbsBitmapDevice* fbd = CFbsBitmapDevice::NewL( &temp->Bitmap() );
+            CleanupStack::PushL( fbd );
+            CFbsBitGc* fgc = NULL;
+            User::LeaveIfError( fbd->CreateContext( fgc ) );
+            CleanupStack::PushL( fgc );
+            fgc->BitBlt( TPoint(), &iGSBitmap->Bitmap() );
+            CleanupStack::PopAndDestroy( 2 ); // fbd, fgc
+            CleanupStack::Pop(); // temp
+            delete iGSBitmap; iGSBitmap = NULL;
+            iGSBitmap = temp;
+            }
+        iGSImage = ETrue;
+        iCount = 1;     
+		    iActiveWaitInit->InitializeWaiter( &ConversionFinished );
+        iActiveWaitInit->Signal( KErrNone );
+        }
+    else
+        { // default still image prepared by using file handle
+        InitializeL( NULL );
+        }
+    iInitialization = ETrue;
+    iDelay = 0;    
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::IniatializeGSL() <<"), RThread().Id().operator TUint()));
+	}
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::IniatializeBlank()
+//
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::IniatializeBlankL()
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::IniatializeBlank() >>"), RThread().Id().operator TUint()));
+    iBlank = ETrue;
+    iInitialization = ETrue;
+    iDelay = 0;
+    iCount = 1;
+
+    CFbsBitmap* tempBitmap = 0;
+
+    CreateBlankBitmapL(
+        tempBitmap,
+        TSize( KQcifWidth, KQcifHeight ),
+        iDisplayMode,
+#ifdef _DEBUG
+        KRgbYellow
+#else
+        KRgbBlack
+#endif
+        );
+
+    CleanupStack::PushL( tempBitmap );
+    iScaled = CVtImageBitmap::NewL( tempBitmap->Handle() );
+    CleanupStack::PopAndDestroy(); // tempBitmap
+    tempBitmap = 0;
+
+    iActiveWaitInit->InitializeWaiter( &BMSScalingFinished );
+    iActiveWaitInit->Signal( KErrNone );
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::IniatializeBlank() <<"), RThread().Id().operator TUint()));
+    }
+ // -----------------------------------------------------------------------------
+// CVSStillImageDataProvider::CreateBlankBitmapL(
+//  CFbsBitmap*& aBitmap, const TSize& aSize, const TDisplayMode& aMode,
+//  const TRgb& aColor )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::CreateBlankBitmapL(
+    CFbsBitmap*& aBitmap,
+    const TSize& aSize,
+    const TDisplayMode& aMode,
+    const TRgb& aColor )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CreateBlankBitmapL() >>"), RThread().Id().operator TUint()));
+    if( aBitmap )
+       {
+       delete aBitmap;
+       aBitmap = 0;
+       }
+    aBitmap = new (ELeave) CFbsBitmap();
+    User::LeaveIfError( aBitmap->Create( aSize, aMode ) );
+    CFbsBitmapDevice* fbd = CFbsBitmapDevice::NewL( aBitmap );
+    CleanupStack::PushL( fbd );
+    CFbsBitGc* fgc = 0;
+    User::LeaveIfError( fbd->CreateContext( fgc ) );
+    CleanupStack::PushL( fgc );
+
+    fgc->SetPenColor( aColor );
+    fgc->SetBrushColor( aColor );
+    fgc->SetBrushStyle( CGraphicsContext::ESolidBrush );
+    fgc->DrawRect( TRect( aSize ) );
+
+    CleanupStack::PopAndDestroy( 2 ); // fbd, fgc
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CreateBlankBitmapL() <<"), RThread().Id().operator TUint()));
+    }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::Iniatialize()
+//
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::InitializeL( const TFileName* aFileName )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::InitializeL() >>"), RThread().Id().operator TUint()));
+		// Create bitmaps used for conversion and scaling  
+		iBuffer1 = CVtImageBitmap::NewL( TSize( KQcifWidth, KQcifHeight ), iDisplayMode );
+		iBuffer2 = CVtImageBitmap::NewL( TSize( KQcifWidth, KQcifHeight ), iDisplayMode );
+    User::LeaveIfError( iFreeQueue.Append( iBuffer1 ) );
+		User::LeaveIfError( iFreeQueue.Append( iBuffer2 ) );
+		iLoopAo->SetFreeBitmaps( 2 );
+			
+		// Create ICL decoder in its own thread for current file  
+		TInt decodingoptions( 
+		CImageDecoder::TOptions( CImageDecoder::EOptionAlwaysThread | CImageDecoder::EAllowGeneratedMask ) );	
+        
+    if ( aFileName )
+    		{
+    		__IF_DEBUG(Print(_L(" file name exist, creating CImageDecoder")));
+    		iImageDecoder = CImageDecoder::FileNewL( iFs, *aFileName, (CImageDecoder::TOptions )decodingoptions /*CImageDecoder::EOptionNone*/ );
+    	  }
+    else
+        {
+        __IF_DEBUG(Print(_L(" default vt image file => use phone server")));
+        // default VT image file handle obtained from phone server
+        RPhCltServer phoneClient;
+        User::LeaveIfError( phoneClient.Connect() );
+        __IF_DEBUG(Print(_L("  connected to phone server")));
+        CleanupClosePushL( phoneClient );
+        CPhCltImageHandler* handler = CPhCltImageHandler::NewL();
+        CleanupStack::PushL( handler );                          
+        __IF_DEBUG(Print(_L(" created image handler")));
+        User::LeaveIfError( handler->OpenDefaultVtImage( iDefaultImageFile ) );
+        decodingoptions &= ~CImageDecoder::EOptionAlwaysThread;
+        __IF_DEBUG(Print(_L(" creating image decoder")));
+        iImageDecoder = CImageDecoder::FileNewL( iDefaultImageFile, ContentAccess::EPlay, (CImageDecoder::TOptions )decodingoptions );
+        __IF_DEBUG(Print(_L(" created image decoder")));
+        CleanupStack::PopAndDestroy( 2 ); // handler, phoneClient
+        }
+    // Use ICL to calculate frame count 
+		iCount = iImageDecoder->FrameCount();
+		__IF_DEBUG(Print(_L(" frame count=%d"),iCount));
+		//If advanced flags are on show only first frame!
+		for ( TInt index = 0; index < iCount; ++index )
+    		 {
+    		 TFrameInfo frameInfo( iImageDecoder->FrameInfo( index ) );
+    		 __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::InitializeL() frameInfo.iFlags %b >>"), RThread().Id().operator TUint(), frameInfo.iFlags));
+    		 if ( frameInfo.iFlags & TFrameInfo::ELeaveInPlace )
+    		     {
+    			   iDelay = 0;
+    		     iCount = 1;	
+    			   }
+    		 }        	
+		//Set num of frames to viewer AO
+		iLoopAo->SetFrameCount( iCount );
+		//For default loopping frame sequence is disabled
+		iAnimation = EFalse;
+		iInitialization = ETrue;
+		//Start ICL image conversion (decoding) and local scaling 
+		ConvertAndScaleL( KFirstFrameIndx );	
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::InitializeL() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::SetVFScalingTargetSize()
+//
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::SetVFScalingTargetSize( TSize aSize )
+	  {
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::SetVFScalingTargetSize() >>"), RThread().Id().operator TUint()));
+  	iTargetSize = aSize;
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::SetVFScalingTargetSize() W %d H %d <<"), RThread().Id().operator TUint(), aSize.iWidth , aSize.iHeight ));
+  	}
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ConvertAndScaleL()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ConvertAndScaleL( TInt aFrameIndex )
+	  {
+	  // Variables related to Bitmap size
+	  // calculation
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale()  aFrameIndex %d>>"), RThread().Id().operator TUint(),aFrameIndex));
+	  TSize convertedBitmapSize;
+	  TFrameInfo frameInfo( iImageDecoder->FrameInfo( aFrameIndex ) );
+	  if ( !iInitialization )
+		    {
+			  TInt delayindex;
+			  delayindex = aFrameIndex - 1;
+			  if ( delayindex <  KFirstFrameIndx )
+					  {
+						delayindex = ( iCount - 1 );
+					  }
+			  TFrameInfo delayframeInfo( iImageDecoder->FrameInfo( delayindex ) );
+			  iDelay = delayframeInfo.iDelay;
+		    }
+	  else
+		    {
+		    iDelay = 1;
+		    }
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale()  iDelay %d>>"), RThread().Id().operator TUint(),iDelay.Int64() ));
+#ifdef _DEBUG
+    TUint threadId( RThread().Id() );
+    switch ( frameInfo.iFrameDisplayMode )
+        {
+        case EColor4K:
+            RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = EColor4K" ),
+            	threadId );
+            break;
+        case EColor64K:
+            RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = EColor64K" ),
+            	threadId );
+            break;
+        case EColor16M:
+          	  RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = EColor16M" ),
+            	threadId );
+            break;
+        case EColor16MU:
+          	  RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = EColor16MU" ),
+            	threadId );
+           	 break;
+        default:
+           	 RDebug::Print( _L( "VideoSource [%d]: FrameDPmode = %d" ),
+            	threadId, frameInfo.iFrameDisplayMode );
+           	 break;
+        }
+
+    RDebug::Print( _L( "VideoSource [%d]: CMultiframeProvider:: frameInfo.iFlags %d" ),
+        threadId,frameInfo.iFlags );
+#endif // _DEBUG
+
+ 	  // Use imagedecoder to calculate how many times source picture needs to be divided by 2
+ 	  // to fit in default (VGA) picture
+	  TInt reductionfactor = iImageDecoder->ReductionFactor( frameInfo.iOverallSizeInPixels,
+		    TSize( KDefaultBitmapSizeWidth, KDefaultBitmapSizeHeight ) );
+ 	  if ( iImageDecoder->ReducedSize( frameInfo.iOverallSizeInPixels, reductionfactor, convertedBitmapSize ) )
+    	  {
+    	  convertedBitmapSize = frameInfo.iOverallSizeInPixels;
+    	  }
+
+#ifdef _DEBUG
+	   RDebug::Print( _L( "VideoSource [%d]: convertedBitmapSize Width = %d convertedBitmapSize Height = %d" ),
+		    threadId, convertedBitmapSize.iWidth, convertedBitmapSize.iHeight );
+#endif // _DEBUG
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale() iConverted"), RThread().Id().operator TUint()));
+	      iConverted = CVtImageBitmap::NewL( convertedBitmapSize, iDisplayMode );
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale() iConverted"), RThread().Id().operator TUint()));
+#ifdef _DEBUG
+	  RDebug::Print( _L( "VideoSource [%d]: convBitmap Width = %d convBitmap Height = %d" ),
+		    threadId, iConverted->Size().iWidth, iConverted->Size().iHeight );
+#endif // _DEBUG
+
+	  iStartTime.HomeTime();
+	  if ( iFreeQueue.Count() < 2 )
+       	{
+       	__IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConvertAndScale() iFreeQueue.Count() < 2 "), RThread().Id().operator TUint()));
+       	iOldBM = ETrue;
+       	iOldBitmap = iScaled;
+       	}
+    iScaled	= iFreeQueue[ 0 ];
+	  iFreeQueue.Remove( 0 );
+	  iLoopAo->RemoveFreeBitmaps( 1 );
+	  iActiveWaitInit->InitializeWaiter( &CMultiframeProvider::ConversionFinished );
+	  // Check if masking is supported
+	  if ( frameInfo.iFlags & TFrameInfo::ETransparencyPossible )
+		    {
+		    // Create mask for bitmap
+		    iMask = new ( ELeave )CFbsBitmap();
+		    User::LeaveIfError( iMask->Create( convertedBitmapSize, EGray256 ));
+		    iTempBM = CVtImageBitmap::NewL( convertedBitmapSize, iDisplayMode );
+		    iImageDecoder->Convert( iActiveWaitInit->RequestStatus(), iTempBM->Bitmap(), *iMask, aFrameIndex );
+		    }
+	  // No mask
+	  else
+		    {
+		    iImageDecoder->Convert( iActiveWaitInit->RequestStatus(), iConverted->Bitmap(), aFrameIndex );
+		    }
+	  __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConvertAndScale() <<"), RThread().Id().operator TUint()));
+	}
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ConversionFinished( TInt aError )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ConversionFinished( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConversionFinished() >>"), RThread().Id().operator TUint()));
+    if ( iCount == 1 || aError )
+        {
+        // delete decoder if not needed any more 
+        // 1) single frame image, no further frames to convert
+        // 2) error occured, decoder won't be used anyway
+        __IF_DEBUG(Print(_L(" single frame image => destruct iImageDecoder, err %d"), aError ) );
+        delete iImageDecoder;
+        iImageDecoder = NULL;
+        }
+    // no harm done if other than this used, handle would already be 0
+    iDefaultImageFile.Close(); 
+    if ( aError == KErrNone )
+        {
+				iActiveWaitInitScale->InitializeWaiter( &BMSScalingFinished );
+      	if ( iGSImage )
+       			{
+       			__IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConversionFinished() scale GS "), RThread().Id().operator TUint()));
+       			iVtImageScalerInit->Scale( *iGSBitmap, *iScaled );
+      			}
+      	else
+      			{
+       			__IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConversionFinished() scale "), RThread().Id().operator TUint()));
+       			// Blit mask into a converted bitmap
+       			if ( iMask )
+       					{
+       					CGraphicsContext* bitmapcontext = NULL;
+       					CFbsBitmapDevice* bitmapdevice = NULL;
+       					// Create bm device
+       					TRAPD( error, bitmapdevice = CFbsBitmapDevice::NewL( &( iConverted->Bitmap() ) ) );
+       					if ( error != KErrNone )
+       							{
+       							iObserver->NotifyImageHandlingError( aError );
+       							delete bitmapdevice;
+       							delete iTempBM;
+       							delete iMask;
+       							iMask = NULL;
+       							iTempBM = NULL;
+       							return;
+       							}
+       					// Create GC for bm
+       					error = bitmapdevice->CreateContext( bitmapcontext );
+       					if ( error != KErrNone )
+       							{
+       							iObserver->NotifyImageHandlingError( aError );
+       							delete bitmapdevice;
+       							delete bitmapcontext;
+       							delete iTempBM;
+       							delete iMask;
+       							iMask = NULL;
+       							iTempBM = NULL;
+       							return;
+       							}
+       					// Fill destination bitmap with white color
+       					TRect rect( iConverted->Size() );
+       					bitmapcontext->SetBrushStyle( CGraphicsContext:: ESolidBrush );
+       					bitmapcontext->SetPenStyle( CGraphicsContext::ESolidPen );
+       					bitmapcontext->SetBrushColor( KRgbWhite );
+       					bitmapcontext->SetPenColor( KRgbWhite);
+       					bitmapcontext->DrawRect( rect );
+
+       					// Draw mask and data bitmap into a same destination bm
+       					bitmapcontext->DrawBitmapMasked( iConverted->Size(), &( iTempBM->Bitmap() ), iConverted->Size(), iMask, EFalse );
+       					delete bitmapdevice;
+       					delete bitmapcontext;
+       					delete iTempBM;
+       					delete iMask;
+       					iMask = NULL;
+       					iTempBM = NULL;
+       				 	__IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ConversionFinished() iMask"), RThread().Id().operator TUint()));
+       					}
+       			iVtImageScalerInit->Scale( *iConverted, *iScaled );
+      			}
+        	}
+    // Allways inform Decoding problems
+    else
+       	{
+        iObserver->NotifyImageHandlingError( aError );
+        delete iTempBM;
+       	delete iMask;
+       	iMask = NULL;
+       	iTempBM = NULL;
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ConversionFinished() error %d <<"), RThread().Id().operator TUint(), aError));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::BMSScalingFinished( TInt aError )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::BMSScalingFinished( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::BMSScalingFinished() >>"), RThread().Id().operator TUint()));
+    if ( aError == KErrNone )
+        {
+        VFScalingReady();
+        }
+    else
+        {
+#if 0
+        if ( aError != KErrCancel ) // If KErrCancel, then ignore error!
+            {
+        	iObserver->NotifyImageHandlingError( aError );
+        	}
+        //Needs to be deleted also in cancel case
+        delete iConverted; iConverted = NULL;
+#endif
+        delete iConverted; iConverted = NULL;
+        iObserver->NotifyImageHandlingError( aError );
+        
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::BMSScalingFinished() err %d <<"), RThread().Id().operator TUint(), aError));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::AddBitmapToFreeQueue( CVtImageBitmap* aBitmap )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::AddBitmapToFreeQueue()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::AddBitmapToFreeQueue() >>"), RThread().Id().operator TUint()));
+    if ( iOldBM )
+    	  {
+    	  __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::AddBitmapToFreeQueue() OLD BM"), RThread().Id().operator TUint()));
+    	  iOldBM = EFalse;
+        iFreeQueue.Append( iOldBitmap );
+    	  }
+    else
+    	  {
+   	 	  iFreeQueue.Append( iScaled );
+  		  }
+    iLoopAo->SetFreeBitmaps( 1 );
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::AddBitmapToFreeQueue() <<"), RThread().Id().operator TUint()));
+    }
+    
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::UseSecondVfBuffer()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::UseSecondVfBuffer()
+    {
+    iSecondVFBuffer = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::VFScalingReady()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::VFScalingReady()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady() >>"), RThread().Id().operator TUint()));
+    delete iConverted; iConverted = 0;
+
+    // Calculate frame update delay here!
+    TTime refpointtime;
+    refpointtime.HomeTime();
+    TTimeIntervalMicroSeconds deltaTime = refpointtime.MicroSecondsFrom( iStartTime );
+    iFrameUpdateTime = iDelay.Int64() - deltaTime.Int64();
+    if ( iFrameUpdateTime < 0 )
+    		{
+    		iFrameUpdateTime = 1;
+    		}
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady() iFrameUpdateTime %d>>"), RThread().Id().operator TUint(), iFrameUpdateTime.Int64()));
+  	// Scale VF to fit in requested size
+  	// size is as default QCIF
+    if ( iIsVfStopped )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady()VF Stop>>"), RThread().Id().operator TUint()));
+        if ( iActiveWaitScale->IsActive() )
+            {
+            //ScaleCopy running
+            //Waiting is OK
+            __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady()ScaleCopy running>>"), RThread().Id().operator TUint()));
+            }
+        else
+            {
+            //ScaleCopy is not running, Jump ScaleCopy
+            __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady()jump ScaleCopy>>"), RThread().Id().operator TUint()));
+            iActiveWaitScale->InitializeWaiter( &VFRescalingFinished );
+            iActiveWaitScale->Signal(KErrNone);
+            }
+        }
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady()Normal run>>"), RThread().Id().operator TUint()));
+        iVFUpdate = EFalse;
+        ScaleCopy( iTargetSize );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFScalingReady() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ScaleCopy( TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ScaleCopy( TSize& aSize,  TBool aVFUpdate  )
+    {
+    __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ScaleCopy() >>"), RThread().Id().operator TUint()));
+
+    iVFUpdate = aVFUpdate;
+    iVFSize = aSize;
+    if ( iSecondVFBuffer && !iFirstVFBuffer )
+        {
+        iVFbitmap = iSecondVfBuf;
+        iSecondVFBuffer = EFalse;
+        iFirstVFBuffer = ETrue;
+        }
+    else
+        {
+        iVFbitmap = iFirstVfBuf;
+        iFirstVFBuffer = EFalse;
+        }
+    //If Scaling is ongoing
+    if ( iActiveWaitScale->IsActive() )
+        {
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ScaleCopy(): active, storing size"), RThread().Id().operator TUint()));
+        iWantedVFSize = aSize;
+        }
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ScaleCopy(): scaling NOW"), RThread().Id().operator TUint()));
+        iActiveWaitScale->InitializeWaiter( &VFRescalingFinished );
+        TInt result( iVFbitmap->Bitmap().Resize( aSize ) );
+        __IF_DEBUG(Print(_L("VideoSource [%d]: CMultiframeProvider::ScaleCopy() result %d <<"), RThread().Id().operator TUint(), result));
+        if ( result != KErrNone )
+            {
+            iActiveWaitScale->Signal( result );
+            }
+        else
+            {
+            iVtImageScalerScale->Scale( *iScaled, *iVFbitmap );
+            }
+        }
+    }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::NextFrame()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::NextFrame()
+    {
+    iFreezeCS.Wait();
+    iInitialization = EFalse;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::NextFrame() >>"), RThread().Id().operator TUint()));
+    
+    if ( iNumOfConsumers < 1 )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::NextFrame() Consumer < 1>>"), RThread().Id().operator TUint()));
+        iFreezeCS.Signal();
+        return;
+        }
+    
+    if (iCount > 1 && !iActiveWaitInit->IsActive() )
+        {
+        if (iWaitForConverting)
+            {
+            __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::NextFrame() Because CMultiframeloopAO::RunL is executing, so Signal is not needed"), RThread().Id().operator TUint()));
+            }
+        else
+            {
+            iLoopAo->Signal();
+            }
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::NextFrame() <<"), RThread().Id().operator TUint()));
+    iFreezeCS.Signal();
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::IncreaseDataConsumer()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::IncreaseDataConsumer()
+    {
+    iFreezeCS.Wait();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::IncreaseDataConsumer() >>"), RThread().Id().operator TUint()));
+    ++iNumOfConsumers;
+    iFreezeCS.Signal();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::IncreaseDataConsumer() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::DecreaseDataConsumer()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::DecreaseDataConsumer()
+	  {
+		iFreezeCS.Wait();
+		__IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::DecreaseDataConsumer() >>"), RThread().Id().operator TUint()));
+		--iNumOfConsumers;
+		if ( iNumOfConsumers < 1 )
+    	  {
+  		  iLoopAo->CancelDataLoop();
+        iDataTimer->CancelTimeLoop();
+  	  	}
+  	__IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::DecreaseDataConsumer() <<"), RThread().Id().operator TUint()));  	
+  	iFreezeCS.Signal();
+	  }
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ScaleVF( const TSize& aSize )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ScaleVF( const TSize& aSize )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScaleVF() >>"), RThread().Id().operator TUint()));
+    iActiveWaitScale->InitializeWaiter( &VFRescalingFinished );
+    TInt result( iVFbitmap->Bitmap().Resize( aSize ) );
+    ClearVFScalingTargetSize();
+    if ( result != KErrNone )
+        {
+        iActiveWaitScale->Signal( result );
+        }
+    else
+        {
+        iVtImageScalerScale->Scale( *iScaled, *iVFbitmap );
+        }
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScaleVF() result %d <<"), RThread().Id().operator TUint(), result));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::VFRescalingFinished( TInt aError )
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::VFRescalingFinished( TInt aError )
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFRescalingFinished() >>"), RThread().Id().operator TUint()));
+    if ( aError == KErrNone )
+        {
+        if ( iWantedVFSize != TSize() )
+            {
+            __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFRescalingFinished() REScaling needed"), RThread().Id().operator TUint()));
+            ScaleVF( iWantedVFSize );
+            ClearVFScalingTargetSize();
+            }
+        else
+            {
+            iDataTimer->CancelTimeLoop();
+            
+            if ( !iIsVfStopped && !iVFUpdate )
+                {
+                //Normally, VF and VS work
+                iVFCurrent = iVFbitmap;
+                iYUVBitMap = iScaled;
+                iDataTimer->LocalBuffer(iVFCurrent);
+                iDataTimer->RemoteBuffer(iYUVBitMap);
+                __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScalecopyRemoteAndUpdate() normal, iFrameUpdateTime %d>>"), RThread().Id().operator TUint(),
+                        iFrameUpdateTime.Int64()));
+                iDataTimer->Activate(iFrameUpdateTime, iInitialization, iVFUpdate);
+                }
+            else if ( iIsVfStopped && !iVFUpdate )
+                {
+                //VF doesn't work.
+                iYUVBitMap = iScaled;
+                iDataTimer->RemoteBuffer(iYUVBitMap);
+                __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScalecopyRemoteAndUpdate() VF Stop, iFrameUpdateTime %d>>"), RThread().Id().operator TUint(),
+                        iFrameUpdateTime.Int64()));                
+                iDataTimer->Activate( iFrameUpdateTime, iInitialization, iVFUpdate);
+                }
+            else if ( iIsVfStopped && iVFUpdate )
+                {
+                //VF restart 
+                iIsVfStopped = EFalse;
+                iVFUpdate = EFalse;
+                iVFCurrent = iVFbitmap;
+                iYUVBitMap = iScaled;
+                iDataTimer->LocalBuffer(iVFCurrent);
+                iDataTimer->RemoteBuffer(iYUVBitMap);
+                __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScalecopyRemoteAndUpdate() VF Restart iFrameUpdateTime 1>>"),
+                        RThread().Id().operator TUint()));
+                iDataTimer->Activate(1, iInitialization, iVFUpdate);
+                }
+            else
+                {
+                //maybe this condition never execute.
+                iVFCurrent = iVFbitmap;
+                iDataTimer->LocalBuffer(iVFCurrent);
+                __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ScalecopyRemoteAndUpdate() last one, iFrameUpdateTime %d>>"), RThread().Id().operator TUint(),
+                        iFrameUpdateTime.Int64()));                
+                iDataTimer->Activate( 1, iInitialization, iVFUpdate);
+                }
+            }
+        }
+#if 0
+    else if ( ( aError == KErrCancel ) )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFRescalingFinished() CANCEL"), RThread().Id().operator TUint()));
+        }
+    else if( aError != KErrCancel ) // If KErrCancel, then ignore error!
+        {
+        iObserver->NotifyImageHandlingError( aError );
+        }
+#endif
+    else
+        {
+        iObserver->NotifyImageHandlingError( aError );
+        }
+    
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::VFRescalingFinished() err %d <<"), RThread().Id().operator TUint(), aError));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::IsVFStopped()
+// -----------------------------------------------------------------------------
+//
+TBool CMultiframeProvider::IsVFStopped()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::IsVFStopped() >>"), RThread().Id().operator TUint()));
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::IsVFStopped() <<"), RThread().Id().operator TUint()));
+    return iIsVfStopped;
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::SetVFStop()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::SetVFStop()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::SetVFStop() >>"), RThread().Id().operator TUint()));
+    iIsVfStopped = ETrue;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::SetVFStop() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::WaitForConverting()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::WaitForConverting()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::WaitForConverting() >>"), RThread().Id().operator TUint()));
+    iWaitForConverting = ETrue;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::WaitForConverting() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::WaitForConverting()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ReleaseForConverting()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ReleaseForConverting() >>"), RThread().Id().operator TUint()));
+    iWaitForConverting = EFalse;
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ReleaseForConverting() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::ClearVFScalingTargetSize()
+// -----------------------------------------------------------------------------
+//
+void CMultiframeProvider::ClearVFScalingTargetSize()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ClearVFScalingTargetSize() >>"), RThread().Id().operator TUint()));
+    iWantedVFSize = TSize();
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::ClearVFScalingTargetSize() <<"), RThread().Id().operator TUint()));
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiframeProvider::CancelInitializing()
+// -----------------------------------------------------------------------------
+//
+TBool CMultiframeProvider::CancelInitializing()
+    {
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CancelInitializing() >>"), RThread().Id().operator TUint()));
+    TBool lResult = EFalse;
+    
+    if ( NULL == iImageDecoder )
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CancelInitializing() iImageDecoder is NULL ==="), RThread().Id().operator TUint()));
+        // In this condition, Convert is already finished
+        if ( iVtImageScalerInit->IsActive() )
+            {
+            __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() iVtImageScalerInit->Cancel ==="), 
+                    RThread().Id().operator TUint(), __LINE__));
+            iVtImageScalerInit->Cancel();
+            }
+        else if ( iActiveWaitInitScale->IsActive() )
+            {
+            __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() iActiveWaitInitScale->Cancel ==="), 
+                    RThread().Id().operator TUint(), __LINE__));
+            iActiveWaitInitScale->Cancel();
+            }            
+        else if ( iVtImageScalerScale->IsActive() )
+            {
+            __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() iVtImageScalerScale->Cancel ==="), 
+                    RThread().Id().operator TUint(), __LINE__));
+            iVtImageScalerScale->Cancel();
+            }
+        else if ( iActiveWaitScale->IsActive() )
+            {
+            __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() iActiveWaitScale->Cancel ==="), 
+                    RThread().Id().operator TUint(), __LINE__));
+            iActiveWaitScale->Cancel();
+            }
+        else
+            {
+            //In this condition, the convert,scale,copyScale were finished,
+            //so do nothing, Waiting for InitializeReady()
+            __IF_DEBUG(Print(_L("VideoSource[%d] Line[%d]: CMultiframeProvider::CancelInitializing() Nothong to do,wait finish ==="), 
+                    RThread().Id().operator TUint(), __LINE__));
+            }
+        }
+    else
+        {
+        __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CancelInitializing() cancel convert ==="), RThread().Id().operator TUint()));
+        //Convert is not finished, so we can cancel it, and return ETrue
+        iImageDecoder->Cancel();
+        lResult = ETrue;
+        }
+    
+    __IF_DEBUG(Print(_L("VideoSource[%d]: CMultiframeProvider::CancelInitializing() <<"), RThread().Id().operator TUint()));
+    return lResult;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolplugins/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  Build information for Video Telephony protocol subsystem.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Include components' bld.inf files
+#include "../DisplaySink/group/bld.inf"
+#include "../VideoSource/group/bld.inf"
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/bwins/videotelprotou.def	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	?DeleteAudioSink@VTProtocolFactory@@SAHPAVMVTAudioSink@@@Z @ 1 NONAME ; int VTProtocolFactory::DeleteAudioSink(class MVTAudioSink *)
+	?CreateAudioSink@VTProtocolFactory@@SAPAVMVTAudioSink@@XZ @ 2 NONAME ; class MVTAudioSink * VTProtocolFactory::CreateAudioSink(void)
+	?CreateCommServerL@VTProtocolFactory@@SAPAVMCommServer@@ABVTDesC16@@H@Z @ 3 NONAME ; class MCommServer * VTProtocolFactory::CreateCommServerL(class TDesC16 const &, int)
+	?CreateUserInputIndication@VTProtocolFactory@@SAPAVMVTUserInput@@W4TUserInputType@@E@Z @ 4 NONAME ; class MVTUserInput * VTProtocolFactory::CreateUserInputIndication(enum TUserInputType, unsigned char)
+	?CreateSessionCommandL@VTProtocolFactory@@SAPAVMVtSessionCommand@@PAVMVtProtocolHandler@@HAAW4TVt3G324MSupported@@@Z @ 5 NONAME ; class MVtSessionCommand * VTProtocolFactory::CreateSessionCommandL(class MVtProtocolHandler *, int, enum TVt3G324MSupported &)
+	?DeletAudioSource@VTProtocolFactory@@SAHPAVMVTAudioSource@@@Z @ 6 NONAME ; int VTProtocolFactory::DeletAudioSource(class MVTAudioSource *)
+	?GetAudioConfigCommandL@VTProtocolFactory@@SAPAVMVtAudioConfigCommand@@PAVMVTAudioSink@@@Z @ 7 NONAME ; class MVtAudioConfigCommand * VTProtocolFactory::GetAudioConfigCommandL(class MVTAudioSink *)
+	?CreateAudioSource@VTProtocolFactory@@SAPAVMVTAudioSource@@XZ @ 8 NONAME ; class MVTAudioSource * VTProtocolFactory::CreateAudioSource(void)
+	?DeleteCommServerL@VTProtocolFactory@@SAXPAVMCommServer@@@Z @ 9 NONAME ; void VTProtocolFactory::DeleteCommServerL(class MCommServer *)
+	?DeleteUserInputIndication@VTProtocolFactory@@SAXPAVMVTUserInput@@@Z @ 10 NONAME ; void VTProtocolFactory::DeleteUserInputIndication(class MVTUserInput *)
+	?DeleteSessionCommand@VTProtocolFactory@@SAXPAVMVtSessionCommand@@@Z @ 11 NONAME ; void VTProtocolFactory::DeleteSessionCommand(class MVtSessionCommand *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/eabi/videotelprotou.def	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	_ZN17VTProtocolFactory15CreateAudioSinkEv @ 1 NONAME
+	_ZN17VTProtocolFactory15DeleteAudioSinkEP12MVTAudioSink @ 2 NONAME
+	_ZN17VTProtocolFactory16DeletAudioSourceEP14MVTAudioSource @ 3 NONAME
+	_ZN17VTProtocolFactory17CreateAudioSourceEv @ 4 NONAME
+	_ZN17VTProtocolFactory17CreateCommServerLERK7TDesC16i @ 5 NONAME
+	_ZN17VTProtocolFactory17DeleteCommServerLEP11MCommServer @ 6 NONAME
+	_ZN17VTProtocolFactory20DeleteSessionCommandEP17MVtSessionCommand @ 7 NONAME
+	_ZN17VTProtocolFactory21CreateSessionCommandLEP18MVtProtocolHandleriR18TVt3G324MSupported @ 8 NONAME
+	_ZN17VTProtocolFactory22GetAudioConfigCommandLEP12MVTAudioSink @ 9 NONAME
+	_ZN17VTProtocolFactory25CreateUserInputIndicationE14TUserInputTypeh @ 10 NONAME
+	_ZN17VTProtocolFactory25DeleteUserInputIndicationEP12MVTUserInput @ 11 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2004 - 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:  vtprotocols build information file.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+
+../inc/mvtprotocolhandler.h                    |../../inc/mvtprotocolhandler.h
+
+
+PRJ_MMPFILES
+
+../group/videotelproto.mmp
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/group/videotelproto.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* 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:  This is project specification file for the Vtprotocols.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+TARGET          videotelproto.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x20021182
+
+
+SOURCEPATH      ../src
+
+SOURCE          cdatasinkproxy.cpp
+SOURCE          cdatasourceproxy.cpp
+SOURCE          caudioconfighandler.cpp
+SOURCE          ch324confighandler.cpp
+SOURCE          csessionhandler.cpp
+SOURCE          cvideoconfighandler.cpp
+SOURCE          cvtuserinput.cpp
+SOURCE          vtprotocolfactory.cpp
+
+DOCUMENT        ../../group/bld.inf
+
+USERINCLUDE     ../inc/
+
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../inc
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+SYSTEMINCLUDE   /epoc32/include/mmf/server
+
+LIBRARY euser.lib
+LIBRARY ws32.lib
+
+LIBRARY	commonengine.lib
+LIBRARY mediaclientaudio.lib
+
+
+
+DEBUGLIBRARY vtlogger.lib
+
+LIBRARY pv2waysymbianadapter.lib
+LIBRARY mmfdevsound.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/caudioconfighandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* 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:  .
+*
+*/
+
+
+#ifndef CAUDIOCONFIGHANDLER_H
+#define CAUDIOCONFIGHANDLER_H
+NONSHARABLE_CLASS( TAudioConfigHandler ) : public MPVAudioOutputControlObserver
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        TAudioConfigHandler( MVtProtocolHandler* aProtocolHandler);
+
+        /** 
+        *  Signals completion of the audio output control command.
+        *  @param aId The command id of the completed command.
+        *  @param aCmd The command type.
+        *  @param aContextData The context data passed in with the command.
+        *  @param aStatus The command completion status.
+        **/
+        virtual void AudioOutputControlCommandComplete(TPVCommandId aId
+                ,TPVAudioOutputControlCommand aCmd
+                ,TAny *aContextData
+                ,TInt aStatus);
+    private:
+        MVtProtocolHandler* iProtocolHandler;
+    };
+    
+NONSHARABLE_CLASS( CAudioConfigCommand ) : public CBase,
+                            public MVtAudioConfigCommand
+    {
+    public:
+        
+        /**
+         * Constructor.
+         */
+        CAudioConfigCommand(MPVAudioOutputControl* aAudioCtrl);
+        
+        /**
+         * Destructor.
+         */
+        ~CAudioConfigCommand();
+
+        /**
+         * Method to set the playback volume to the specified value.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * It is also an asynchronous function which will be answered with a callback.
+         * 
+         * @param aNewVolume
+         *        An input parameter to hold the value for the requested playback volume.  
+         *
+         * @returns   TInt
+         *            Returns a command ID that can be used to identify a command completion result with corresponding request.
+         */
+        virtual TInt SetAudioVolumeL(TInt aVolume);
+
+        /**
+         * Method to get the maximum valid value for the playback volume.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * It is also an asynchronous function which will be answered with a callback.
+         * 
+         * @param aMaxVolume
+         *        An output parameter to hold the value for the maximum valid playback volume.  
+         *            Note that the parameter should not be used until the callback indicates that the 
+         *            method has completed.
+         *
+         * @returns   TInt
+         *            Returns a command ID that can be used to identify a command completion result with corresponding request.
+         */
+        virtual TInt GetMaxAudioVolumeL(TInt& aMaxVolume);
+
+        /**
+         * This API allows the user to specify observers for the 324m interface.
+         *
+         * @param aHandler     
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler);
+    private:
+        MPVAudioOutputControl* iAudioCtrl;
+        TAudioConfigHandler* iAudioConfigHandler;
+    };
+#endif
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/ccommserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  
+*
+*/
+
+#ifndef CCOMMSERVER_H
+#define CCOMMSERVER_H
+NONSHARABLE_CLASS( CCommServer ) : public CBase,
+                                   public MCommServer
+    {
+    public:
+        MPVCommServerBase* iComm;
+    };
+#endif
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/cdatasinkproxy.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,270 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef CDATASINKPROXY_H
+#define CDATASINKPROXY_H
+NONSHARABLE_CLASS( CPVDisplaySinkNodeProxy ) : public CBase,
+                                               public MVTVideoSource
+    {
+    public: //New
+        /**
+         * Constructor .
+         */
+        CPVDisplaySinkNodeProxy();
+        /**
+         * Set new supplier.
+         * @param aSupplier
+         */
+        void SetSupplier(MPVDataSourceBase* aSupplier);
+    public: //From MVTVideoSource
+        /**
+         * Method called by a data sink to pass back an emptied buffer to the source
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used as the callback when the data source actively requests a consumer ie a data sink
+         * to empty a buffer by calling the data sinks EmptyBufferL.
+         * When the data source gets this callback it knows that the buffer has been emptied and can be reused
+         * 
+         * @param   "aBuffer"
+         *          The buffer that has been emptied by a data sink and is now available for reuse
+         */
+        virtual void BufferEmptiedL(CMMFBuffer* aBuffer);
+    private:
+        MPVDataSourceBase* iSupplier;
+    };
+
+NONSHARABLE_CLASS( CDisplaySinkProxy ) : public CBase,
+                                         public MPVDataSink,
+                                         public MPVVideoOutput
+    {
+    public: //From MPVPluginBase
+        /**
+         * This API returns multimedias type supported by the data source/sink - 
+         * Audio, Video, Data etc.  Each supported type is indicated by a MIME type structure.
+         * @return Multimedia types supported by the data source/sink.  The reference 
+         * is valid until the MPVPluginBase derived object is destroyed.
+         **/
+        virtual const RArray<TPVMIMEType *>& GetMultimediaTypesL() const;
+        /**
+         * This API is to allow for extensibility of the plugin interface.
+         * It allows a caller to ask for all UUIDs associated with a particular MIME type.
+         * If interfaces of the requested MIME type are found within the plugin, they are added 
+         * to the UUIDs array.  
+         * 
+         * Also added to the UUIDs array will be all interfaces which have the requested MIME 
+         * type as a base MIME type.  This functionality can be turned off.
+         * 
+         * @param aMimeType The MIME type of the desired interfaces
+         * @param aUuids An array to hold the discovered UUIDs
+         * @param aExactUuidsOnly Turns on/off the retrival of UUIDs with aMimeType as a base type
+         **/
+        virtual void QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly = false );
+        /**
+         * This API is to allow for extensibility of the plugin interface.
+         * It allows a caller to ask for an instance of a particular interface object to be returned.
+         * The mechanism is analogous to the COM IUnknown method.  The interfaces are identified with
+         * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+         * returned if it is supported.  Otherwise the returned pointer is NULL.
+         * @param aUuid The UUID of the desired interface
+         * @param aInterfacePtr The output pointer to the desired interface
+         **/
+        virtual void QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr );
+        /**
+         *  This API is used to provide a timebase for plugins that deal with synchronized media data
+         **/
+        virtual void SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase);
+    public: //From MPVDataSinkBase
+        /**
+         * Method called by a MDataSource to request the data sink to empty aBuffer of data.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used when a data sink is passively waiting for requests from a supplier ie a data source
+         * to empty a buffer.  The data sink must call the BufferEmptiedL member on aSupplier when it has emptied
+         * the buffer of it's data - the data sink can either make this callback synchronously or asynchronously.
+         * 
+         * @param   "aBuffer"
+         *          The full buffer that needs emptying of it's data
+         *
+         * @param   "aSupplier" 
+         *          The data source that supplied the data. The data sink needs this to make the BufferEmptiedL
+         *          callback on aSupplier to indicate to the data source that the data sink has finished with the buffer.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data
+         */
+        virtual void EmptyBufferL(CMMFBuffer* aBuffer, MPVDataSourceBase* aSupplier, TMediaId aMediaId);
+        /**
+         * Method called by a data source to pass back an filled buffer to the sink
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used as the callback when the data sink actively requests a supplier ie a data source
+         * to fill a buffer by calling the data sources FillBufferL.
+         * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied
+         * 
+         * @param   "aBuffer"
+         *          The buffer that has been filled by a data source and is now available for processing
+         */
+        virtual void BufferFilledL(CMMFBuffer* aBuffer);
+        /**
+         * Method to indicate whether the data sink can create a buffer.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * 
+         * @return  ETrue if the data sink can create a buffer else EFalse
+         */
+        virtual TBool CanCreateSinkBuffer();
+        /**
+         * Returns a buffer created by the data sink
+         *
+         * This is a pure virtual function that each derived class must implement.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data.
+         *
+         * @param   "aReference"
+         *          This must be written to by the method to indicate whether the created buffer is
+         *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the sink
+         *          and should be used in preference to the source buffer provided the source buffer
+         *          is also not a reference buffer.
+         * .  
+         * @return  The created buffer
+         */
+        virtual CMMFBuffer* CreateSinkBufferL(TMediaId aMediaId, TBool &aReference );
+        /**
+         * Method to 'logon' the data sink to the same thread that sink will be consuming data in.
+         *
+         * This method may be required as the thread that the data sink was created in is not always
+         * the same thread that the data transfer will take place in.  Therefore any thread specific
+         * initialisation needs to be performed in the SinkThreadLogon rather than in the creation 
+         * of the data sink.
+         *
+         * This is a virtual function that a derrived data sink can implement if any thread specific
+         * initialisation is required and/or the data sink can create any asynchronous events.
+         * 
+         * 
+         * @param   "aEventHandler"
+         *          This is an MAsyncEventHandler to handle asynchronous events that occur during the
+         *          transfer of multimedia data.  The event handler must be in the same thread as the data transfer
+         *          thread - hence the reason it is passed in the SinkThreadLogon as opposed to say the constructor.
+         *
+         *
+         * @return  KErrNone if successful, otherwise a system wide error code.
+         */
+        virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler );
+        /**
+         * Method to 'logoff' the data sink from the same thread that sink consumes data in.
+         *
+         * This method may be required as the thread that the data sink is deleted in may not be
+         * the same thread that the data transfer took place in.  Therefore any thread specific
+         * releasing of resources needs to be performed in the SinkThreadLogoff rather than in the destructor
+         *
+         * This is a virtual function that a derrived data sink can implement if any thread specific
+         * releasing of resources is required.
+         */
+        virtual void SinkThreadLogoff();
+        /**
+         * Method to 'prime' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific 'priming' is required
+         */
+        virtual TInt SinkPrimeL();
+        /**
+         * Method to 'play' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific action is required prior to 'playing'ie the start of data transfer
+         */
+        virtual TInt SinkPlayL();
+        /**
+         * Method to 'pause' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific action is required to 'pause'
+         */
+        virtual TInt SinkPauseL();
+
+        /**
+         * Method to 'stop' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific action is required to 'stop'
+         */
+        virtual TInt SinkStopL();
+    public: //From MPVVideoOutput
+
+        /**
+         * Set the video frame format.  This must be from the list of supported formats.
+         * @param "aFormat" A mime string describing the video frame format.
+         * @exception Can leave with one of the system wide error codes
+         **/
+        virtual void SetFormatL(const TDesC8& aFormat);
+
+        /**
+         * Set the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         **/
+        virtual void SetVideoFrameSizeL(const TSize& aSize);
+
+        /**
+         * Get the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         **/
+        virtual void GetVideoFrameSizeL(TSize& aSize) const;
+    public:
+        /**
+         * Constructor.
+         */
+        CDisplaySinkProxy(MVTVideoSink* aDisplaySink);
+        
+        /**
+         * ConstructL
+         */
+        void ConstructL();
+
+        /**
+         * NewL
+         */
+        static CDisplaySinkProxy* NewL(MVTVideoSink* aDisplaySink);
+        /**
+         * Get pointer object of data sink.
+         * @return member variant:iDisplaySink
+         */
+        MVTVideoSink* DisplaySink() { return iDisplaySink; }
+    private:
+        MVTVideoSink* iDisplaySink;
+        CPVDisplaySinkNodeProxy* iDSNodeProxy;
+        
+    };
+
+NONSHARABLE_CLASS( CAudioSinkProxy ) : public CBase,
+                                       public MVTAudioSink
+    {
+    public:
+        MPVDataSink* iAudioSink;
+    };
+    
+#endif
+//  End of File 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/cdatasourceproxy.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,322 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef CDATASOURCEPROXY_H
+#define CDATASOURCEPROXY_H
+NONSHARABLE_CLASS( CPVCameraSourceNodeProxy ) : public CBase,
+                                                public MAsyncEventHandler, 
+                                                public MVTVideoSink
+    {
+    public: //From MAsyncEventHandler
+        /**
+         * Send event to client.
+         * @param aEvent 
+         */
+        virtual TInt SendEventToClient(const TMMFEvent &aEvent);
+    public: //From MVTVideoSink
+
+        /**
+         * Method called by a data source to pass back an filled buffer to the sink.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used as the callback when the data sink actively requests a supplier ie a data source
+         * to fill a buffer by calling the data sources FillBufferL.
+         * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied
+         * 
+         * @param   "aBuffer"
+         *          The buffer that has been filled by a data source and is now available for processing
+         */
+        void BufferFilledL(CMMFBuffer* aBuffer);
+               
+    public: //New
+        /**
+         * Constructor.
+         */
+        CPVCameraSourceNodeProxy();
+        
+        /**
+         * Set consumer object.
+         * @param aConsumer new object
+         */
+        void SetConsumer(MPVDataSinkBase* aConsumer);
+    private:
+        MPVDataSinkBase* iConsumer;        
+    };
+
+NONSHARABLE_CLASS( CVideoSourceProxy ) : public CBase,
+                                         public MPVDataSource, 
+                                         public MPVVideoInput
+    {
+    public: //From MPVPluginBase
+
+        /**
+         * This API returns multimedias type supported by the data source/sink - 
+         * Audio, Video, Data etc.  Each supported type is indicated by a MIME type structure.
+         * @return Multimedia types supported by the data source/sink.  The reference 
+         * is valid until the MPVPluginBase derived object is destroyed.
+         **/
+        virtual const RArray<TPVMIMEType *>& GetMultimediaTypesL() const;
+
+        /**
+         * This API is to allow for extensibility of the plugin interface.
+         * It allows a caller to ask for all UUIDs associated with a particular MIME type.
+         * If interfaces of the requested MIME type are found within the plugin, they are added 
+         * to the UUIDs array.  
+         * 
+         * Also added to the UUIDs array will be all interfaces which have the requested MIME 
+         * type as a base MIME type.  This functionality can be turned off.
+         * 
+         * @param aMimeType The MIME type of the desired interfaces
+         * @param aUuids An array to hold the discovered UUIDs
+         * @param aExactUuidsOnly Turns on/off the retrival of UUIDs with aMimeType as a base type
+         **/
+        virtual void QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly = false );
+
+        /**
+         * This API is to allow for extensibility of the plugin interface.
+         * It allows a caller to ask for an instance of a particular interface object to be returned.
+         * The mechanism is analogous to the COM IUnknown method.  The interfaces are identified with
+         * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+         * returned if it is supported.  Otherwise the returned pointer is NULL.
+         * @param aUuid The UUID of the desired interface
+         * @param aInterfacePtr The output pointer to the desired interface
+         **/
+        virtual void QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr );
+
+        /**
+         *  This API is used to provide a timebase for plugins that deal with synchronized media data
+         **/
+        virtual void SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase);
+    public: //From MPVDataSourceBase
+
+        /**
+         * Method called by a MDataSink to request the data source to fill aBuffer with data.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used when a data source is passively waiting for requests from a consumer ie a data sink
+         * to fill a buffer.  The data source must call the BufferFilledL member on aConsumer when it has filled
+         * the buffer with data - the data source can either make this callback synchronously or asynchronously.
+         * 
+         * @param   "aBuffer"
+         *          The buffer that needs filling with data
+         *
+         * @param   "aConsumer" 
+         *          The data sink that consumes the data. The data source needs this to make the BufferFilledL
+         *          callback on aConsumer when the data source has completed filling the aBuffer.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data eg a multimedia file
+         */
+        virtual void FillBufferL(CMMFBuffer* aBuffer, MPVDataSinkBase* aConsumer, TMediaId /*aMediaId*/);
+
+        /**
+         * Returns a buffer created by the data source.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data eg a multimedia file
+         *
+         * @param   "aReference"
+         *          This must be written to by the method to indicate whether the created buffer is
+         *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the source
+         *          and should be used in preference to the sink buffer provided the sink buffer
+         *          is also not a reference buffer
+         * .  
+         * @return  The created buffer
+         */
+        virtual CMMFBuffer *CreateSourceBufferL(TMediaId aMediaId, TBool &aReference);
+
+        /**
+         * Returns a buffer created by the data source.
+         *
+         * This is a virtual function that a derived class can implement.
+         * This can be used in preference to the above CreateSourceBufferL method in cases where
+         * the source buffer creation has a dependancy on the sink buffer
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data eg a multimedia file
+         *
+         * @param   "aSinkBuffer"
+         *          The sink buffer the nature of which may influence the creation of the source buffer
+         *
+         * @param   "aReference"
+         *          This must be written to by the method to indicate whether the created buffer is
+         *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the source
+         *          and should be used in preference to the sink buffer provided the sink buffer is not a reference buffer
+         * .  
+         * @return  The created buffer
+         */
+        virtual CMMFBuffer *CreateSourceBufferL(TMediaId aMediaId, CMMFBuffer &aSinkBuffer, TBool &aReference);
+
+        /**
+         * Method to 'logon' the data source to the same thread that source will be supplying data in.
+         *
+         * This method may be required as the thread that the data source was created in is not always
+         * the same thread that the data transfer will take place in.  Therefore any thread specific
+         * initialisation needs to be performed in the SourceThreadLogon rather than in the creation 
+         * of the data source.
+         *
+         * This is a virtual function that a derrived data source can implement if any thread specific
+         * initialisation is required and/or the data source can create any asynchronous events.
+         * 
+         * 
+         * @param   "aEventHandler"
+         *          This is an MAsyncEventHandler to handle asynchronous events that occur during the
+         *          transfer of multimedia data.  The event handler must be in the same thread as the data transfer
+         *          thread - hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor.
+         *
+         *
+         * @return  KErrNone if successful, otherwise a system wide error code.
+         */
+        virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler );
+        
+        /**
+         * Method to 'logoff' the data source from the same thread that source supplies data in.
+         *
+         * This method may be required as the thread that the data source is deleted in may not be
+         * the same thread that the data transfer took place in.  Therefore any thread specific
+         * releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor
+         *
+         * This is a virtual function that a derrived data source can implement if any thread specific
+         * releasing of resources is required.
+         */
+        virtual void SourceThreadLogoff();
+
+        /**
+         * Method to 'prime' the data source.
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific 'priming' is required
+         */
+        virtual TInt SourcePrimeL();
+
+        /**
+         * Method to 'play' the data source.
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific action is required prior to 'playing'ie the start of data transfer
+         */
+        virtual TInt SourcePlayL();
+
+        /**
+         * Method to 'pause' the data source.
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific action is required to 'pause'
+         */
+        virtual TInt SourcePauseL();
+
+        /**
+         * Method to 'stop' the data source.
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific action is required to 'stop'
+         */
+        virtual TInt SourceStopL();
+
+        /**
+         * Method called by a data sink to pass back an emptied buffer to the source
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used as the callback when the data source actively requests a consumer ie a data sink
+         * to empty a buffer by calling the data sinks EmptyBufferL.
+         * When the data source gets this callback it knows that the buffer has been emptied and can be reused
+         * 
+         * @param   "aBuffer"
+         *          The buffer that has been emptied by a data sink and is now available for reuse
+         */
+        virtual void BufferEmptiedL(CMMFBuffer* aBuffer);
+
+        /**
+         * Method to indicate whether the data source can create a buffer.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * 
+         * @return  ETrue if the data source can create a buffer else EFalse
+         */
+        virtual TBool CanCreateSourceBuffer();
+    public: //From MPVVideoInput
+
+        /**
+         * Set the video frame format.  This must be from the list of supported formats.
+         * @param "aFormat" The mime string describing the video frame format.
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void SetFormatL(const TDesC8& aFormat);
+        
+        /**
+         * Set the video frame rate.  This must be within the range of supported frame rates
+         * for the current frame size.
+         * @param "aFrameRate" The video frame rate to set.
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void SetFrameRateL(TReal32 aFrameRate);
+
+        /**
+         * Set the video frame size.
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void SetVideoFrameSizeL(const TSize& aSize);
+
+        /**
+         * Get the video frame size.
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void GetVideoFrameSizeL(TSize& aSize) const;
+    public: //new
+        /**
+         * Constructor.
+         */
+        CVideoSourceProxy(MVTVideoSource* aVideoSource);
+        /**
+         * ConstructL.
+         */
+        void ConstructL( );
+        
+        /**
+         * NewL.
+         */
+        static CVideoSourceProxy* NewL(MVTVideoSource* aVideoSource);
+        
+        /**
+         * Get member variant.
+         * @return memeber variant:iVideoSource
+         */
+        MVTVideoSource* VideoSource() { return iVideoSource; }
+    private:
+        MVTVideoSource* iVideoSource;
+        CPVCameraSourceNodeProxy* iCameraSourceNodeProxy;
+    };
+
+NONSHARABLE_CLASS( CAudioSourceProxy ) : public CBase, 
+                                         public MVTAudioSource
+    {
+    public:
+        MPVDataSource* iAudioSource;
+    };
+#endif
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/ch324confighandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef CH324ConfigHandler_H
+#define CH324ConfigHandler_H
+NONSHARABLE_CLASS( TH324ConfigHandler ) : public MPVH324MConfigSymbianObserver
+    {
+    public:
+        
+        /**
+         * Constructor.
+         */
+        TH324ConfigHandler(MVtProtocolHandler* aProtocolHandler);
+
+        /**
+        Handle an event that has been generated.
+
+        @param aResponse  The response to a previously issued command.
+        */
+        virtual void MPVH324MConfigCommandCompletedL(const CPVCmdResponse& aResponse);
+
+        /**
+        Handle an information event.
+
+        @param aEvent  
+        */
+        virtual void MPVH324MConfigInformationalEventL(const CPVAsyncInformationalEvent& aEvent);
+    private:
+        MVtProtocolHandler* iProtocolHandler;
+    };
+ 
+NONSHARABLE_CLASS( CH324ConfigCommand ): public CBase,
+                                         public MVtH324ConfigCommand
+    {
+    public:
+        /**
+         * Destructor.
+         */
+        ~CH324ConfigCommand();
+
+        /**
+         * Sets the vendor identification data.  This does not cause the stack to issue a vendor identifiation request.
+         * Set to NULL to disable sending vendor id.  If set to a valid parameter before Connect, it will cause the stack
+         * to automatically send it along with the TCS message.
+         * @param cc
+         *         T35 Country code
+         * @param ext
+         *         T35 Extension
+         * @param mc
+         *         T35 Manufacturer code
+         * @param aProduct
+         *         Product number
+         * @param aVersion
+         *         Version number
+         **/
+        virtual TInt SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion);
+
+        /**
+         * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+         * It is a request to the remote encoder to adjust its encoding in accordance with the tradeoff value.
+         * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+         * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+         * to precise values of spatial resolution or frame rate.
+         *
+         **/
+        virtual TInt SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff);
+
+        /**
+         * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+         * It is an indication to the remote decoder that the local encoder has adjusted its encoding parameters
+         * according to the tradeoff value.
+         * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+         * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+         * to precise values of spatial resolution or frame rate.
+         *
+         **/
+        virtual TInt SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff);
+
+        /**
+         * This API allows the user to specify the supported resolutions for video for transmit and receive.
+         *
+         **/
+        virtual TInt SetSupportedResolutions( );
+        /**
+        * This API allows the user to set options for fast call setup procedures
+        **/
+        virtual TInt SetFastCsupOptions( );
+
+        /**
+         * Causes the protocol to send the specified user input to the remote terminal using
+         * control channel.  The user input can be either DTMF ot Alphanumeric
+         * @param user_input A pointer to MVTUserInput
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt SendUserInputMessageL(MVTUserInput& user_input);
+
+        /**
+         * This API allows the user to specify observers for the 324m interface.
+         *
+         * @param aHandler     the observer for command status and unsolicited informational events
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler);
+       
+       /**
+        * Get member variant.
+        */
+        MPVH324MConfig*& PVH324ConfigInterface() { return iH324Config; }
+    private:
+        MPVH324MConfig* iH324Config;
+        TH324ConfigHandler* iH324ConfigHandler;
+    };    
+#endif
+//  End of File
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/csessionhandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,254 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef CSESSIOHANDLER_H
+#define CSESSIOHANDLER_H
+NONSHARABLE_CLASS( TSessionHandler ) : public MPVCommandStatusObserver, 
+                                       public MPVInformationalEventObserver,
+                                       public MPVErrorEventObserver
+    {
+    public:
+
+        /**
+        Handle an event that has been generated.
+
+        @param "aResponse"  "The response to a previously issued command."
+        */
+        virtual void CommandCompletedL(const CPVCmdResponse& aResponse);
+
+        /**
+         * Handle an informational event that has been generated.
+         *
+         * @param "aEvent" "The event to be handled."
+         */
+        virtual void HandleInformationalEventL(const CPVAsyncInformationalEvent& aEvent);
+
+        /**
+         * Handle an error event that has been generated.
+         *
+         * @param "aEvent" "The event to be handled."
+         */
+        virtual void HandleErrorEventL(const CPVAsyncErrorEvent& aEvent); 
+    public:
+        /**
+         * Constructor.
+         */
+        TSessionHandler(MVtProtocolHandler* aProtocolHandler);
+    private:
+        MVtProtocolHandler* iProtocolHandler;
+    };
+
+NONSHARABLE_CLASS( CSessionCommand ): public CBase,
+                                      public MVtSessionCommand
+    {
+    public:
+        /**
+         * Contructor.
+         */
+        CSessionCommand(TSessionHandler* aSessionHandler, MPV2WaySymbianInterface* aPv2Way);
+        
+        /**
+         * Destructor.
+         */
+        ~CSessionCommand();
+
+        /**
+         * This function is valid only in the EIdle state.  It is a no-op when
+         * invoked in any other state.  It causes the protocol to transition
+         * to the ESetup state.  The terminal remains in the EInitializing state during
+         * the transition.
+         *
+         *
+         * @param aInitInfo
+         *         A reference to a TVtInitInfo structure which set Mona on and off
+         *         
+         * @leave   This method can leave with one of the following error codes
+         *          KPVErrInvalidState if invoked in the incorrect state
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt InitProtocolL(TVtInitInfo& aInitInfo);
+
+        /**
+         * For an incoming track (MVTVideoSink) this function  pauses sending
+         * media to the sink (output device) and stops the sink.  It then does the protocol
+         * negotiations with the remote terminal to pause the logical channel for
+         * the specified track.
+         *
+         * For outgoing, it pauses the sending of media from the source and calls Stop() on the
+         * source.  It also performs any necessary protocol negotiations with the remote terminal.
+         * EVtCommandPause will be sent to the observer when the processing completes.
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt PauseVideoL(MVTVideoSource& aDataSource);
+        virtual TInt PauseVideoL(MVTVideoSink& aDataSink);
+        virtual TInt PauseAudioL(MVTAudioSource& aAudioSource);
+
+        /**
+         * Resume a previously paused incoming or outgoing track.  For incoming,
+         * this function starts resumes playing out the media to the appropriate
+         * sink based on the current settings.  For outgoing it resumes encoding
+         * and sending media from the source.
+         *
+         * EVtCommandResume will be invoked will be invoked on the observer when the processing completes.   
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ResumeVideoL(MVTVideoSource& aDataSource);
+        virtual TInt ResumeVideoL(MVTVideoSink& aDataSink);
+        virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource);
+
+        /**
+         * This function is valid only in the ESetup and EInitializing state.  It is a
+         * no-op when invoked in the EIdle state and returns KPVErrInvalidState
+         * if invoked in any other state.
+         *
+         * It causes the protocol to transition back to the EIdle state.  The
+         * terminal remains in the EResetting state during the transition.
+         *
+         * While resetting, the protocol de-allocates all resources resources that
+         * had been previously allocated.  When it completes, ResetComplete is called
+         * and the protocol reverts to the EIdle state.
+         *
+         * @leave   This method can leave with one of the following error codes
+         *          KPVErrInvalidState if invoked in the incorrect state
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ResetProtocolL();
+
+        /**
+         * This function can be invoked only in the ESetup state.  The terminal starts connecting with the remote
+         * terminal based on the specified options and capabilities.
+         * The EVtCommandConnect command completion event will be passed to the observer
+         * when connect completes.
+         * Details about the negotiated session may be obtained by calling the GetSessionParamsL API.
+         * GetSessionParamsL may be called after call setup is started to get the list of available channels
+         * and their capabilities.
+         * Incoming tracks may be opened before ConnectL completes and will be indicated via the
+         * EVtIndicationIncommingTrack event.
+         *
+         * @param aComm
+         *         An optional pointer to a comm server to provide comm source and sink end-points.
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ConnectToProtocolL(MCommServer* aComm);
+
+        /**
+         * Allows an application to provide a media source to be associated with a logical channel
+         * of communication with the peer.  Sources should be added after the EVtIndicationOutgoingTrack
+         * indication is received for a newly established logical channel.  The media type and
+         * channel id associated with the logical channel are specified as part of the indication.
+         * This function accepts a MVtVideoSource which provides additional functionality
+         * for advertizing capability and exposing configuration APIs.  
+         * Data sources could be of the following types:
+         * a)raw media sources like camera, microphone etc.
+         * b)sources of compressed data like file, gateway component etc.
+         *
+         * @param aChannelId
+         *          Indicates the channel id to be associated with this source.
+         * @param aDataSource
+         *          reference to the data source
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle
+         *          KPVErrInvalidState if invoked in the incorrect state
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @return A unique command id for asynchronous completion
+         */
+        virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource);
+        virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource);
+
+        /**
+         * Allows an application to provide a media sink for rendering an incoming media bitstream in a
+         * logical channel of communication with the peer.
+         * AddDataSinkL can be called only for established incoming logical channels identified by a unique
+         * channel id.
+         * Regular incoming channels are established by the peer and are
+         * indicated using the EVtIndicationIncomingTrack indication.
+         * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality
+         * for advertizing capability and exposing configuration APIs.  
+         * EVtCommandAddDataSink event is sent to the observer on completion of this call.
+         *
+         * @param aChannelId
+         *          Indicates the channel id to be associated with this sink.
+         * @param aDataSink The data sink to be added
+         *
+         * @return A unique command id for asynchronous completion
+         **/
+        virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink);
+        virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink);
+
+        /**
+         * This API is to allow the user to cancel all pending requests.  The current request being
+         * processed, if any, will also be aborted.
+         * EVtCommandCancelAllCommands will be passed to the command observer on completion.
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt CancelAllCommandsL( );
+
+        /**
+         * The Disconnect call is valid only when invoked in the EConnecting, and
+         * EConnected states.  It causes the terminal to transition to the
+         * EDisconnecting state.  All the media tracks both incoming and outgoing
+         * will be closed on invoking Disconnect. On completion, the terminal
+         * goes to the ESetup state.
+         *
+         * It is a no-op when called in any other state.
+         *
+         * This is an asynchronous request.  The EvtCommandDisconnect event will be
+         * sent to the observer when the request processing is complete.  This
+         * is the only event the Phone application should expect after calling
+         * Disconnect.
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt DisconnectFromProtocolL();
+
+        /**
+         * This API is to allow for extensibility of the protocol interface.
+         * It allows a caller to ask for an instance of a particular interface object to be returned.
+         * The mechanism is analogous to the COM IUnknown method.  The interfaces are identified with
+         * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+         * returned if it is supported.  Otherwise the returned pointer is NULL.
+         * @param aType
+         * @param aProtocolCommand
+         * @exception not_supported
+         * leaves if the specified interface id is not supported.
+         **/
+        virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand);
+
+        /**
+         * This APIis to be used to release an interface that was previously obtained using
+         * QueryInterfaceL.
+         * @param aType
+         * @param 
+         * @exception not_supported
+         * leaves if the specified interface id is not supported.
+         **/
+        virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand); 
+    public:
+        MPV2WaySymbianInterface *iPv2Way;
+    private:
+        CVideoSourceProxy* iVideoSource;
+        CDisplaySinkProxy* iDisplaySink;
+        TSessionHandler*   iSessionHandler;
+    };
+#endif
+//  End of File
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/cvideoconfighandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef CVideoConfigHandler_H
+#define CVideoConfigHandler_H
+NONSHARABLE_CLASS( TVideoConfigHandler ): public MPvMp4H263EncExtensionSymbianObserver
+    {
+    public:
+        
+        /**
+         * Constructor.
+         */
+        TVideoConfigHandler(MVtProtocolHandler* aProtocolHandler);
+
+        /**
+        Handle an event that has been generated.
+
+        @param aResponse  The response to a previously issued command.
+        */
+        virtual void MPvMp4H263EncExtensionCommandCompletedL(const CPVCmdResponse& aResponse);
+        
+        /**
+        Handle an information event.
+
+        @param aEvent  
+        */
+        virtual void HandleMPvMp4H263EncExtensionInformationalEventL(const CPVAsyncInformationalEvent& aEvent);
+    private:
+        MVtProtocolHandler* iProtocolHandler;
+    };
+
+NONSHARABLE_CLASS( CVideoConfigCommand ) : public CBase,
+                                           public MVtVideoConfigCommand
+    {
+    public:
+        /**
+         * Destructor.
+         */
+        ~CVideoConfigCommand();
+
+        /**
+         * Sets the I-Frame refresh rate of the encoded output.
+         *
+         * @param aIFrameInterval I-Frame rate in seconds per I-Frame
+         * @return True if successful, else false
+         */
+        virtual TInt SetIntraFrameInterval(TUint32 aIFrameInterval);
+
+        /**
+         * Requests the encoder to encode the next frame as an I-Frame.  This menthod is valid
+         * only when the node is in EPVMFNodeStarted state. If successful, the next encoded
+         * frame will be an I-Frame.
+         *
+         * @return True for success, else false
+         */
+        virtual TInt RequestNextIntraFrame();
+        
+        /**
+         * Sets the frame rate of encoded output for the specified layer.
+         * @param aFrameRate Frame rate for the specified layer in frames per second.
+         * @return True if successful, else false.
+         */
+        virtual TInt SetVideoFrameRate(TUint32 aFrameRate);
+
+        /**
+         * This API allows the user to specify separate observers for the extension interface.  
+         * 
+         * @param aHandler     the observer for unsolicited informational events
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler);
+        
+        /**
+         * Get member variant.
+         */
+        MPvMp4H263EncExtensionInterfaceSymbian*& PVVideoEncoderInterface() { return iH263Encoder; }
+    private:
+        MPvMp4H263EncExtensionInterfaceSymbian* iH263Encoder;
+        TVideoConfigHandler* iVideoConfigHandler;
+    };
+#endif
+//  End of File
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/cvtuserinput.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef CVTUSERINPUT_H
+#define CVTUSERINPUT_H
+NONSHARABLE_CLASS( CVTUserInputDtmf ) : public CBase, 
+                                        public MVTUserInput
+    {
+    public:
+        /**
+         * ConstructL.
+         */
+        void ConstructL(TUint8 aTone);
+        /**
+         * NewL.
+         */
+        static CVTUserInputDtmf* NewL(TUint8 aTone);
+        
+        /**
+         * Destructor.
+         */
+        ~CVTUserInputDtmf();
+
+        /**
+        * Virtual function to return the user input type
+        **/
+        virtual TUserInputType GetType();
+        CPVUserInputDtmfSymbian* iUII;
+    };
+
+NONSHARABLE_CLASS( CVTUserInputAlphanumeric ) : public CBase, 
+                                                public MVTUserInput
+    {
+    public:
+        /**
+         * ConstructL.
+         */
+        void ConstructL(TUint8 aTone);
+        /**
+         * NewL.
+         */
+        static CVTUserInputAlphanumeric* NewL(TUint8 aTone);
+        
+        /**
+         * Destructor.
+         */
+        ~CVTUserInputAlphanumeric();
+
+        /**
+        * Virtual function to return the user input type
+        **/
+        virtual TUserInputType GetType();
+        CPVUserInputAlphanumericSymbian* iUII;
+    };
+#endif
+//  End of File
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/inc/mvtprotocolhandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1131 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef MVTENGMEDIAHANDLER_H
+#define MVTENGMEDIAHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <mmfdatabuffer.h>
+#include <mmfutilities.h>
+#include <mmfcontrollerframework.h>
+
+typedef TInt TVtCommandId;                   
+typedef TInt TVtCommandStatus;               
+typedef TDesC8 TVtMIMEType;
+
+const TUid KVTUidYUVFrameBuffer = {0xFFFFFF0d};
+const TInt KVtUidDataSrcPrime	= 0xFFFFFF08;
+const TInt KVtUidDataSrcPlay	= 0xFFFFFF09;
+const TInt KVtUidDataSrcPause	= 0xFFFFFF0A;
+const TInt KVtUidDataSrcStop	= 0xFFFFFF0B;
+
+_LIT8(KVtVideoMIMETypeH263, "/video/x-pv/compressed/h263");
+_LIT8(KVtVideoMIMETypeM4V, "/video/x-pv/compressed/m4v");
+_LIT8(KVtVideoMIMETypeH264, "/video/x-pv/compressed/h264");
+_LIT8(KVtAudioMIMETypeAMRIF2, "/audio/x-pv/compressed/amr/if2");
+_LIT8(KVtAudioMIMETypeAMRWBIF2, "/audio/x-pv/compressed/amrwb/if2");
+_LIT8(KVtVideoMIMETypeYUV420, "/video/x-pv/raw/yuv420");
+
+enum TVt3G324MSupported
+    {
+    EVt3G324MMissing,
+    EVt3G324MSupported
+    }; 
+    
+enum TVtConfigType
+    {
+    EVtH324Config,
+    EVtVideoEncoderConfig
+    };
+
+enum TVtCommandType {
+    EVtCommandInit,
+    EVtCommandGetSDKInfo,
+    EVtCommandGetProtocolState = 3,
+    EVtCommandReset,
+    EVtCommandAddDataSource = 6,
+    EVtCommandRemoveDataSource,
+    EVtCommandAddDataSink,
+    EVtCommandRemoveDataSink,
+    EVtCommandConnect,
+    EVtCommandDisconnect,
+    EVtCommandPause,
+    EVtCommandResume,
+    EVtCommandGetProtocolInterface =20,
+    EVtCommandDeleteProtocolInterface,
+    EVtCommandCancelAllCommands
+    };
+
+enum TVtIndicationType 
+    {
+    EVtIndicationVideoSpatialTamporalTradeOffCommand,
+    EVtIndicationVideoSpatialTamporalTradeOffIndication,
+    EVtIndicationUserInputCapability = 6,
+    EVtIndicationIncomingTrack = 41,
+    EVtIndicationOutgoingTrack,
+    EVtIndicationDisconnect,
+    EVtIndicationClosingTrack,
+    EVtIndicationCloseTrack,
+    EVtIndicationPauseTrack,
+    EVtIndicationResumeTrack    
+    };
+      
+enum TVtMediaType      
+    {
+    EVtAudio = 1,
+    EVtVideo,
+    EVtControl,
+    EVtData,
+    EVtUserInput,
+    EVtMediaNone
+    };
+    
+enum TVtAudioOutputControlCommand   
+    {
+	  EVtAudioOutputControlGetMaxVolume,
+	  EVtAudioOutputControlGetVolume,
+	  EVtAudioOutputControlSetVolume,
+	  EVtAudioOutputControlGetBalance,
+	  EVtAudioOutputControlSetBalance
+	  };    
+
+const TUint8 EVtIncoming = 1;
+
+enum TUserInputType
+    {
+    EVtUiiDTFM,
+    EVtUiiAlphaNumeric
+    };
+
+struct TVtInitInfo
+    {
+    TBool iAMRWBOn;
+    TBool iDisableMpeg4;
+    };
+
+struct TVtIndicationEvent
+    {
+    public:    
+        /**
+         * Constructor.
+         */
+        TVtIndicationEvent(TInt aEventType, const TUint8 *aLocalBuffer) : iEventType(aEventType), iLocalBuffer(aLocalBuffer) 
+        {}
+    public:
+        TInt iEventType;
+        const TUint8 *iLocalBuffer;
+    };
+
+struct TVtCommandResponse
+    {
+    public:        
+        /**
+         * Constructor.
+         */
+        TVtCommandResponse(TVtCommandType aCmdType, TInt aCmdId, TInt iCmdStatus) : iCmdType(aCmdType), iCmdId(aCmdId), iCmdStatus(iCmdStatus)
+        {}
+    public:
+        TVtCommandType iCmdType;
+        TInt iCmdId;
+        TInt iCmdStatus;
+    };
+
+struct TVtErrorEvent
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        TVtErrorEvent(TInt aEventType) : iEventType(aEventType) {}
+    public:
+        TInt iEventType;
+    };
+    
+struct TVtMMFDataBuffer
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        TVtMMFDataBuffer(CMMFBuffer* aMmfBuffer,TSize  aFrameSize, TPtr8& aPtr) : iMmfBuffer(aMmfBuffer), iFrameSize(aFrameSize), iPtr(aPtr) {}
+
+        /**
+         * Get the YUV frame size.
+         * @return The frame size, in pixels
+         */
+        TSize GetFrameSize() {return iFrameSize;}
+
+        /**
+         * Get MMF buffer.
+         * @return the MMF buffer
+         */
+        CMMFBuffer* GetMMFBuffer() {return iMmfBuffer;}
+        
+        /**
+         * Get MMF buffer.
+         * @return the MMF buffer
+         */
+        const CMMFBuffer* GetMMFBuffer() const {return iMmfBuffer;}
+
+        /**
+        *  @return Returns a reference to the data buffer
+        **/
+        TPtr8& Data() {return iPtr;}
+
+        /**
+        *  @return Returns the frame size of the contained buffer.
+        **/
+        const TSize GetFrameSize() const {return iFrameSize;}
+        
+        /**
+        *  @return Returns a reference to the data buffer
+        **/
+        const TPtr8& Data() const {return iPtr;}
+    private:
+        CMMFBuffer* iMmfBuffer;
+        TSize  iFrameSize;
+        TPtr8&  iPtr;
+    };
+
+class MVTVideoInput
+    {
+    public:
+
+        /**
+         * Set the video frame format.  This must be from the list of supported formats.
+         * @param "aFormat" The mime string describing the video frame format.
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void SetFormatL(const TDesC8& aFormat) {}
+
+        /**
+         * Set the video frame rate.  This must be within the range of supported frame rates
+         * for the current frame size.
+         * @param "aFrameRate" The video frame rate to set.
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void SetFrameRateL(TReal32 aFrameRate) {}
+
+        /**
+         * Set the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void SetVideoFrameSizeL(const TSize& aSize) {}
+
+        /**
+         * Get the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void GetVideoFrameSizeL(TSize& aSize) const {}
+        
+        /**
+         * This API returns multimedias type supported by the data source/sink - 
+         * Audio, Video, Data etc.  Each supported type is indicated by a MIME type structure.
+         * @return 
+         **/
+        virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {}
+    };
+
+class MVTVideoOutput
+    {
+    public:
+
+        /**
+        *  Sets the data format using MIME string.
+        *  @param aFormat The format as a MIME string.
+        **/
+        virtual void SetFormatL(const TDesC8& aFormat) {}
+
+        /**
+         * Set the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         **/
+        virtual void SetVideoFrameSizeL(const TSize& aSize) {}
+
+        /**
+         * Get the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         **/
+        virtual void GetVideoFrameSizeL(TSize& aSize) const {}
+
+        /**
+         * This API returns multimedias type supported by the data source/sink - 
+         * Audio, Video, Data etc.  Each supported type is indicated by a MIME type structure.
+         * @return 
+         **/
+        virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {}
+    };
+
+//This class is empty
+class MVTAudioSource
+    {
+    };
+
+//This class is empty
+class MVTAudioSink
+    {
+    };
+
+class MVTVideoSource;
+class MVTVideoSink : public MVTVideoOutput
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        MVTVideoSink(TUid aType): iDataSinkType(aType) {}
+
+        /**
+         * Method called by a data source to request the data sink to empty aBuffer of data.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used when a data sink is passively waiting for requests from a supplier ie a data source
+         * to empty a buffer.  The data sink must call the BufferEmptiedL member on aSupplier when it has emptied
+         * the buffer of it's data - the data sink can either make this callback synchronously or asynchronously.
+         * 
+         * @param   "aBuffer"
+         *          The full buffer that needs emptying of it's data
+         *
+         * @param   "aSupplier" 
+         *          The data source that supplied the data. The data sink needs this to make the BufferEmptiedL
+         *          callback on aSupplier to indicate to the data source that the data sink has finished with the buffer.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data
+         */
+        virtual void EmptyBufferL(
+            TVtMMFDataBuffer aDataBuffer,
+            MVTVideoSource* aSupplier,
+            TMediaId aMediaId ) {}
+
+        /**
+         * Method called by a data source to pass back an filled buffer to the sink
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used as the callback when the data sink actively requests a supplier ie a data source
+         * to fill a buffer by calling the data sources FillBufferL.
+         * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied
+         * 
+         * @param   "aBuffer"
+         *          The buffer that has been filled by a data source and is now available for processing
+         */
+         virtual void BufferFilledL( CMMFBuffer* aBuffer ) = 0;
+
+        /**
+         * Method to indicate whether the data sink can create a buffer.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * 
+         * @return  ETrue if the data sink can create a buffer else EFalse
+         */
+        virtual TBool CanCreateSinkBuffer() {return EFalse;}
+
+        /**
+         * Returns a buffer created by the data sink
+         *
+         * This is a pure virtual function that each derived class must implement.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data.
+         *
+         * @param   "aReference"
+         *          This must be written to by the method to indicate whether the created buffer is
+         *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the sink
+         *          and should be used in preference to the source buffer provided the source buffer
+         *          is also not a reference buffer.
+         * .  
+         * @return  The created buffer
+         */
+        virtual CMMFBuffer* CreateSinkBufferL(
+            TMediaId aMediaId,
+            TBool &aReference ) {return NULL;}
+
+        /**
+         * Method to 'logon' the data sink to the same thread that sink will be consuming data in.
+         *
+         * This method may be required as the thread that the data sink was created in is not always
+         * the same thread that the data transfer will take place in.  Therefore any thread specific
+         * initialisation needs to be performed in the SinkThreadLogon rather than in the creation 
+         * of the data sink.
+         *
+         * This is a virtual function that a derrived data sink can implement if any thread specific
+         * initialisation is required and/or the data sink can create any asynchronous events.
+         * 
+         * 
+         * @param   "aEventHandler"
+         *          This is an MAsyncEventHandler to handle asynchronous events that occur during the
+         *          transfer of multimedia data.  The event handler must be in the same thread as the data transfer
+         *          thread - hence the reason it is passed in the SinkThreadLogon as opposed to say the constructor.
+         *
+         *
+         * @return  KErrNone if successful, otherwise a system wide error code.
+         */
+        virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;}
+
+        /**
+         * Method to 'logoff' the data sink from the same thread that sink consumes data in.
+         *
+         * This method may be required as the thread that the data sink is deleted in may not be
+         * the same thread that the data transfer took place in.  Therefore any thread specific
+         * releasing of resources needs to be performed in the SinkThreadLogoff rather than in the destructor
+         *
+         * This is a virtual function that a derrived data sink can implement if any thread specific
+         * releasing of resources is required.
+         */
+        virtual void SinkThreadLogoff() {}
+
+        /**
+         * Method to 'prime' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific 'priming' is required
+         */
+        virtual TInt SinkPrimeL() {return 0;}
+
+        /**
+         * Method to 'play' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific action is required prior to 'playing'ie the start of data transfer
+         */
+        virtual TInt SinkPlayL() {return 0;}
+
+        /**
+         * Method to 'pause' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific action is required to 'pause'
+         */
+        virtual TInt SinkPauseL() {return 0;}
+
+        /**
+         * Method to 'stop' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific action is required to 'stop'
+         */
+        virtual TInt SinkStopL() {return 0;}
+    private:
+        TUid iDataSinkType;
+    };
+    
+class MVTVideoSource : public MVTVideoInput
+    {
+    public:
+            
+        /**
+         * Constructor.
+         */
+    MVTVideoSource(TUid aType): iDataSourceType(aType) {}
+    
+        /**
+         * Method called by a data sink to request the data source to fill aBuffer with data.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used when a data source is passively waiting for requests from a consumer ie a data sink
+         * to fill a buffer.  The data source must call the BufferFilledL member on aConsumer when it has filled
+         * the buffer with data - the data source can either make this callback synchronously or asynchronously.
+         * 
+         * @param   "aBuffer"
+         *          The buffer that needs filling with data
+         *
+         * @param   "aConsumer" 
+         *          The data sink that consumes the data. The data source needs this to make the BufferFilledL
+         *          callback on aConsumer when the data source has completed filling the aBuffer.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data eg a multimedia file
+         */
+    virtual void FillBufferL(
+            CMMFBuffer* aBuffer,
+            MVTVideoSink* aConsumer,
+            TMediaId aMediaId ) {}
+    
+        /**
+         * Method called by a data sink to pass back an emptied buffer to the source
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used as the callback when the data source actively requests a consumer ie a data sink
+         * to empty a buffer by calling the data sinks EmptyBufferL.
+         * When the data source gets this callback it knows that the buffer has been emptied and can be reused
+         * 
+         * @param   "aBuffer"
+         *          The buffer that has been emptied by a data sink and is now available for reuse
+         */
+    virtual void BufferEmptiedL( CMMFBuffer* aBuffer ) = 0;
+    
+        /**
+         * Method to indicate whether the data source can create a buffer.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * 
+         * @return  ETrue if the data source can create a buffer else EFalse
+         */
+    virtual TBool CanCreateSourceBuffer() {return EFalse;}
+    
+        /**
+         * Returns a buffer created by the data source
+         *
+         * This is a pure virtual function that each derived class must implement.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data eg a multimedia file
+         *
+         * @param   "aReference"
+         *          This must be written to by the method to indicate whether the created buffer is
+         *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the source
+         *          and should be used in preference to the sink buffer provided the sink buffer
+         *          is also not a reference buffer
+         * .  
+         * @return  The created buffer
+         */
+    virtual CMMFBuffer* CreateSourceBufferL(
+                TMediaId aMediaId,
+                TBool &aReference ) {return NULL;}
+    
+        /**
+         * Returns a buffer created by the data source
+         *
+         * This is a virtual function that a derived class can implement.
+         * This can be used in preference to the above CreateSourceBufferL method in cases where
+         * the source buffer creation has a dependancy on the sink buffer
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data eg a multimedia file
+         *
+         * @param   "aSinkBuffer"
+         *          The sink buffer the nature of which may influence the creation of the source buffer
+         *
+         * @param   "aReference"
+         *          This must be written to by the method to indicate whether the created buffer is
+         *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the source
+         *          and should be used in preference to the sink buffer provided the sink buffer is not a reference buffer
+         * .  
+         * @return  The created buffer
+         */
+    virtual CMMFBuffer* CreateSourceBufferL(
+                TMediaId aMediaId,
+                CMMFBuffer& aSinkBuffer,
+                TBool &aReference ) {return NULL;}
+    
+        /**
+         * Method to 'logon' the data source to the same thread that source will be supplying data in.
+         *
+         * This method may be required as the thread that the data source was created in is not always
+         * the same thread that the data transfer will take place in.  Therefore any thread specific
+         * initialisation needs to be performed in the SourceThreadLogon rather than in the creation 
+         * of the data source.
+         *
+         * This is a virtual function that a derrived data source can implement if any thread specific
+         * initialisation is required and/or the data source can create any asynchronous events.
+         * 
+         * 
+         * @param   "aEventHandler"
+         *          This is an MAsyncEventHandler to handle asynchronous events that occur during the
+         *          transfer of multimedia data.  The event handler must be in the same thread as the data transfer
+         *          thread - hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor.
+         *
+         *
+         * @return  KErrNone if successful, otherwise a system wide error code.
+         */
+    virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;}
+    
+        /**
+         * Method to 'logoff' the data source from the same thread that source supplies data in.
+         *
+         * This method may be required as the thread that the data source is deleted in may not be
+         * the same thread that the data transfer took place in.  Therefore any thread specific
+         * releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor
+         *
+         * This is a virtual function that a derrived data source can implement if any thread specific
+         * releasing of resources is required.
+         */
+    virtual void SourceThreadLogoff() {}
+    
+        /**
+         * Method to 'prime' the data source
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific 'priming' is required
+         */
+    virtual TInt SourcePrimeL() {return 0;}
+    
+        /**
+         * Method to 'play' the data source
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific action is required prior to 'playing'ie the start of data transfer
+         */
+    virtual TInt SourcePlayL() {return 0;}
+    
+        /**
+         * Method to 'pause' the data source
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific action is required to 'pause'
+         */
+    virtual TInt SourcePauseL() {return 0;}
+    
+        /**
+         * Method to 'stop' the data source
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific action is required to 'stop'
+         */
+    virtual TInt SourceStopL() {return 0;}
+    private:
+        TUid iDataSourceType;
+    };
+
+class MCommServer
+    {
+    };
+
+class MVtProtocolCommand
+    {
+    public:
+    enum TVtProtocolState 
+        {     
+        EIdle,           
+        EInitializing, 
+        ESetup, 
+        EConnecting,
+        EConnected,
+        EDisconnecting,
+        EResetting
+        };
+    };
+
+class MVtProtocolHandler 
+    {
+    public:
+        
+       /**
+        * Handle an event that has been generated.
+        *
+        * @param "aResponse"  "The response to a previously issued command."
+        */
+	      virtual void HandleSessionCommandEventL(const TVtCommandResponse& aResponse) = 0;
+
+	      /**
+	       * Handle an informational event that has been generated.
+	       *
+	       * @param "aEvent" "The event to be handled."
+	       */
+	      virtual void HandleSessionInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+
+          /**
+	       * Handle an error event that has been generated.
+	       *
+	       * @param "aEvent" "The event to be handled."
+	       */
+	      virtual void HandleSessionErrorEventL(const TVtErrorEvent& aEvent) = 0;
+
+	      /** 
+	      *  Signals completion of the audio output control command.
+	      *  @param aId The command id of the completed command.
+	      *  @param aCmd The command type.
+	      *  @param aContextData The context data passed in with the command.
+	      *  @param aStatus The command completion status.
+	      **/
+	      virtual void HandleAudioOutputControlCommandComplete(TInt aId, TVtAudioOutputControlCommand aCmd, TAny *aContextData ,TInt aStatus) = 0;
+	      /**
+	       * Handle an event that has been generated.
+         *
+	       * @param "aResponse"  "The response to a previously issued command."
+	       */
+	      virtual void HandleVideoEncoderCommandCompletedL(const TVtCommandResponse& aResponse) = 0;
+
+	      /**
+	       * Handle an event that has been generated.
+         *
+	       * @param "aEvent" "The event to be handled."
+	       */
+	      virtual void HandleVideoEncoderInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+
+        /**
+	       * Handle an event that has been generated.
+         *
+         * @param "aResponse"  "The response to a previously issued command."
+	       */
+	      virtual void HandleH324MConfigCommandCompletedL(const TVtCommandResponse& aResponse) = 0;
+
+	      /**
+	       * Handle an event that has been generated.
+         *
+	       * @param "aEvent" "The event to be handled."
+	       */
+	      virtual void HandleH324MConfigInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+	      virtual ~MVtProtocolHandler() {}
+    };
+
+
+class MVtSessionCommand : public MVtProtocolCommand
+    {
+    public:
+        /**
+         * This function is valid only in the EIdle state.  It is a no-op when
+         * invoked in any other state.  It causes the protocol to transition
+         * to the ESetup state.  The terminal remains in the EInitializing state during
+         * the transition.
+         *
+         *
+         * @param aInitInfo
+         *         A reference to a TVtInitInfo structure which set Mona on and off
+         *         
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt InitProtocolL(TVtInitInfo& aInitInfo) = 0;
+
+        /**
+         * For an incoming track (MVTVideoSink) this function  pauses sending
+         * media to the sink (output device) and stops the sink.  It then does the protocol
+         * negotiations with the remote terminal to pause the logical channel for
+         * the specified track.
+         *
+         * For outgoing, it pauses the sending of media from the source and calls Stop() on the
+         * source.  It also performs any necessary protocol negotiations with the remote terminal.
+         * EVtCommandPause will be sent to the observer when the processing completes.
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt PauseVideoL(MVTVideoSource& aDataSource) = 0;
+        virtual TInt PauseVideoL(MVTVideoSink& aDataSink) = 0;
+        virtual TInt PauseAudioL(MVTAudioSource& aAudioSource) = 0;
+        
+        /**
+         * Resume a previously paused incoming or outgoing track.  For incoming,
+         * this function starts resumes playing out the media to the appropriate
+         * sink based on the current settings.  For outgoing it resumes encoding
+         * and sending media from the source.
+         * EVtCommandResume will be invoked will be invoked on the observer when the processing completes.       
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ResumeVideoL(MVTVideoSource& aDataSource) = 0;
+        virtual TInt ResumeVideoL(MVTVideoSink& aDataSink) = 0;
+        virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource) = 0;
+
+        /**
+         * This function is valid only in the ESetup and EInitializing state.  It is a
+         * no-op when invoked in the EIdle state
+         *
+         * It causes the protocol to transition back to the EIdle state.  The
+         * terminal remains in the EResetting state during the transition.
+         *
+         * While resetting, the protocol de-allocates all resources resources that
+         * had been previously allocated.  When it completes, ResetComplete is called
+         * and the protocol reverts to the EIdle state.
+         *
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ResetProtocolL() = 0;
+
+        /**
+         * This function can be invoked only in the ESetup state.  The terminal starts connecting with the remote
+         * terminal based on the specified options and capabilities.
+         * The EVtCommandConnect command completion event will be passed to the observer
+         * when connect completes.
+         * Details about the negotiated session may be obtained by calling the GetSessionParamsL API.
+         * GetSessionParamsL may be called after call setup is started to get the list of available channels
+         * and their capabilities.
+         * Incoming tracks may be opened before ConnectL completes and will be indicated via the
+         * EVtIndicationIncommingTrack event.
+         *
+         * @param aComm
+         *         An optional pointer to a comm server to provide comm source and sink end-points.
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ConnectToProtocolL(MCommServer* aComm) = 0;
+
+        /**
+         * Allows an application to provide a media source to be associated with a logical channel
+         * of communication with the peer.  Sources should be added after the EVtIndicationOutgoingTrack
+         * indication is received for a newly established logical channel.  The media type and
+         * channel id associated with the logical channel are specified as part of the indication.
+         * This function accepts a MVtVideoSource which provides additional functionality
+         * for advertizing capability and exposing configuration APIs.  
+         * Data sources could be of the following types:
+         * a)raw media sources like camera, microphone etc.
+         * b)sources of compressed data like file, gateway component etc.
+         *
+         * @param aChannelId
+         *          Indicates the channel id to be associated with this source.
+         * @param aDataSource
+         *          reference to the data source
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @return A unique command id for asynchronous completion
+         */
+        virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource) = 0;
+        virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource) = 0;
+
+        /**
+         * Allows an application to provide a media sink for rendering an incoming media bitstream in a
+         * logical channel of communication with the peer.
+         * AddDataSinkL can be called only for established incoming logical channels identified by a unique
+         * channel id.
+         * Regular incoming channels are established by the peer and are
+         * indicated using the EVtIndicationIncomingTrack indication.
+         * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality
+         * for advertizing capability and exposing configuration APIs.  
+         * EVtCommandAddDataSink event is sent to the observer on completion of this call.
+         *
+         * @param aChannelId
+         *          Indicates the channel id to be associated with this sink.
+         * @param aDataSink The data sink to be added
+         *
+         * @return A unique command id for asynchronous completion
+         **/
+        virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink) = 0;
+        virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink) = 0;
+
+        /**
+         * This API is to allow the user to cancel all pending requests.  The current request being
+         * processed, if any, will also be aborted.
+         * EVtCommandCancelAllCommands will be passed to the command observer on completion.
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt CancelAllCommandsL( ) = 0;
+
+        /**
+         * The Disconnect call is valid only when invoked in the EConnecting, and
+         * EConnected states.  It causes the terminal to transition to the
+         * EDisconnecting state.  All the media tracks both incoming and outgoing
+         * will be closed on invoking Disconnect. On completion, the terminal
+         * goes to the ESetup state.
+         *
+         * It is a no-op when called in any other state.
+         *
+         * This is an asynchronous request.  The EvtCommandDisconnect event will be
+         * sent to the observer when the request processing is complete.  This
+         * is the only event the Phone application should expect after calling
+         * Disconnect.
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt DisconnectFromProtocolL() = 0;
+
+        /**
+         * This API is to allow for extensibility of the protocol interface.
+         * It allows a caller to ask for an instance of a particular interface object to be returned.
+         * The mechanism is analogous to the COM IUnknown method.  The interfaces are identified with
+         * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+         * returned if it is supported.  Otherwise the returned pointer is NULL.
+         * @param aType
+         * @param aProtocolCommand
+         * @exception not_supported
+         * leaves if the specified interface id is not supported.
+         **/
+        virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand) = 0;
+
+        /**
+         * This APIis to be used to release an interface that was previously obtained using
+         * QueryInterfaceL.
+         * @param aType
+         * @param 
+         * @exception not_supported
+         * leaves if the specified interface id is not supported.
+         **/
+        virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*) = 0;
+        
+        /**
+         * Destructor.
+         */
+        virtual ~MVtSessionCommand() {}   
+    };
+
+class MVTUserInput
+    {
+    public:
+
+        /**
+        * @returns Returns the user input type.
+        **/
+        virtual TUserInputType GetType() = 0;
+        virtual ~MVTUserInput() {}
+    };
+
+class MVtH324ConfigCommand : public MVtProtocolCommand
+    {
+    public:
+
+        /**
+         * This API allows the user to specify observers for the 324m interface.
+         *
+         * @param aHandler     the observer for command status and unsolicited informational events
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+        /**
+         * Sets the vendor identification data.  This does not cause the stack to issue a vendor identifiation request.
+         * Set to NULL to disable sending vendor id.  If set to a valid parameter before Connect, it will cause the stack
+         * to automatically send it along with the TCS message.
+         * @param cc
+         *         T35 Country code
+         * @param ext
+         *         T35 Extension
+         * @param mc
+         *         T35 Manufacturer code
+         * @param aProduct
+         *         Product number
+         * @param aVersion
+         *         Version number
+         **/
+        virtual TInt SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion) = 0;
+        /**
+         * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+         * It is a request to the remote encoder to adjust its encoding in accordance with the tradeoff value.
+         * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+         * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+         * to precise values of spatial resolution or frame rate.
+         *
+         **/
+        virtual TInt SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff)=0;
+
+        /**
+         * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+         * It is an indication to the remote decoder that the local encoder has adjusted its encoding parameters
+         * according to the tradeoff value.
+         * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+         * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+         * to precise values of spatial resolution or frame rate.
+         *
+         **/
+        virtual TInt SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff)=0;
+
+        /**
+         * This API allows the user to specify the supported resolutions for video for transmit and receive.
+         *
+         **/
+        virtual TInt SetSupportedResolutions( ) = 0;
+
+        /**
+        * This API allows the user to set options for fast call setup procedures
+        **/
+
+        virtual TInt SetFastCsupOptions( ) = 0;
+
+        /**
+         * Causes the protocol to send the specified user input to the remote terminal using
+         * control channel.  The user input can be either DTMF ot Alphanumeric
+         * @param user_input A pointer to MVTUserInput
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt SendUserInputMessageL(MVTUserInput& user_input) = 0;        
+    };
+    
+class MVtVideoConfigCommand : public MVtProtocolCommand
+    {
+    public:
+
+        /**
+         * This API allows the user to specify separate observers for the extension interface.  
+         * 
+         * @param aHandler     the observer for unsolicited informational events
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+        /**
+         * Sets the I-Frame refresh rate of the encoded output.
+         *
+         * @param aIFrameInterval I-Frame rate in seconds per I-Frame
+         * @return True if successful, else false
+         */
+        virtual TInt SetIntraFrameInterval(TUint32 aIFrameInterval) = 0;
+        
+        /**
+         * Requests the encoder to encode the next frame as an I-Frame.  If successful, the next encoded
+         * frame will be an I-Frame.
+         *
+         * @return True for success, else false
+         */
+        virtual TInt RequestNextIntraFrame() = 0;
+        
+        /**
+         * Sets the frame rate of encoded output for the specified layer.
+         * @param aFrameRate Frame rate for the specified layer in frames per second.
+         * @return True if successful, else false.
+         */
+        virtual TInt SetVideoFrameRate(TUint32 aFrameRate) = 0;
+    };    
+
+class MVtAudioConfigCommand : public MVtProtocolCommand
+    {
+    public:
+
+        /**
+         * This API allows the user to specify observers for the 324m interface.
+         *
+         * @param aHandler
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+        /**
+         * Method to set the playback volume to the specified value.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * It is also an asynchronous function which will be answered with a callback.
+         * 
+         * @param aNewVolume
+         *        An input parameter to hold the value for the requested playback volume.  
+         *
+         * @returns   Returns a command ID that can be used to identify a command completion result with corresponding request.
+         */
+        virtual TInt SetAudioVolumeL(TInt aVolume) = 0;
+        
+        /**
+         * Method to get the maximum valid value for the playback volume.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * It is also an asynchronous function which will be answered with a callback.
+         * 
+         * @param aMaxVolume
+         *        An output parameter to hold the value for the maximum valid playback volume.  
+         *            Note that the parameter should not be used until the callback indicates that the 
+         *            method has completed.
+         *
+         * @returns   Returns a command ID that can be used to identify a command completion result with corresponding request.
+         */
+        virtual TInt GetMaxAudioVolumeL(TInt& aMaxVolume) = 0;
+    };
+    
+class VTProtocolFactory
+    {
+    public:
+        
+        /**
+         * Create one instance.
+         */
+        IMPORT_C static MVtSessionCommand* CreateSessionCommandL(MVtProtocolHandler* aProtocolHandler, TBool aEnableProxy, TVt3G324MSupported& a3G324MSupported);
+    
+        /**                                                                       
+         * This function allows the application to delete an instance of a terminal 
+         * and reclaim all allocated resources.  A terminal should be deleted only in 
+         * the EIdle state.  An attempt to delete a terminal in any other state will 
+         * result in unpredictable behavior.                                            
+         *                                                                        
+         * @param terminal the terminal to be deleted. 
+         * 
+         **/
+        IMPORT_C static void DeleteSessionCommand( MVtSessionCommand* aSessionCommand ); 
+    
+        /**                                                                       
+         * Creates an instance of a DevSound audio data source.
+         *                                                                        
+         * @param None
+         *                                                                        
+         * @returns A pointer to the interface
+         **/                                                                      
+        IMPORT_C static MVTAudioSource* CreateAudioSource();
+    
+        /**                                                                       
+         * Deletes an instance of a DevSound audio data source
+         * that was previously created with CreateAudioSource();
+         *                                                                        
+         * @param aSource The audio data source to be deleted.
+         *                                                                        
+         * @returns status
+         **/                                                                      
+        IMPORT_C static TInt DeletAudioSource(MVTAudioSource *aSource); 
+    
+        /**                                                                       
+         * Creates an instance of a DevSound audio data sink.
+         *                                                                        
+         * @param None
+         *                                                                        
+         * @returns A pointer to the interface
+         **/                                                                      
+        IMPORT_C static MVTAudioSink* CreateAudioSink();
+    
+        /**                                                                       
+         * Deletes an instance of a DevSound audio data sink
+         * that was previously created with CreateAudioSink();
+         *                                                                        
+         * @param The audio data sink to be deleted.
+         *                                                                        
+         * @returns status
+         **/                                                                      
+        IMPORT_C static TInt DeleteAudioSink(MVTAudioSink *aSink);
+    
+        /**                                                                       
+         * Creates an instance of a comm server of a particular name, to be used to
+         * initialize the terminal.
+         *                                                                        
+         *                                                                        
+         * @returns A pointer to a terminal or leaves if the type is invalid or the system is out of resources                                                              
+         **/                                                                      
+        IMPORT_C static MCommServer* CreateCommServerL(const TDesC & aName, TBool aEnableBitReversal=EFalse);
+    
+        /**
+         * This function allows the application to delete an instance of a comm server
+         * and reclaim all allocated resources.  A comm server should be deleted only when the 
+         * protocol is in the EIdle state.  An attempt to delete a comm server in any other state 
+         * could result in memory corruption within the protocol.  This function will leave  with
+         * KErrInUse if the comm server is still in use.  However it will not check the state of the 
+         * protocol that is using the comm server.
+         * 
+         * @param aCommServer the comm server to be deleted.
+         * 
+         * @returns a status code indicating success or failure
+         **/
+        IMPORT_C static void DeleteCommServerL(MCommServer* aCommServer);
+        
+        /**
+         * Create instance.
+         * @param aUIITyep
+         * @param aTone
+         */
+        IMPORT_C static MVTUserInput* CreateUserInputIndication(TUserInputType aUIIType, TUint8 aTone);
+        
+        /**
+         * Delete instance.
+         * @param aUII
+         */
+        IMPORT_C static void DeleteUserInputIndication(MVTUserInput* aUII);
+        
+        /**
+         * 
+         * @param aAudioSink
+         */
+        IMPORT_C static MVtAudioConfigCommand* GetAudioConfigCommandL(MVTAudioSink* aAudioSink);
+    };
+
+#endif
+//  End of File
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/caudioconfighandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <pv_2way_symbian_interface.h>
+#include <pv_audio_output_control_interface.h>
+#include "mvtprotocolhandler.h"
+#include "caudioconfighandler.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TAudioConfigHandler::TAudioConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TAudioConfigHandler::TAudioConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler<")));
+    __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// TAudioConfigHandler::AudioOutputControlCommandComplete
+// Signals completion of the audio output control command.
+// -----------------------------------------------------------------------------
+//
+void TAudioConfigHandler::AudioOutputControlCommandComplete(TPVCommandId aId
+                ,TPVAudioOutputControlCommand aCmd
+                ,TAny *aContextData
+                ,TInt aStatus)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::AudioOutputControlCommandComplete<")));	
+    iProtocolHandler->HandleAudioOutputControlCommandComplete(aId, (TVtAudioOutputControlCommand)aCmd, aContextData, aStatus);
+    __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::AudioOutputControlCommandComplete>")));	
+    }
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::CAudioConfigCommand
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CAudioConfigCommand::CAudioConfigCommand(MPVAudioOutputControl* aAudioCtrl) : iAudioCtrl(aAudioCtrl)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand<")));	
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand>")));		
+    }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::SetObserverL
+// This API allows the user to specify observers for the 324m interface.
+// -----------------------------------------------------------------------------
+//
+void CAudioConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL<")));	
+    iAudioConfigHandler = new (ELeave)TAudioConfigHandler(aHandler);
+    iAudioCtrl->SetAudioOutputControlObserver(iAudioConfigHandler);
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::SetAudioVolumeL
+// Method to set the playback volume to the specified value.
+// -----------------------------------------------------------------------------
+//
+TInt CAudioConfigCommand::SetAudioVolumeL(TInt aVolume)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL")));	
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL aVolume %d"), aVolume));		
+    return iAudioCtrl->SetVolumeL(aVolume);
+    }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::GetMaxAudioVolumeL
+// Method to get the maximum valid value for the playback volume.
+// -----------------------------------------------------------------------------
+//
+TInt CAudioConfigCommand::GetMaxAudioVolumeL(TInt& aMaxVolume)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL")));	
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL aMaxVolume %d"), aMaxVolume));		
+    return iAudioCtrl->GetMaxVolumeL(aMaxVolume);
+    }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::~CAudioConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CAudioConfigCommand::~CAudioConfigCommand()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand>")));
+    delete iAudioConfigHandler;
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand")));
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/cdatasinkproxy.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,295 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <pv_plugin_interfaces.h>
+#include "mvtprotocolhandler.h"
+#include "cdatasinkproxy.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CPVDisplaySinkNodeProxy::SetSupplier
+// Set new supplier .
+// -----------------------------------------------------------------------------
+//
+void CPVDisplaySinkNodeProxy::SetSupplier(MPVDataSourceBase* aSupplier)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CPVDisplaySinkNodeProxy::SetSupplier<")));
+    iSupplier = aSupplier;
+    __IF_DEBUG(Print( _L( "VTProto: CPVDisplaySinkNodeProxy::SetSupplier>" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CPVDisplaySinkNodeProxy::BufferEmptiedL
+// Method called by a data sink to pass back an emptied buffer to the source.
+// -----------------------------------------------------------------------------
+//
+void CPVDisplaySinkNodeProxy::BufferEmptiedL(CMMFBuffer* aBuffer)
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CPVDisplaySinkNodeProxy::BufferEmptiedL<" ) ));
+    iSupplier->BufferEmptiedL(aBuffer);   //call actually PV code
+    __IF_DEBUG(Print( _L( "VTProto: CPVDisplaySinkNodeProxy::BufferEmptiedL>" ) ));    
+    }
+
+// -----------------------------------------------------------------------------
+// CPVDisplaySinkNodeProxy::CPVDisplaySinkNodeProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPVDisplaySinkNodeProxy::CPVDisplaySinkNodeProxy() : MVTVideoSource(KNullUid) 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::CDisplaySinkProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkProxy::CDisplaySinkProxy(MVTVideoSink* aDisplaySink) : MPVDataSink(KNullUid), iDisplaySink(aDisplaySink) 
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy<" ) ));
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy iDisplaySink %d>" ), iDisplaySink));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::ConstructL()
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL<" ) ));
+    iDSNodeProxy = new (ELeave)CPVDisplaySinkNodeProxy();
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL>" ) ));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkProxy* CDisplaySinkProxy::NewL(MVTVideoSink* aDisplaySink)
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL<" ) ));
+    CDisplaySinkProxy* self = new (ELeave)CDisplaySinkProxy(aDisplaySink);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL>" ) ));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::QueryInterface
+// This API is to allow for extensibility of the plugin interface.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr )
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::QueryInterface<" ) ));
+    if ( aUuid == KPVUidVideoOutputInterface )
+        {
+        MPVVideoInput* interfaceP = (MPVVideoInput*) this;
+        aInterfacePtr = (TPVInterfacePtr) interfaceP;
+        }
+    else
+        {
+        aInterfacePtr = NULL;
+        }
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::QueryInterface aInterfacePtr %d>" ), aInterfacePtr ));  
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::GetMultimediaTypesL
+// This API returns multimedias type supported by the data source/sink.
+// -----------------------------------------------------------------------------
+//
+const RArray<TPVMIMEType *>& CDisplaySinkProxy::GetMultimediaTypesL() const
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::GetMultimediaTypesL" ) ));	
+    return iDisplaySink->GetMultimediaTypesL();
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::QueryUUID
+// This API is to allow for extensibility of the plugin interface.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly)
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SetTimebaseL
+// This API is used to provide a timebase for plugins that deal with synchronized media data.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase)
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::EmptyBufferL
+// Method called by a MDataSource to request the data sink to empty aBuffer of data.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::EmptyBufferL(CMMFBuffer *aBuffer, MPVDataSourceBase* aSupplier, TMediaId)
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::EmptyBufferL<" ) ));	
+    iDSNodeProxy->SetSupplier(aSupplier);
+    CPVMMFPointerBuffer& pvMMFBuffer = *static_cast< CPVMMFPointerBuffer* >( aBuffer );
+    TVtMMFDataBuffer mmfDataBuffer(aBuffer, pvMMFBuffer.GetFrameSize(), static_cast<TPtr8&>(pvMMFBuffer.Data()));
+    iDisplaySink->EmptyBufferL(mmfDataBuffer, iDSNodeProxy, TMediaId());
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::EmptyBufferL>" ) ));	
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::BufferFilledL
+// Method called by a data source to pass back an filled buffer to the sink.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::BufferFilledL(CMMFBuffer* aBuffer)
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::BufferFilledL" ) ));	
+    return iDisplaySink->BufferFilledL(aBuffer);
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::CanCreateSinkBuffer
+// Method to indicate whether the data sink can create a buffer.
+// -----------------------------------------------------------------------------
+//
+TBool CDisplaySinkProxy::CanCreateSinkBuffer()
+    {
+     __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CanCreateSinkBuffer" ) ));	
+    return iDisplaySink->CanCreateSinkBuffer();
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::CreateSinkBufferL
+// Returns a buffer created by the data sink
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CDisplaySinkProxy::CreateSinkBufferL(TMediaId aMediaId, TBool &aReference )
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CreateSinkBufferL" ) ));		
+    return iDisplaySink->CreateSinkBufferL(aMediaId, aReference);
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkThreadLogon
+// Method to 'logon' the data sink to the same thread that sink will be consuming data in.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkThreadLogon( MAsyncEventHandler& aEventHandler )
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkThreadLogon" ) ));		
+    return iDisplaySink->SinkThreadLogon(aEventHandler);
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkThreadLogoff
+// Method to 'logoff' the data sink from the same thread that sink consumes data in.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::SinkThreadLogoff()
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkThreadLogoff" ) ));	
+    iDisplaySink->SinkThreadLogoff();
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkPrimeL
+// Method to 'prime' the data sink.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkPrimeL()
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkPrimeL" ) ));		
+    return iDisplaySink->SinkPrimeL();
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkPlayL
+// Method to 'play' the data sink.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkPlayL()
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkPlayL" ) ));	
+    return iDisplaySink->SinkPlayL();
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkPauseL
+// Method to 'pause' the data sink.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkPauseL()
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkPauseL" ) ));	
+    return iDisplaySink->SinkPauseL();
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SinkStopL
+// Method to 'stop' the data sink.
+// -----------------------------------------------------------------------------
+//
+TInt CDisplaySinkProxy::SinkStopL()
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkStopL" ) ));
+    return iDisplaySink->SinkStopL();
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SetFormatL
+// Set the video frame format.  This must be from the list of supported formats.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::SetFormatL(const TDesC8& aFormat)
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SetFormatL" ) ));
+    iDisplaySink->SetFormatL(aFormat);
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::SetVideoFrameSizeL
+// Set the video frame size.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::SetVideoFrameSizeL(const TSize& aSize)
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SetVideoFrameSizeL" ) ));
+    iDisplaySink->SetVideoFrameSizeL(aSize);
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::GetVideoFrameSizeL
+// Get the video frame size.
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::GetVideoFrameSizeL(TSize& aSize) const
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::GetVideoFrameSizeL" ) ));
+    iDisplaySink->GetVideoFrameSizeL(aSize);
+    }
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/cdatasourceproxy.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,334 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <pv_plugin_interfaces.h>
+#include "mvtprotocolhandler.h"
+#include "cdatasourceproxy.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CPVCameraSourceNodeProxy::CPVCameraSourceNodeProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPVCameraSourceNodeProxy::CPVCameraSourceNodeProxy() : MVTVideoSink(KNullUid) 
+    { 
+    }
+
+// -----------------------------------------------------------------------------
+// CPVCameraSourceNodeProxy::SetConsumer
+// Set consumer object.
+// -----------------------------------------------------------------------------
+//
+void CPVCameraSourceNodeProxy::SetConsumer(MPVDataSinkBase* aConsumer)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SetConsumer<")));
+    iConsumer = aConsumer;    
+    __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SetConsumer>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CPVCameraSourceNodeProxy::BufferFilledL
+// Method called by a data source to pass back an filled buffer to the sink.
+// -----------------------------------------------------------------------------
+//
+void CPVCameraSourceNodeProxy::BufferFilledL(CMMFBuffer* aBuffer)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::BufferFilledL<")));
+    iConsumer->BufferFilledL(aBuffer);
+    __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::BufferFilledL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CPVCameraSourceNodeProxy::SendEventToClient
+// Send event to client.
+// -----------------------------------------------------------------------------
+//
+TInt CPVCameraSourceNodeProxy::SendEventToClient(const TMMFEvent &aEvent)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SendEventToClient<")));	
+    MAsyncEventHandler* eventHandler = dynamic_cast<MAsyncEventHandler*>(iConsumer);
+    TInt result = eventHandler->SendEventToClient(aEvent);
+    __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SendEventToClient>")));
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CVideoSourceProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVideoSourceProxy::CVideoSourceProxy(MVTVideoSource* aDataSource) : MPVDataSource(KNullUid), iVideoSource(aDataSource) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy<")));
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy iVideoSource %d>"), iVideoSource));	
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::ConstructL() 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL<")));
+    iCameraSourceNodeProxy = new (ELeave) CPVCameraSourceNodeProxy();
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL>")));	
+    }
+    
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::NewL
+// -----------------------------------------------------------------------------
+//
+CVideoSourceProxy* CVideoSourceProxy::NewL(MVTVideoSource* aDataSource) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL<")));
+    CVideoSourceProxy* self = new (ELeave)CVideoSourceProxy(aDataSource);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL>")));  
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::QueryInterface
+// This API is to allow for extensibility of the plugin interface.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr )
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::QueryInterface<")));	
+    if ( aUuid == KPVUidVideoInputInterface )
+            {
+            MPVVideoInput* interfaceP = (MPVVideoInput*) this;
+            aInterfacePtr = (TPVInterfacePtr) interfaceP;
+            }
+        else
+            {
+            aInterfacePtr = NULL;
+            }
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::QueryInterface aInterfacePtr %d<"), aInterfacePtr));        
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::GetMultimediaTypesL
+// This API returns multimedias type supported by the data source/sink.
+// -----------------------------------------------------------------------------
+//
+const RArray<TPVMIMEType *>& CVideoSourceProxy::GetMultimediaTypesL() const
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::GetMultimediaTypesL iVideoSource %d"), iVideoSource));	
+    const RArray<TPVMIMEType *>& multimediaType = iVideoSource->GetMultimediaTypesL();
+    return multimediaType;
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::QueryUUID
+// This API is to allow for extensibility of the plugin interface.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SetTimebaseL
+// This API is used to provide a timebase for plugins that deal with synchronized media data.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetTimebaseL<")));
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetTimebaseL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::FillBufferL
+// Method called by a MDataSink to request the data source to fill aBuffer with data.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::FillBufferL(CMMFBuffer* aBuffer, MPVDataSinkBase* aConsumer, TMediaId aMediaId )
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::FillBufferL<")));
+    iCameraSourceNodeProxy->SetConsumer(aConsumer);
+    iVideoSource->FillBufferL(aBuffer, iCameraSourceNodeProxy, aMediaId);
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::FillBufferL>")));
+    }    
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CreateSourceBufferL
+// Returns a buffer created by the data source.
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CVideoSourceProxy::CreateSourceBufferL(TMediaId aMediaId, TBool &aReference )
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CreateSourceBufferL")));
+    return iVideoSource->CreateSourceBufferL(aMediaId, aReference);
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CreateSourceBufferL
+// Returns a buffer created by the data source.
+// -----------------------------------------------------------------------------
+//
+CMMFBuffer* CVideoSourceProxy::CreateSourceBufferL(TMediaId aMediaId, CMMFBuffer &aSinkBuffer, TBool &aReference)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CreateSourceBufferL")));	
+    return iVideoSource->CreateSourceBufferL(aMediaId, aSinkBuffer, aReference);
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourceThreadLogon
+// Method to 'logon' the data source to the same thread that source will be supplying data in.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourceThreadLogon( MAsyncEventHandler& aEventHandler )
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceThreadLogon")));	
+    return iVideoSource->SourceThreadLogon(aEventHandler);
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourceThreadLogoff
+// Method to 'logoff' the data source from the same thread that source supplies data in.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SourceThreadLogoff()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceThreadLogoff<")));		
+    iVideoSource->SourceThreadLogoff();
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceThreadLogoff>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourcePrimeL
+// Method to 'prime' the data source.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourcePrimeL()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourcePrimeL<")));			
+    return iVideoSource->SourcePrimeL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourcePlayL
+// Method to 'play' the data source.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourcePlayL()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourcePlayL")));	
+    return iVideoSource->SourcePlayL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourcePauseL
+// Method to 'pause' the data source.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourcePauseL()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourcePauseL")));
+    return iVideoSource->SourcePauseL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SourceStopL
+// Method to 'stop' the data source.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoSourceProxy::SourceStopL()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceStopL")));	
+    return iVideoSource->SourceStopL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::BufferEmptiedL
+// Method called by a data sink to pass back an emptied buffer to the source.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::BufferEmptiedL(CMMFBuffer* aBuffer)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::BufferEmptiedL")));		
+    iVideoSource->BufferEmptiedL(aBuffer);
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CanCreateSourceBuffer
+// Method to indicate whether the data source can create a buffer.
+// -----------------------------------------------------------------------------
+//
+TBool CVideoSourceProxy::CanCreateSourceBuffer()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CanCreateSourceBuffer")));		
+    return iVideoSource->CanCreateSourceBuffer();
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SetFormatL
+// Set the video frame format.  This must be from the list of supported formats.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SetFormatL(const TDesC8& aFormat)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetFormatL")));		
+    iVideoSource->SetFormatL(aFormat);
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SetFrameRateL
+// Set the video frame rate.  This must be within the range of supported frame rates.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SetFrameRateL(TReal32 aFrameRate)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetFrameRateL")));		
+    iVideoSource->SetFrameRateL(aFrameRate);
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::SetVideoFrameSizeL
+// Set the video frame size.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::SetVideoFrameSizeL(const TSize& aSize)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetVideoFrameSizeL <")));		
+    iVideoSource->SetVideoFrameSizeL(aSize);
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetVideoFrameSizeL >")));	
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::GetVideoFrameSizeL
+// Get the video frame size.
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::GetVideoFrameSizeL(TSize& aSize) const
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::GetVideoFrameSizeL<")));		
+    iVideoSource->GetVideoFrameSizeL(aSize);
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::GetVideoFrameSizeL>")));
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/ch324confighandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,211 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <pv_2way_symbian_interface.h>
+#include <pv_2way_h324m_interface.h>
+#include "mvtprotocolhandler.h"
+#include "ch324confighandler.h"
+#include "cvtuserinput.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// Define image sizes.
+// QCIF.
+const TInt KVtProtoResolutionQCIFWidth = 176;
+const TInt KVtProtoResolutionQCIFHeight = 144;
+
+// SQCIF.
+const TInt KVtProtoResolutionSQCIFWidth = 128;
+const TInt KVtProtoResolutionSQCIFHeight = 96;
+
+// -----------------------------------------------------------------------------
+// TH324ConfigHandler::TH324ConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TH324ConfigHandler::TH324ConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler<")));	
+    __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// TH324ConfigHandler::MPVH324MConfigCommandCompletedL
+// Handle an event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TH324ConfigHandler::MPVH324MConfigCommandCompletedL(const CPVCmdResponse& aResponse)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigCommandCompletedL<")));		
+    TVtCommandType cmdType = (TVtCommandType)aResponse.GetCmdType();
+    TInt cmdId = aResponse.GetCmdId();
+    TInt cmdResponse = aResponse.GetCmdStatus();
+    TVtCommandResponse commandRsp(cmdType, cmdId, cmdResponse); 
+    iProtocolHandler->HandleH324MConfigCommandCompletedL(commandRsp);
+    __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigCommandCompletedL>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// TH324ConfigHandler::MPVH324MConfigInformationalEventL
+// Handle an information event.
+// -----------------------------------------------------------------------------
+//
+void TH324ConfigHandler::MPVH324MConfigInformationalEventL(const CPVAsyncInformationalEvent& aEvent)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigInformationalEventL<")));	
+    const TUint8* buffer = aEvent.GetLocalBuffer();
+    TInt eventType = aEvent.GetEventType();
+    TVtIndicationEvent vtEvent(eventType, buffer);
+    iProtocolHandler->HandleH324MConfigInformationalEventL(vtEvent);
+    __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::MPVH324MConfigInformationalEventL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetVendorId
+// Sets the vendor identification data.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetVendorId")));		
+    return iH324Config->SetVendor(cc, ext, mc, aProduct, aVersion);
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand
+// This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand")));			
+    return iH324Config->SendVideoTemporalSpatialTradeoffCommand(aLogicalChannel, aTradeoff);
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication
+// This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication")));		
+    return iH324Config->SendVideoTemporalSpatialTradeoffIndication(aLogicalChannel, aTradeoff);
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetVideoResolutions
+// This API allows the user to specify the supported resolutions for video for transmit and receive.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetSupportedResolutions()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetSupportedResolutions")));	
+    RArray<TPVVideoResolutionRange> resolutions;
+    TPVVideoResolutionRange qcif;
+    qcif.first.iWidth = KVtProtoResolutionQCIFWidth;
+    qcif.first.iHeight = KVtProtoResolutionQCIFHeight;
+    qcif.last.iWidth = KVtProtoResolutionQCIFWidth;
+    qcif.last.iHeight = KVtProtoResolutionQCIFHeight;
+    TInt err( resolutions.Append( qcif ) );
+    if ( err == KErrNone )
+        {
+        TPVVideoResolutionRange sqcif;
+        sqcif.first.iWidth = KVtProtoResolutionSQCIFWidth;
+        sqcif.first.iHeight = KVtProtoResolutionSQCIFHeight;
+        sqcif.last.iWidth = KVtProtoResolutionSQCIFWidth;
+        sqcif.last.iHeight = KVtProtoResolutionSQCIFHeight;
+        err = resolutions.Append( sqcif );
+        if ( err == KErrNone )
+            {
+            err = iH324Config->SetVideoResolutions( INCOMING, resolutions );
+            }
+        }
+    resolutions.Close();
+    
+    return err;    
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetFastCsupOptions
+// This API allows the user to set options for fast call setup procedures.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetFastCsupOptions( )
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetFastCsupOptions")));	
+    TPVH324FastCsupOptions fastCsupOptions;
+    fastCsupOptions.iEnableWnsrp = ETrue;
+    fastCsupOptions.iEnableMona = EFalse;
+    return iH324Config->SetFastCsupOptions(fastCsupOptions);
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendUserInputMessageL
+// Causes the vt2way to send the specified user input to the remote terminal using
+// control channel.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendUserInputMessageL(MVTUserInput& user_input)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL<")));	
+    if (user_input.GetType() == EVtUiiDTFM)
+        {
+        CVTUserInputDtmf* dtmf = static_cast<CVTUserInputDtmf*>(&user_input);
+        return iH324Config->SendUserInputL(*dtmf->iUII);
+        }
+    else if (user_input.GetType() == EVtUiiAlphaNumeric)
+        {
+        CVTUserInputAlphanumeric* alphanumeric = static_cast<CVTUserInputAlphanumeric*>(&user_input);
+        return iH324Config->SendUserInputL(*alphanumeric->iUII);
+        }
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL>")));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetObserverL
+// This API allows the user to specify observers for the 324m interface.
+// -----------------------------------------------------------------------------
+//
+void CH324ConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL<")));	 	
+    iH324ConfigHandler = new (ELeave)TH324ConfigHandler(aHandler);
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL observer %d"), iH324ConfigHandler));
+    iH324Config->SetObserver(iH324ConfigHandler);
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL>")));	 
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::~CH324ConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CH324ConfigCommand::~CH324ConfigCommand()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand<")));		
+    delete iH324ConfigHandler;
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand>")));	
+    }    
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/csessionhandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,450 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <pv_plugin_interfaces.h>
+#include <pv_2way_symbian_interface.h>
+#include <pv_2way_h324m_interface.h>
+#include <pv_mp4_h263_enc_extension_interface_symbian.h>
+#include <pv_audio_output_control_interface.h>
+#include <pv_2way_factory.h>
+#include "mvtprotocolhandler.h"
+#include "cdatasinkproxy.h"
+#include "cdatasourceproxy.h"
+#include "csessionhandler.h"
+#include "ccommserver.h"
+#include "ch324confighandler.h"
+#include "cvideoconfighandler.h"
+#include "caudioconfighandler.h"
+
+#define DEBUG_CFG_BB_LOOPBACK 0
+#define DEBUG_CFG_PV_LOOPBACK 0
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+const TInt KVtProtoMultiplexingDelay = 150;
+const TInt EVtGet324CtrlInterface = 15;
+const TInt EVtGetH263EncInterface = 24;
+// -----------------------------------------------------------------------------
+// TSessionHandler::TSessionHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TSessionHandler::TSessionHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler<")));	
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// TSessionHandler::CommandCompletedL
+// Handle an event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TSessionHandler::CommandCompletedL(const CPVCmdResponse& aResponse)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::CommandCompletedL<")));	
+    TVtCommandType cmdType = (TVtCommandType)aResponse.GetCmdType();
+    TInt cmdId = (TInt)aResponse.GetCmdId();
+    TInt cmdResponse = aResponse.GetCmdStatus();
+    TVtCommandResponse commandRsp(cmdType, cmdId, cmdResponse);
+    iProtocolHandler->HandleSessionCommandEventL(commandRsp);
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::CommandCompletedL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// TSessionHandler::HandleInformationalEventL
+// Handle an informational event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TSessionHandler::HandleInformationalEventL(const CPVAsyncInformationalEvent& aEvent)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::HandleInformationalEventL<")));		
+    const TUint8* buffer = aEvent.GetLocalBuffer();
+    TInt eventType = aEvent.GetEventType();
+    TVtIndicationEvent vtEvent(eventType, buffer);
+    iProtocolHandler->HandleSessionInformationalEventL(vtEvent);
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::HandleInformationalEventL>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// TSessionHandler::HandleErrorEventL
+// Handle an error event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TSessionHandler::HandleErrorEventL(const CPVAsyncErrorEvent& aEvent)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::HandleErrorEventL<")));		
+    TVtErrorEvent event(aEvent.GetEventType());
+    iProtocolHandler->HandleSessionErrorEventL(event);
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::HandleErrorEventL>")));	
+    }
+    
+// -----------------------------------------------------------------------------
+// CSessionCommand::CSessionCommand
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CSessionCommand::CSessionCommand(TSessionHandler* aSessionHandler, MPV2WaySymbianInterface* aPv2Way) 
+  : iPv2Way(aPv2Way), iSessionHandler(aSessionHandler) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand<")));
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::~CSessionComman
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSessionCommand::~CSessionCommand()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand<")));	
+    delete iVideoSource;
+    delete iDisplaySink;
+    delete iSessionHandler;
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ConnectToProtocolL
+// This function can be invoked only in the ESetup state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ConnectToProtocolL(MCommServer* aComm)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL")));		
+    TPVConnectOptions connectOptions;
+    connectOptions.iLoopbackMode = PV_LOOPBACK_NONE;
+#ifdef _DEBUG
+    if ( DEBUG_CFG_BB_LOOPBACK )
+        {
+        connectOptions.iLoopbackMode = PV_LOOPBACK_COMM;
+        __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL Loopback COMM")));        
+        }
+    else if ( DEBUG_CFG_PV_LOOPBACK )
+        {
+        connectOptions.iLoopbackMode = PV_LOOPBACK_MUX;        
+        __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL Loopback MUX")));
+        }
+    else
+        {        
+        __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL Loopback NONE")));
+        }
+#endif
+    CCommServer* commServer = static_cast<CCommServer*>(aComm);
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL commServer %d"), commServer));
+    return iPv2Way->ConnectL(connectOptions, commServer->iComm);    
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::DisconnectFromProtocolL
+// The Disconnect call is valid only when invoked in the EConnecting, and
+// EConnected states.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::DisconnectFromProtocolL()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DisconnectFromProtocolL")));			
+    return iPv2Way->DisconnectL();
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResetProtocolL
+// This function is valid only in the ESetup and EInitializing state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResetProtocolL()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResetProtocolL")));	
+    return iPv2Way->ResetL();
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::InitProtocolL
+// This function is valid only in the EIdle state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::InitProtocolL(TVtInitInfo& aInitInfo)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::InitProtocolL")));	
+    CPV2WayInitInfo initInfo;
+    initInfo.iMultiplexingDelayMs = KVtProtoMultiplexingDelay;
+    
+    if (aInitInfo.iAMRWBOn)
+        {
+        initInfo.iIncomingAudioFormats.
+        Append((TDesC8 *)&KVtAudioMIMETypeAMRWBIF2);
+
+        initInfo.iOutgoingAudioFormats.
+        Append((TDesC8 *)&KVtAudioMIMETypeAMRWBIF2);
+        }
+        
+    initInfo.iIncomingAudioFormats.
+    Append((TDesC8 *)&KVtAudioMIMETypeAMRIF2);
+
+    initInfo.iOutgoingAudioFormats.
+    Append((TDesC8 *)&KVtAudioMIMETypeAMRIF2);
+
+    initInfo.iIncomingVideoFormats.
+    Append( (TDesC8 *) &KVtVideoMIMETypeH264 );
+
+    initInfo.iOutgoingVideoFormats.
+    Append( (TDesC8 *) &KVtVideoMIMETypeH264 );
+
+    if (!aInitInfo.iDisableMpeg4)
+        {
+        initInfo.iIncomingVideoFormats.
+        Append((TDesC8 *)&KVtVideoMIMETypeM4V);
+        
+        initInfo.iOutgoingVideoFormats.
+        Append((TDesC8 *)&KVtVideoMIMETypeM4V);
+        }
+        
+    initInfo.iIncomingVideoFormats.
+    Append((TDesC8 *)&KVtVideoMIMETypeH263);
+
+    initInfo.iOutgoingVideoFormats.
+    Append((TDesC8 *)&KVtVideoMIMETypeH263);
+
+    return iPv2Way->InitL(initInfo);
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddVideoSinkL
+// Allows an application to provide a media sink for rendering an incoming media bitstream in a
+// logical channel of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddVideoSinkL(const TUint aChannelId, MVTVideoSink& aDataSink)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL")));	
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL aChannelId %d"), aChannelId));
+    iDisplaySink =CDisplaySinkProxy::NewL(&aDataSink);
+    return iPv2Way->AddDataSinkL(aChannelId, *iDisplaySink);        
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddVideoSourceL
+// Allows an application to provide a media source to be associated with a logical channel
+// of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddVideoSourceL(const TUint aChannelId, MVTVideoSource& aDataSource)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL")));	
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL aChannelId %d"), aChannelId));
+    iVideoSource = CVideoSourceProxy::NewL(&aDataSource);
+    return iPv2Way->AddDataSourceL(aChannelId, *iVideoSource);        
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddAudioSourceL
+// Allows an application to provide a media source to be associated with a logical channel
+// of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL")));	
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL aChannelId %d"), aChannelId));	
+    CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aDataSource);
+    return iPv2Way->AddDataSourceL(aChannelId, *(audioSourceProxy->iAudioSource));
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddAudioSinkL
+// Allows an application to provide a media sink for rendering an incoming media bitstream in a
+// logical channel of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL")));	
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL aChannelId %d"), aChannelId));	
+    CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(&aDataSink);
+    return iPv2Way->AddDataSinkL(aChannelId, *(audioSinkProxy->iAudioSink));
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseVideoL
+// For an incoming track (MVTVideoSink) this function  pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseVideoL(MVTVideoSource& aTrack)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL")));		
+    if (&aTrack == iVideoSource->VideoSource())
+        {
+        return iPv2Way->PauseL(*iVideoSource);        
+        }
+    return KErrNone;    
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseVideoL
+// For an incoming track (MVtVideoSink) this function  pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseVideoL(MVTVideoSink& aTrack) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL")));		
+    if (&aTrack == iDisplaySink->DisplaySink())
+        {
+        return iPv2Way->PauseL(*iDisplaySink);        
+        }
+    return KErrNone;     
+    }        
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseAudioL
+// For an incoming track (MVTAudioSource) this function  pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseAudioL(MVTAudioSource& aTrack)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseAudioL")));		
+    CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack);
+    return iPv2Way->PauseL(*(audioSourceProxy->iAudioSource));
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeVideoL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeVideoL(MVTVideoSource& aTrack)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL")));		
+    if (&aTrack == iVideoSource->VideoSource())
+        {
+        return iPv2Way->ResumeL(*iVideoSource);        
+        }
+    return KErrNone;    
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeVideoL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeVideoL(MVTVideoSink& aTrack) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL")));		
+    if (&aTrack == iDisplaySink->DisplaySink())
+        {
+        return iPv2Way->ResumeL(*iDisplaySink);        
+        }
+    return KErrNone;     
+    } 
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeAudioL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeAudioL(MVTAudioSource& aTrack)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeAudioL")));		
+    CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack);
+    return iPv2Way->ResumeL(*(audioSourceProxy->iAudioSource));
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::CancelAllCommandsL
+// This API is to allow the user to cancel all pending requests.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::CancelAllCommandsL( )
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CancelAllCommandsL")));	
+    return iPv2Way->CancelAllCommandsL();
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::GetProtocolInterfaceL
+// This API is to allow for extensibility of the protocol interface.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL<")));		
+    TInt commandId = 0;
+    if (aType == EVtH324Config)
+        {
+        CH324ConfigCommand* H324ConfigCommand = new (ELeave)CH324ConfigCommand();
+        commandId = iPv2Way->QueryInterfaceL(
+                     KPVUidH324ConfigInterface,
+                     ( MPVInterface*& ) H324ConfigCommand->PVH324ConfigInterface(),
+                     ( void* ) EVtGet324CtrlInterface );
+        
+        aProtocolCommand = H324ConfigCommand;
+        }
+    else if (aType == EVtVideoEncoderConfig)
+        {
+        CVideoConfigCommand* videoConfigCommand = new (ELeave)CVideoConfigCommand();
+        commandId = iPv2Way->QueryInterfaceL(
+                        KPVUidVidEncConfigInterface,
+                        ( MPVInterface*& ) videoConfigCommand->PVVideoEncoderInterface(),
+                        ( void* ) EVtGetH263EncInterface  );
+        
+        aProtocolCommand = videoConfigCommand;
+        }
+    else
+        {
+        ;
+        }
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL aType %d, aProtocolCommand %d>"), aType, aProtocolCommand));    
+    return commandId;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::DeleteProtocolInterfaceL
+// This APIis to be used to release an interface that was previously obtained using
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL<")));
+    TInt commandId = 0;
+    if (aType == EVtH324Config)
+            {
+            CH324ConfigCommand* H324ConfigCommand = static_cast<CH324ConfigCommand*>(aProtocolCommand);
+            commandId = iPv2Way->ReleaseInterfaceL(H324ConfigCommand->PVH324ConfigInterface());
+            delete H324ConfigCommand;
+            }
+        else if (aType == EVtVideoEncoderConfig)
+            {
+            CVideoConfigCommand* videoConfigCommand = static_cast<CVideoConfigCommand*>(aProtocolCommand);
+            commandId = iPv2Way->ReleaseInterfaceL(videoConfigCommand->PVVideoEncoderInterface());
+            delete videoConfigCommand;
+            }
+        else
+            {
+            ;
+            }
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL aType, aProtocolCommand %d>"), aType, aProtocolCommand));        
+    return commandId;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/cvideoconfighandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <pv_2way_symbian_interface.h>
+#include <pv_mp4_h263_enc_extension_interface_symbian.h>
+#include "mvtprotocolhandler.h"
+#include "cvideoconfighandler.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TVideoConfigHandler::TVideoConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TVideoConfigHandler::TVideoConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler<")));
+    __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler>")));	
+    }
+    
+// -----------------------------------------------------------------------------
+// TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL
+// Handle an event that has been generated.
+// -----------------------------------------------------------------------------
+//
+void TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL(const CPVCmdResponse& aResponse)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL<")));	
+    TVtCommandType cmdType = (TVtCommandType)aResponse.GetCmdType();
+    TInt cmdId = aResponse.GetCmdId();
+    TInt cmdResponse = aResponse.GetCmdStatus();
+    TVtCommandResponse commandRsp(cmdType, cmdId, cmdResponse);
+    iProtocolHandler->HandleVideoEncoderCommandCompletedL(commandRsp);
+    __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL
+// Handle an information event.
+// -----------------------------------------------------------------------------
+//
+void TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL(const CPVAsyncInformationalEvent& aEvent)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL<")));		
+    const TUint8* buffer = aEvent.GetLocalBuffer();
+    TInt eventType = aEvent.GetEventType();
+    TVtIndicationEvent vtEvent(eventType, buffer);
+    iProtocolHandler->HandleVideoEncoderInformationalEventL(vtEvent);
+    __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL>")));	
+    }
+ 
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetObserverL
+// This API allows the user to specify separate observers for the extension interface.
+// -----------------------------------------------------------------------------
+//
+void CVideoConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL<")));	
+    iVideoConfigHandler = new (ELeave)TVideoConfigHandler(aHandler);
+    iH263Encoder->SetObserver(iVideoConfigHandler);
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetIntraFrameInterval
+// Sets the I-Frame refresh rate of the encoded output.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::SetIntraFrameInterval(TUint32 aIFrameInterval)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval")));
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval aIFrameInterval %d"), aIFrameInterval));			
+    return iH263Encoder->SetIFrameInterval(aIFrameInterval);
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::RequestNextIntraFrame
+// Requests the encoder to encode the next frame as an I-Frame.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::RequestNextIntraFrame()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::RequestNextIntraFrame")));
+    return iH263Encoder->RequestIFrame();
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetVideoFrameRate
+// Sets the frame rate of encoded output for the specified layer.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::SetVideoFrameRate(TUint32 aFrameRate)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate")));
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate aFrameRate %d"), aFrameRate));		
+    return iH263Encoder->SetOutputFrameRate(aFrameRate);
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::~CVideoConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVideoConfigCommand::~CVideoConfigCommand()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));	
+    delete iVideoConfigHandler;
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/cvtuserinput.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <pv_2way_symbian_interface.h>
+#include <pv_2way_h324m_interface.h>
+#include "mvtprotocolhandler.h"
+#include "cvtuserinput.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::ConstructL
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+void CVTUserInputDtmf::ConstructL(TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::ConstructL<")));	
+    iUII = CPVUserInputDtmfSymbian::NewL( aTone, 0 );
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::ConstructL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::CVTUserInputDtmf
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputDtmf* CVTUserInputDtmf::NewL(TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::NewL<")));	
+    CVTUserInputDtmf* self = new (ELeave)CVTUserInputDtmf();
+    CleanupStack::PushL(self);
+    self->ConstructL(aTone);
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::NewL>")));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::~CVTUserInputDtmf
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputDtmf::~CVTUserInputDtmf()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::~CVTUserInputDtmf<")));	
+    delete iUII;
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::~CVTUserInputDtmf>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::GetType
+// Virtual function to return the user input type
+// -----------------------------------------------------------------------------
+//
+TUserInputType CVTUserInputDtmf::GetType()
+    {
+    return EVtUiiDTFM;
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::ConstructL
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+void CVTUserInputAlphanumeric::ConstructL(TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::ConstructL<")));	
+    TBuf8<1> tone;
+    tone.Append( aTone );
+    iUII = CPVUserInputAlphanumericSymbian::NewL( tone );
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::ConstructL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::CVTUserInputAlphanumeric
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputAlphanumeric* CVTUserInputAlphanumeric::NewL(TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::NewL<")));
+    CVTUserInputAlphanumeric* self = new (ELeave)CVTUserInputAlphanumeric();
+    CleanupStack::PushL(self);
+    self->ConstructL(aTone);
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::NewL>")));   
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric<")));		
+    delete iUII;
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric>")));		
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::GetType
+// Virtual function to return the user input type.
+// -----------------------------------------------------------------------------
+//
+TUserInputType CVTUserInputAlphanumeric::GetType()
+    {
+    return EVtUiiAlphaNumeric;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocols/src/vtprotocolfactory.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,223 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <pv_plugin_interfaces.h>
+#include <pv_2way_symbian_interface.h>
+#include <pv_2way_h324m_interface.h>
+#include <pv_audio_output_control_interface.h>
+#include <pv_2way_factory.h>
+#include "mvtprotocolhandler.h"
+#include "cdatasourceproxy.h"
+#include "cdatasinkproxy.h"
+#include "csessionhandler.h"
+#include "caudioconfighandler.h"
+#include "cvtuserinput.h"
+#include "ccommserver.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateSessionCommandL
+// Create one instance. 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtSessionCommand* VTProtocolFactory::CreateSessionCommandL(MVtProtocolHandler* aProtocolHandler, TBool aEnableProxy, TVt3G324MSupported& a3G324MSupported)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateSessionCommandL<")));
+    a3G324MSupported = EVt3G324MSupported;	
+    TSessionHandler * sessionHandler = new (ELeave)TSessionHandler(aProtocolHandler);
+    CleanupStack::PushL(sessionHandler);
+    MPV2WaySymbianInterface *pv2Way = CPV2WayFactory::CreateTerminalL(sessionHandler, sessionHandler, sessionHandler, aEnableProxy );
+    CSessionCommand* sessionCommand = new (ELeave)CSessionCommand(sessionHandler, pv2Way);
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateSessionCommandL sessionCommand %d>"), sessionCommand));
+    return sessionCommand;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteSessionCommand
+// This function allows the application to delete an instance of a terminal 
+// and reclaim all allocated resources.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C  void VTProtocolFactory::DeleteSessionCommand( MVtSessionCommand* aSessionCommand )
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteSessionCommand<")));		
+    CSessionCommand* sessionCommand = static_cast<CSessionCommand*>(aSessionCommand);
+    CPV2WayFactory::DeleteTerminal( sessionCommand->iPv2Way );
+    delete aSessionCommand;
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteSessionCommand>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateAudioSource
+// Creates an instance of a DevSound audio data source.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTAudioSource* VTProtocolFactory::CreateAudioSource()
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSource<")));
+    TInt err( KErrNone );
+    CAudioSourceProxy* audioSourceProxy = NULL;	
+    TRAP (err, audioSourceProxy = new (ELeave) CAudioSourceProxy() );
+    if (err != KErrNone)
+        {
+        return NULL;
+        }    
+    audioSourceProxy->iAudioSource = CPVDevSoundAudioFactory::CreateDevSoundAudioDataSource();
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSource audioSourceProxy %d>"), audioSourceProxy));
+    return audioSourceProxy;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeletAudioSource
+// Deletes an instance of a DevSound audio data source.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt VTProtocolFactory::DeletAudioSource(MVTAudioSource *aSource)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeletAudioSource<")));	
+    CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(aSource);
+    CPVDevSoundAudioFactory::DeleteDevSoundAudioDataSource(audioSourceProxy->iAudioSource);
+    delete aSource;
+   __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeletAudioSource>")));	
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateAudioSink
+// Creates an instance of a DevSound audio data sink.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTAudioSink* VTProtocolFactory::CreateAudioSink()
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSink<")));
+    TInt err( KErrNone );		
+    CAudioSinkProxy* audioSinkProxy = NULL;
+    TRAP(err, audioSinkProxy = new (ELeave) CAudioSinkProxy() );
+    if (err != KErrNone)
+        {
+        return NULL;
+        }
+    audioSinkProxy->iAudioSink = CPVDevSoundAudioFactory::CreateDevSoundAudioDataSink();
+   __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSink audioSinkProxy %d>"), audioSinkProxy));		
+    return audioSinkProxy;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteAudioSink
+// Deletes an instance of a DevSound audio data sink
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt VTProtocolFactory::DeleteAudioSink(MVTAudioSink *aSink)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteAudioSink<")));			
+    CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(aSink);
+    CPVDevSoundAudioFactory::DeleteDevSoundAudioDataSink(audioSinkProxy->iAudioSink);
+    delete aSink;
+     __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteAudioSink>")));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateCommServerL
+// Creates an instance of a comm server of a particular name, to be used to
+// initialize the terminal.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MCommServer* VTProtocolFactory::CreateCommServerL(const TDesC & aName, TBool aEnableBitReversal)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateCommServerL<")));	
+    CCommServer* commServer = new (ELeave)CCommServer();
+    CleanupStack::PushL(commServer);
+    commServer->iComm = CPVCommFactory::CreateCommServerL(aName, aEnableBitReversal);
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateCommServerL commServer %d>"), commServer));	
+    return commServer;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteCommServerL
+// This function allows the application to delete an instance of a comm server
+// and reclaim all allocated resources.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteCommServerL(MCommServer* aCommServer)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteCommServerL<")));		
+    CCommServer* commServer = static_cast<CCommServer*>(aCommServer);
+    CPVCommFactory::DeleteCommServerL(commServer->iComm);
+    delete aCommServer;
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteCommServerL>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateUserInputIndication
+// Create instance .
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTUserInput* VTProtocolFactory::CreateUserInputIndication(TUserInputType aUIIType, TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateUserInputIndication")));	
+    if (aUIIType == EVtUiiDTFM)
+        {
+        CVTUserInputDtmf* uii = CVTUserInputDtmf::NewL(aTone);
+        return uii;
+        }
+    else if (aUIIType == EVtUiiAlphaNumeric)
+        {
+        CVTUserInputAlphanumeric* uii = CVTUserInputAlphanumeric::NewL(aTone);
+        return uii;
+        }
+    else
+        {
+        return NULL;
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteUserInputIndication
+// Delete instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteUserInputIndication(MVTUserInput* aUII)
+    {
+    delete aUII;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::GetAudioConfigCommandL
+// Get one instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtAudioConfigCommand* VTProtocolFactory::GetAudioConfigCommandL(MVTAudioSink* aAudioSink)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::GetAudioConfigCommandL<")));		
+    CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(aAudioSink);
+    MPVAudioOutputControl* audioCtrl = CPVDevSoundAudioFactory::GetDevSoundAudioOutputControl(
+            audioSinkProxy->iAudioSink, ETrue );
+    CAudioConfigCommand* audioConfigCommand = new (ELeave)CAudioConfigCommand(audioCtrl);
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::GetAudioConfigCommandL audioConfigCommand %d>"), audioConfigCommand));	
+    return audioConfigCommand;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/bwins/videotelprotou.def	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	?DeleteAudioSink@VTProtocolFactory@@SAHPAVMVTAudioSink@@@Z @ 1 NONAME ; int VTProtocolFactory::DeleteAudioSink(class MVTAudioSink *)
+	?CreateAudioSink@VTProtocolFactory@@SAPAVMVTAudioSink@@XZ @ 2 NONAME ; class MVTAudioSink * VTProtocolFactory::CreateAudioSink(void)
+	?CreateCommServerL@VTProtocolFactory@@SAPAVMCommServer@@ABVTDesC16@@H@Z @ 3 NONAME ; class MCommServer * VTProtocolFactory::CreateCommServerL(class TDesC16 const &, int)
+	?CreateUserInputIndication@VTProtocolFactory@@SAPAVMVTUserInput@@W4TUserInputType@@E@Z @ 4 NONAME ; class MVTUserInput * VTProtocolFactory::CreateUserInputIndication(enum TUserInputType, unsigned char)
+	?CreateSessionCommandL@VTProtocolFactory@@SAPAVMVtSessionCommand@@PAVMVtProtocolHandler@@HAAW4TVt3G324MSupported@@@Z @ 5 NONAME ; class MVtSessionCommand * VTProtocolFactory::CreateSessionCommandL(class MVtProtocolHandler *, int, enum TVt3G324MSupported &)
+	?DeletAudioSource@VTProtocolFactory@@SAHPAVMVTAudioSource@@@Z @ 6 NONAME ; int VTProtocolFactory::DeletAudioSource(class MVTAudioSource *)
+	?GetAudioConfigCommandL@VTProtocolFactory@@SAPAVMVtAudioConfigCommand@@PAVMVTAudioSink@@@Z @ 7 NONAME ; class MVtAudioConfigCommand * VTProtocolFactory::GetAudioConfigCommandL(class MVTAudioSink *)
+	?CreateAudioSource@VTProtocolFactory@@SAPAVMVTAudioSource@@XZ @ 8 NONAME ; class MVTAudioSource * VTProtocolFactory::CreateAudioSource(void)
+	?DeleteCommServerL@VTProtocolFactory@@SAXPAVMCommServer@@@Z @ 9 NONAME ; void VTProtocolFactory::DeleteCommServerL(class MCommServer *)
+	?DeleteUserInputIndication@VTProtocolFactory@@SAXPAVMVTUserInput@@@Z @ 10 NONAME ; void VTProtocolFactory::DeleteUserInputIndication(class MVTUserInput *)
+	?DeleteSessionCommand@VTProtocolFactory@@SAXPAVMVtSessionCommand@@@Z @ 11 NONAME ; void VTProtocolFactory::DeleteSessionCommand(class MVtSessionCommand *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/eabi/videotelprotou.def	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	_ZN17VTProtocolFactory15CreateAudioSinkEv @ 1 NONAME
+	_ZN17VTProtocolFactory15DeleteAudioSinkEP12MVTAudioSink @ 2 NONAME
+	_ZN17VTProtocolFactory16DeletAudioSourceEP14MVTAudioSource @ 3 NONAME
+	_ZN17VTProtocolFactory17CreateAudioSourceEv @ 4 NONAME
+	_ZN17VTProtocolFactory17CreateCommServerLERK7TDesC16i @ 5 NONAME
+	_ZN17VTProtocolFactory17DeleteCommServerLEP11MCommServer @ 6 NONAME
+	_ZN17VTProtocolFactory20DeleteSessionCommandEP17MVtSessionCommand @ 7 NONAME
+	_ZN17VTProtocolFactory21CreateSessionCommandLEP18MVtProtocolHandleriR18TVt3G324MSupported @ 8 NONAME
+	_ZN17VTProtocolFactory22GetAudioConfigCommandLEP12MVTAudioSink @ 9 NONAME
+	_ZN17VTProtocolFactory25CreateUserInputIndicationE14TUserInputTypeh @ 10 NONAME
+	_ZN17VTProtocolFactory25DeleteUserInputIndicationEP12MVTUserInput @ 11 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 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 Telephony Protocol
+*
+*/
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+
+../inc/MVtProtocolHandler.h                    |../../inc/MVtProtocolHandler.h
+
+
+PRJ_MMPFILES
+
+../Group/videotelproto.mmp
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/group/videotelproto.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 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 telephony protocol
+*
+*/
+
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+// default vendor id
+VENDORID VID_DEFAULT
+
+TARGET          videotelproto.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x20021182
+
+
+SOURCEPATH      ../src
+
+SOURCE          cdatasinkproxy.cpp
+SOURCE          cdatasourceproxy.cpp
+SOURCE          caudioconfighandler.cpp
+SOURCE          ch324confighandler.cpp
+SOURCE          csessionhandler.cpp
+SOURCE          cvideoconfighandler.cpp
+SOURCE          cvtuserinput.cpp
+SOURCE          vtprotocolfactory.cpp
+
+DOCUMENT        ../../group/bld.inf
+
+USERINCLUDE     ../inc/
+
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../inc
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+SYSTEMINCLUDE   /epoc32/include/mmf/server
+
+LIBRARY euser.lib
+LIBRARY ws32.lib
+
+LIBRARY	commonengine.lib
+LIBRARY MediaClientAudio.lib
+
+
+
+DEBUGLIBRARY vtlogger.lib
+
+LIBRARY MMFDevSound.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/caudioconfighandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 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:  Audio configuration interface
+*
+*/
+
+#ifndef CAUDIOCONFIGHANDLER_H
+#define CAUDIOCONFIGHANDLER_H
+NONSHARABLE_CLASS( TAudioConfigHandler )
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        TAudioConfigHandler( MVtProtocolHandler* aProtocolHandler);
+    private:
+        MVtProtocolHandler* iProtocolHandler;
+    };
+    
+NONSHARABLE_CLASS( CAudioConfigCommand ) : public CBase,
+                            public MVtAudioConfigCommand
+    {
+    public:
+        
+        /**
+         * Constructor.
+         */
+        CAudioConfigCommand();
+        
+        /**
+         * Destructor.
+         */
+        ~CAudioConfigCommand();
+
+        /**
+         * Method to set the playback volume to the specified value.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * It is also an asynchronous function which will be answered with a callback.
+         * 
+         * @param aNewVolume
+         *        An input parameter to hold the value for the requested playback volume.  
+         *
+         * @returns   TInt
+         *            Returns a command ID that can be used to identify a command completion result with corresponding request.
+         */
+        virtual TInt SetAudioVolumeL(TInt aVolume);
+
+        /**
+         * Method to get the maximum valid value for the playback volume.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * It is also an asynchronous function which will be answered with a callback.
+         * 
+         * @param aMaxVolume
+         *        An output parameter to hold the value for the maximum valid playback volume.  
+         *            Note that the parameter should not be used until the callback indicates that the 
+         *            method has completed.
+         *
+         * @returns   TInt
+         *            Returns a command ID that can be used to identify a command completion result with corresponding request.
+         */
+        virtual TInt GetMaxAudioVolumeL(TInt& aMaxVolume);
+
+        /**
+         * This API allows the user to specify observers for the 324m interface.
+         *
+         * @param aHandler     
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler);
+    private:
+        TAudioConfigHandler* iAudioConfigHandler;
+    };
+#endif
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/ccommserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 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:  Comm server interface
+*
+*/
+
+#ifndef CCOMMSERVER_H
+#define CCOMMSERVER_H
+NONSHARABLE_CLASS( CCommServer ) : public CBase,
+                                   public MCommServer
+    {
+    };
+#endif
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/cdatasinkproxy.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 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:  Data Sink Proxy interface
+*
+*/
+
+#ifndef CDATASINKPROXY_H
+#define CDATASINKPROXY_H
+
+NONSHARABLE_CLASS( CDisplaySinkProxy ) : public CBase
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        CDisplaySinkProxy(MVTVideoSink* aDisplaySink);
+        
+        /**
+         * ConstructL
+         */
+        void ConstructL();
+
+        /**
+         * NewL
+         */
+        static CDisplaySinkProxy* NewL(MVTVideoSink* aDisplaySink);
+        /**
+         * Get pointer object of data sink.
+         * @return member variant:iDisplaySink
+         */
+        MVTVideoSink* DisplaySink() { return iDisplaySink; }
+    private:
+        MVTVideoSink* iDisplaySink;        
+    };
+
+NONSHARABLE_CLASS( CAudioSinkProxy ) : public CBase,
+                                       public MVTAudioSink
+    {
+    };
+    
+#endif
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/cdatasourceproxy.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 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:  Data Source proxy interface
+*
+*/
+
+#ifndef CDATASOURCEPROXY_H
+#define CDATASOURCEPROXY_H
+
+NONSHARABLE_CLASS( CVideoSourceProxy ) : public CBase
+    {
+    public: //new
+        /**
+         * Constructor.
+         */
+        CVideoSourceProxy(MVTVideoSource* aVideoSource);
+        /**
+         * ConstructL.
+         */
+        void ConstructL( );
+        
+        /**
+         * NewL.
+         */
+        static CVideoSourceProxy* NewL(MVTVideoSource* aVideoSource);
+        
+        /**
+         * Get member variant.
+         * @return memeber variant:iVideoSource
+         */
+        MVTVideoSource* VideoSource() { return iVideoSource; }
+    private:
+        MVTVideoSource* iVideoSource;
+    };
+
+NONSHARABLE_CLASS( CAudioSourceProxy ) : public CBase, 
+                                         public MVTAudioSource
+    {
+    };
+#endif
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/ch324confighandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 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:  H324M configuration interface
+*
+*/
+
+#ifndef CH324ConfigHandler_H
+#define CH324ConfigHandler_H
+NONSHARABLE_CLASS( TH324ConfigHandler )
+    {
+    public:
+        
+        /**
+         * Constructor.
+         */
+        TH324ConfigHandler(MVtProtocolHandler* aProtocolHandler);
+
+    private:
+        MVtProtocolHandler* iProtocolHandler;
+    };
+ 
+NONSHARABLE_CLASS( CH324ConfigCommand ): public CBase,
+                                         public MVtH324ConfigCommand
+    {
+    public:
+        /**
+         * Destructor.
+         */
+        ~CH324ConfigCommand();
+
+        /**
+         * Sets the vendor identification data.  This does not cause the stack to issue a vendor identifiation request.
+         * Set to NULL to disable sending vendor id.  If set to a valid parameter before Connect, it will cause the stack
+         * to automatically send it along with the TCS message.
+         * @param cc
+         *         T35 Country code
+         * @param ext
+         *         T35 Extension
+         * @param mc
+         *         T35 Manufacturer code
+         * @param aProduct
+         *         Product number
+         * @param aVersion
+         *         Version number
+         **/
+        virtual TInt SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion);
+
+        /**
+         * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+         * It is a request to the remote encoder to adjust its encoding in accordance with the tradeoff value.
+         * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+         * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+         * to precise values of spatial resolution or frame rate.
+         *
+         **/
+        virtual TInt SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff);
+
+        /**
+         * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+         * It is an indication to the remote decoder that the local encoder has adjusted its encoding parameters
+         * according to the tradeoff value.
+         * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+         * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+         * to precise values of spatial resolution or frame rate.
+         *
+         **/
+        virtual TInt SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff);
+
+        /**
+         * This API allows the user to specify the supported resolutions for video for transmit and receive.
+         *
+         **/
+        virtual TInt SetSupportedResolutions( );
+        /**
+        * This API allows the user to set options for fast call setup procedures
+        **/
+        virtual TInt SetFastCsupOptions( );
+
+        /**
+         * Causes the protocol to send the specified user input to the remote terminal using
+         * control channel.  The user input can be either DTMF ot Alphanumeric
+         * @param user_input A pointer to MVTUserInput
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt SendUserInputMessageL(MVTUserInput& user_input);
+
+        /**
+         * This API allows the user to specify observers for the 324m interface.
+         *
+         * @param aHandler     the observer for command status and unsolicited informational events
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler);
+              
+    private:
+        TH324ConfigHandler* iH324ConfigHandler;
+    };    
+#endif
+//  End of File
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/csessionhandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 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:  Session command interface
+*
+*/
+
+#ifndef CSESSIOHANDLER_H
+#define CSESSIOHANDLER_H
+NONSHARABLE_CLASS( TSessionHandler )
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        TSessionHandler(MVtProtocolHandler* aProtocolHandler);
+    private:
+        MVtProtocolHandler* iProtocolHandler;
+    };
+
+NONSHARABLE_CLASS( CSessionCommand ): public CBase,
+                                      public MVtSessionCommand
+    {
+    public:
+        /**
+         * Contructor.
+         */
+        CSessionCommand(TSessionHandler* aSessionHandler);
+        
+        /**
+         * Destructor.
+         */
+        ~CSessionCommand();
+
+        /**
+         * This function is valid only in the EIdle state.  It is a no-op when
+         * invoked in any other state.  It causes the protocol to transition
+         * to the ESetup state.  The terminal remains in the EInitializing state during
+         * the transition.
+         *
+         *
+         * @param aInitInfo
+         *         A reference to a TVtInitInfo structure which set Mona on and off
+         *         
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt InitProtocolL(TVtInitInfo& aInitInfo);
+
+        /**
+         * For an incoming track (MVTVideoSink) this function  pauses sending
+         * media to the sink (output device) and stops the sink.  It then does the protocol
+         * negotiations with the remote terminal to pause the logical channel for
+         * the specified track.
+         *
+         * For outgoing, it pauses the sending of media from the source and calls Stop() on the
+         * source.  It also performs any necessary protocol negotiations with the remote terminal.
+         * EVtCommandPause will be sent to the observer when the processing completes.
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt PauseVideoL(MVTVideoSource& aDataSource);
+        virtual TInt PauseVideoL(MVTVideoSink& aDataSink);
+        virtual TInt PauseAudioL(MVTAudioSource& aAudioSource);
+
+        /**
+         * Resume a previously paused incoming or outgoing track.  For incoming,
+         * this function starts resumes playing out the media to the appropriate
+         * sink based on the current settings.  For outgoing it resumes encoding
+         * and sending media from the source.
+         *
+         * EVtCommandResume will be invoked will be invoked on the observer when the processing completes.   
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ResumeVideoL(MVTVideoSource& aDataSource);
+        virtual TInt ResumeVideoL(MVTVideoSink& aDataSink);
+        virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource);
+
+        /**
+         * This function is valid only in the ESetup and EInitializing state.  It is a
+         * no-op when invoked in the EIdle state
+         *
+         * It causes the protocol to transition back to the EIdle state.  The
+         * terminal remains in the EResetting state during the transition.
+         *
+         * While resetting, the protocol de-allocates all resources resources that
+         * had been previously allocated.  When it completes, ResetComplete is called
+         * and the protocol reverts to the EIdle state.
+         *
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ResetProtocolL();
+
+        /**
+         * This function can be invoked only in the ESetup state.  The terminal starts connecting with the remote
+         * terminal based on the specified options and capabilities.
+         * The EVtCommandConnect command completion event will be passed to the observer
+         * when connect completes.
+         * Details about the negotiated session may be obtained by calling the GetSessionParamsL API.
+         * GetSessionParamsL may be called after call setup is started to get the list of available channels
+         * and their capabilities.
+         * Incoming tracks may be opened before ConnectL completes and will be indicated via the
+         * EVtIndicationIncommingTrack event.
+         *
+         * @param aComm
+         *         An optional pointer to a comm server to provide comm source and sink end-points.
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ConnectToProtocolL(MCommServer* aComm);
+
+        /**
+         * Allows an application to provide a media source to be associated with a logical channel
+         * of communication with the peer.  Sources should be added after the EVtIndicationOutgoingTrack
+         * indication is received for a newly established logical channel.  The media type and
+         * channel id associated with the logical channel are specified as part of the indication.
+         * This function accepts a MVtVideoSource which provides additional functionality
+         * for advertizing capability and exposing configuration APIs.  
+         * Data sources could be of the following types:
+         * a)raw media sources like camera, microphone etc.
+         * b)sources of compressed data like file, gateway component etc.
+         *
+         * @param aChannelId
+         *          Indicates the channel id to be associated with this source.
+         * @param aDataSource
+         *          reference to the data source
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle
+         *          KPVErrInvalidState if invoked in the incorrect state
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @return A unique command id for asynchronous completion
+         */
+        virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource);
+        virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource);
+
+        /**
+         * Allows an application to provide a media sink for rendering an incoming media bitstream in a
+         * logical channel of communication with the peer.
+         * AddDataSinkL can be called only for established incoming logical channels identified by a unique
+         * channel id.
+         * Regular incoming channels are established by the peer and are
+         * indicated using the EVtIndicationIncomingTrack indication.
+         * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality
+         * for advertizing capability and exposing configuration APIs.  
+         * EVtCommandAddDataSink event is sent to the observer on completion of this call.
+         *
+         * @param aChannelId
+         *          Indicates the channel id to be associated with this sink.
+         * @param aDataSink The data sink to be added
+         *
+         * @return A unique command id for asynchronous completion
+         **/
+        virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink);
+        virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink);
+
+        /**
+         * This API is to allow the user to cancel all pending requests.  The current request being
+         * processed, if any, will also be aborted.
+         * EVtCommandCancelAllCommands will be passed to the command observer on completion.
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt CancelAllCommandsL( );
+
+        /**
+         * The Disconnect call is valid only when invoked in the EConnecting, and
+         * EConnected states.  It causes the terminal to transition to the
+         * EDisconnecting state.  All the media tracks both incoming and outgoing
+         * will be closed on invoking Disconnect. On completion, the terminal
+         * goes to the ESetup state.
+         *
+         * It is a no-op when called in any other state.
+         *
+         * This is an asynchronous request.  The EvtCommandDisconnect event will be
+         * sent to the observer when the request processing is complete.  This
+         * is the only event the Phone application should expect after calling
+         * Disconnect.
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt DisconnectFromProtocolL();
+
+        /**
+         * This API is to allow for extensibility of the protocol interface.
+         * It allows a caller to ask for an instance of a particular interface object to be returned.
+         * The mechanism is analogous to the COM IUnknown method.  The interfaces are identified with
+         * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+         * returned if it is supported.  Otherwise the returned pointer is NULL.
+         * @param aType
+         * @param aProtocolCommand
+         * @exception not_supported
+         * leaves if the specified interface id is not supported.
+         **/
+        virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand);
+
+        /**
+         * This APIis to be used to release an interface that was previously obtained using
+         * QueryInterfaceL.
+         * @param aType
+         * @param 
+         * @exception not_supported
+         * leaves if the specified interface id is not supported.
+         **/
+        virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand); 
+    private:
+        CVideoSourceProxy* iVideoSource;
+        CDisplaySinkProxy* iDisplaySink;
+        TSessionHandler*   iSessionHandler;
+    };
+#endif
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/cvideoconfighandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 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 configuration interface
+*
+*/
+
+#ifndef CVideoConfigHandler_H
+#define CVideoConfigHandler_H
+NONSHARABLE_CLASS( TVideoConfigHandler )
+    {
+    public:
+        
+        /**
+         * Constructor.
+         */
+        TVideoConfigHandler(MVtProtocolHandler* aProtocolHandler);
+
+    private:
+        MVtProtocolHandler* iProtocolHandler;
+    };
+
+NONSHARABLE_CLASS( CVideoConfigCommand ) : public CBase,
+                                           public MVtVideoConfigCommand
+    {
+    public:
+        /**
+         * Destructor.
+         */
+        ~CVideoConfigCommand();
+
+        /**
+         * Sets the I-Frame refresh rate of the encoded output.
+         *
+         * @param aIFrameInterval I-Frame rate in seconds per I-Frame
+         * @return True if successful, else false
+         */
+        virtual TInt SetIntraFrameInterval(TUint32 aIFrameInterval);
+
+        /**
+         * Requests the encoder to encode the next frame as an I-Frame.  This menthod is valid
+         * only when the node is in EPVMFNodeStarted state. If successful, the next encoded
+         * frame will be an I-Frame.
+         *
+         * @return True for success, else false
+         */
+        virtual TInt RequestNextIntraFrame();
+        
+        /**
+         * Sets the frame rate of encoded output for the specified layer.
+         * @param aFrameRate Frame rate for the specified layer in frames per second.
+         * @return True if successful, else false.
+         */
+        virtual TInt SetVideoFrameRate(TUint32 aFrameRate);
+
+        /**
+         * This API allows the user to specify separate observers for the extension interface.  
+         * 
+         * @param aHandler     the observer for unsolicited informational events
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler);
+                
+    private:
+        TVideoConfigHandler* iVideoConfigHandler;
+    };
+#endif
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/cvtuserinput.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 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:  User input interface
+*
+*/
+
+#ifndef CVTUSERINPUT_H
+#define CVTUSERINPUT_H
+NONSHARABLE_CLASS( CVTUserInputDtmf ) : public CBase, 
+                                        public MVTUserInput
+    {
+    public:
+        /**
+         * ConstructL.
+         */
+        void ConstructL(TUint8 aTone);
+        /**
+         * NewL.
+         */
+        static CVTUserInputDtmf* NewL(TUint8 aTone);
+        
+        /**
+         * Destructor.
+         */
+        ~CVTUserInputDtmf();
+
+        /**
+        * Virtual function to return the user input type
+        **/
+        virtual TUserInputType GetType();
+    };
+
+NONSHARABLE_CLASS( CVTUserInputAlphanumeric ) : public CBase, 
+                                                public MVTUserInput
+    {
+    public:
+        /**
+         * ConstructL.
+         */
+        void ConstructL(TUint8 aTone);
+        /**
+         * NewL.
+         */
+        static CVTUserInputAlphanumeric* NewL(TUint8 aTone);
+        
+        /**
+         * Destructor.
+         */
+        ~CVTUserInputAlphanumeric();
+
+        /**
+        * Virtual function to return the user input type
+        **/
+        virtual TUserInputType GetType();
+    };
+#endif
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/inc/mvtprotocolhandler.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1124 @@
+/*
+* Copyright (c) 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 Telephony Protocol interface
+*
+*/
+
+#ifndef MVTENGMEDIAHANDLER_H
+#define MVTENGMEDIAHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <mmfdatabuffer.h>
+#include <mmfutilities.h>
+#include <mmfcontrollerframework.h>
+
+typedef TInt TVtCommandId;                   
+typedef TInt TVtCommandStatus;               
+typedef TDesC8 TVtMIMEType;
+
+const TUid KVTUidYUVFrameBuffer = {0xFFFFFF0d};
+const TInt KVtUidDataSrcPrime	= 0xFFFFFF08;
+const TInt KVtUidDataSrcPlay	= 0xFFFFFF09;
+const TInt KVtUidDataSrcPause	= 0xFFFFFF0A;
+const TInt KVtUidDataSrcStop	= 0xFFFFFF0B;
+
+_LIT8(KVtVideoMIMETypeYUV420, "/video/x-pv/raw/yuv420");
+
+enum TVt3G324MSupported
+    {
+    EVt3G324MMissing,
+    EVt3G324MSupported
+    }; 
+    
+enum TVtConfigType
+    {
+    EVtH324Config,
+    EVtVideoEncoderConfig
+    };
+
+enum TVtCommandType {
+    EVtCommandInit,
+    EVtCommandGetSDKInfo,
+    EVtCommandGetProtocolState = 3,
+    EVtCommandReset,
+    EVtCommandAddDataSource = 6,
+    EVtCommandRemoveDataSource,
+    EVtCommandAddDataSink,
+    EVtCommandRemoveDataSink,
+    EVtCommandConnect,
+    EVtCommandDisconnect,
+    EVtCommandPause,
+    EVtCommandResume,
+    EVtCommandGetProtocolInterface =20,
+    EVtCommandDeleteProtocolInterface,
+    EVtCommandCancelAllCommands
+    };
+
+enum TVtIndicationType 
+    {
+    EVtIndicationVideoSpatialTamporalTradeOffCommand,
+    EVtIndicationVideoSpatialTamporalTradeOffIndication,
+    EVtIndicationUserInputCapability = 6,
+    EVtIndicationIncomingTrack = 41,
+    EVtIndicationOutgoingTrack,
+    EVtIndicationDisconnect,
+    EVtIndicationClosingTrack,
+    EVtIndicationCloseTrack,
+    EVtIndicationPauseTrack,
+    EVtIndicationResumeTrack    
+    };
+      
+enum TVtMediaType      
+    {
+    EVtAudio = 1,
+    EVtVideo,
+    EVtControl,
+    EVtData,
+    EVtUserInput,
+    EVtMediaNone
+    };
+    
+enum TVtAudioOutputControlCommand   
+    {
+	  EVtAudioOutputControlGetMaxVolume,
+	  EVtAudioOutputControlGetVolume,
+	  EVtAudioOutputControlSetVolume,
+	  EVtAudioOutputControlGetBalance,
+	  EVtAudioOutputControlSetBalance
+	  };    
+
+const TUint8 EVtIncoming = 1;
+
+enum TUserInputType
+    {
+    EVtUiiDTFM,
+    EVtUiiAlphaNumeric
+    };
+
+struct TVtInitInfo
+    {
+    TBool iAMRWBOn;
+    TBool iDisableMpeg4;
+    };
+
+struct TVtIndicationEvent
+    {
+    public:    
+        /**
+         * Constructor.
+         */
+        TVtIndicationEvent(TInt aEventType, const TUint8 *aLocalBuffer) : iEventType(aEventType), iLocalBuffer(aLocalBuffer) 
+        {}
+    public:
+        TInt iEventType;
+        const TUint8 *iLocalBuffer;
+    };
+
+struct TVtCommandResponse
+    {
+    public:        
+        /**
+         * Constructor.
+         */
+        TVtCommandResponse(TVtCommandType aCmdType, TInt aCmdId, TInt iCmdStatus) : iCmdType(aCmdType), iCmdId(aCmdId), iCmdStatus(iCmdStatus)
+        {}
+    public:
+        TVtCommandType iCmdType;
+        TInt iCmdId;
+        TInt iCmdStatus;
+    };
+
+struct TVtErrorEvent
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        TVtErrorEvent(TInt aEventType) : iEventType(aEventType) {}
+    public:
+        TInt iEventType;
+    };
+    
+struct TVtMMFDataBuffer
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        TVtMMFDataBuffer(CMMFBuffer* aMmfBuffer,TSize  aFrameSize, TPtr8& aPtr) : iMmfBuffer(aMmfBuffer), iFrameSize(aFrameSize), iPtr(aPtr) {}
+
+        /**
+         * Get the YUV frame size.
+         * @return The frame size, in pixels
+         */
+        TSize GetFrameSize() {return iFrameSize;}
+
+        /**
+         * Get MMF buffer.
+         * @return the MMF buffer
+         */
+        CMMFBuffer* GetMMFBuffer() {return iMmfBuffer;}
+        
+        /**
+         * Get MMF buffer.
+         * @return the MMF buffer
+         */
+        const CMMFBuffer* GetMMFBuffer() const {return iMmfBuffer;}
+
+        /**
+        *  @return Returns a reference to the data buffer
+        **/
+        TPtr8& Data() {return iPtr;}
+
+        /**
+        *  @return Returns the frame size of the contained buffer.
+        **/
+        const TSize GetFrameSize() const {return iFrameSize;}
+        
+        /**
+        *  @return Returns a reference to the data buffer
+        **/
+        const TPtr8& Data() const {return iPtr;}
+    private:
+        CMMFBuffer* iMmfBuffer;
+        TSize  iFrameSize;
+        TPtr8&  iPtr;
+    };
+
+class MVTVideoInput
+    {
+    public:
+
+        /**
+         * Set the video frame format.  This must be from the list of supported formats.
+         * @param "aFormat" The mime string describing the video frame format.
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void SetFormatL(const TDesC8& aFormat) {}
+
+        /**
+         * Set the video frame rate.  This must be within the range of supported frame rates
+         * for the current frame size.
+         * @param "aFrameRate" The video frame rate to set.
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void SetFrameRateL(TReal32 aFrameRate) {}
+
+        /**
+         * Set the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void SetVideoFrameSizeL(const TSize& aSize) {}
+
+        /**
+         * Get the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         */
+        virtual void GetVideoFrameSizeL(TSize& aSize) const {}
+        
+        /**
+         * This API returns multimedias type supported by the data source/sink - 
+         * Audio, Video, Data etc.  Each supported type is indicated by a MIME type structure.
+         * @return 
+         **/
+        virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {}
+    };
+
+class MVTVideoOutput
+    {
+    public:
+
+        /**
+        *  Sets the data format using MIME string.
+        *  @param aFormat The format as a MIME string.
+        **/
+        virtual void SetFormatL(const TDesC8& aFormat) {}
+
+        /**
+         * Set the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         **/
+        virtual void SetVideoFrameSizeL(const TSize& aSize) {}
+
+        /**
+         * Get the video frame size
+         * @param "aSize" The video frame size, in pixels
+         * @exception Can leave with one of the system wide error codes
+         **/
+        virtual void GetVideoFrameSizeL(TSize& aSize) const {}
+
+        /**
+         * This API returns multimedias type supported by the data source/sink - 
+         * Audio, Video, Data etc.  Each supported type is indicated by a MIME type structure.
+         * @return 
+         **/
+        virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {}
+    };
+
+//This class is empty
+class MVTAudioSource
+    {
+    };
+
+//This class is empty
+class MVTAudioSink
+    {
+    };
+
+class MVTVideoSource;
+class MVTVideoSink : public MVTVideoOutput
+    {
+    public:
+        /**
+         * Constructor.
+         */
+        MVTVideoSink(TUid aType): iDataSinkType(aType) {}
+
+        /**
+         * Method called by a data source to request the data sink to empty aBuffer of data.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used when a data sink is passively waiting for requests from a supplier ie a data source
+         * to empty a buffer.  The data sink must call the BufferEmptiedL member on aSupplier when it has emptied
+         * the buffer of it's data - the data sink can either make this callback synchronously or asynchronously.
+         * 
+         * @param   "aBuffer"
+         *          The full buffer that needs emptying of it's data
+         *
+         * @param   "aSupplier" 
+         *          The data source that supplied the data. The data sink needs this to make the BufferEmptiedL
+         *          callback on aSupplier to indicate to the data source that the data sink has finished with the buffer.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data
+         */
+        virtual void EmptyBufferL(
+            TVtMMFDataBuffer aDataBuffer,
+            MVTVideoSource* aSupplier,
+            TMediaId aMediaId ) {}
+
+        /**
+         * Method called by a data source to pass back an filled buffer to the sink
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used as the callback when the data sink actively requests a supplier ie a data source
+         * to fill a buffer by calling the data sources FillBufferL.
+         * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied
+         * 
+         * @param   "aBuffer"
+         *          The buffer that has been filled by a data source and is now available for processing
+         */
+         virtual void BufferFilledL( CMMFBuffer* aBuffer ) = 0;
+
+        /**
+         * Method to indicate whether the data sink can create a buffer.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * 
+         * @return  ETrue if the data sink can create a buffer else EFalse
+         */
+        virtual TBool CanCreateSinkBuffer() {return EFalse;}
+
+        /**
+         * Returns a buffer created by the data sink
+         *
+         * This is a pure virtual function that each derived class must implement.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data.
+         *
+         * @param   "aReference"
+         *          This must be written to by the method to indicate whether the created buffer is
+         *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the sink
+         *          and should be used in preference to the source buffer provided the source buffer
+         *          is also not a reference buffer.
+         * .  
+         * @return  The created buffer
+         */
+        virtual CMMFBuffer* CreateSinkBufferL(
+            TMediaId aMediaId,
+            TBool &aReference ) {return NULL;}
+
+        /**
+         * Method to 'logon' the data sink to the same thread that sink will be consuming data in.
+         *
+         * This method may be required as the thread that the data sink was created in is not always
+         * the same thread that the data transfer will take place in.  Therefore any thread specific
+         * initialisation needs to be performed in the SinkThreadLogon rather than in the creation 
+         * of the data sink.
+         *
+         * This is a virtual function that a derrived data sink can implement if any thread specific
+         * initialisation is required and/or the data sink can create any asynchronous events.
+         * 
+         * 
+         * @param   "aEventHandler"
+         *          This is an MAsyncEventHandler to handle asynchronous events that occur during the
+         *          transfer of multimedia data.  The event handler must be in the same thread as the data transfer
+         *          thread - hence the reason it is passed in the SinkThreadLogon as opposed to say the constructor.
+         *
+         *
+         * @return  KErrNone if successful, otherwise a system wide error code.
+         */
+        virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;}
+
+        /**
+         * Method to 'logoff' the data sink from the same thread that sink consumes data in.
+         *
+         * This method may be required as the thread that the data sink is deleted in may not be
+         * the same thread that the data transfer took place in.  Therefore any thread specific
+         * releasing of resources needs to be performed in the SinkThreadLogoff rather than in the destructor
+         *
+         * This is a virtual function that a derrived data sink can implement if any thread specific
+         * releasing of resources is required.
+         */
+        virtual void SinkThreadLogoff() {}
+
+        /**
+         * Method to 'prime' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific 'priming' is required
+         */
+        virtual TInt SinkPrimeL() {return 0;}
+
+        /**
+         * Method to 'play' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific action is required prior to 'playing'ie the start of data transfer
+         */
+        virtual TInt SinkPlayL() {return 0;}
+
+        /**
+         * Method to 'pause' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific action is required to 'pause'
+         */
+        virtual TInt SinkPauseL() {return 0;}
+
+        /**
+         * Method to 'stop' the data sink
+         *
+         * This is a virtual function that a derrived data sink can implement if 
+         * any data sink specific action is required to 'stop'
+         */
+        virtual TInt SinkStopL() {return 0;}
+    private:
+        TUid iDataSinkType;
+    };
+    
+class MVTVideoSource : public MVTVideoInput
+    {
+    public:
+            
+        /**
+         * Constructor.
+         */
+    MVTVideoSource(TUid aType): iDataSourceType(aType) {}
+    
+        /**
+         * Method called by a data sink to request the data source to fill aBuffer with data.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used when a data source is passively waiting for requests from a consumer ie a data sink
+         * to fill a buffer.  The data source must call the BufferFilledL member on aConsumer when it has filled
+         * the buffer with data - the data source can either make this callback synchronously or asynchronously.
+         * 
+         * @param   "aBuffer"
+         *          The buffer that needs filling with data
+         *
+         * @param   "aConsumer" 
+         *          The data sink that consumes the data. The data source needs this to make the BufferFilledL
+         *          callback on aConsumer when the data source has completed filling the aBuffer.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data eg a multimedia file
+         */
+    virtual void FillBufferL(
+            CMMFBuffer* aBuffer,
+            MVTVideoSink* aConsumer,
+            TMediaId aMediaId ) {}
+    
+        /**
+         * Method called by a data sink to pass back an emptied buffer to the source
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * This method is used as the callback when the data source actively requests a consumer ie a data sink
+         * to empty a buffer by calling the data sinks EmptyBufferL.
+         * When the data source gets this callback it knows that the buffer has been emptied and can be reused
+         * 
+         * @param   "aBuffer"
+         *          The buffer that has been emptied by a data sink and is now available for reuse
+         */
+    virtual void BufferEmptiedL( CMMFBuffer* aBuffer ) = 0;
+    
+        /**
+         * Method to indicate whether the data source can create a buffer.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * 
+         * @return  ETrue if the data source can create a buffer else EFalse
+         */
+    virtual TBool CanCreateSourceBuffer() {return EFalse;}
+    
+        /**
+         * Returns a buffer created by the data source
+         *
+         * This is a pure virtual function that each derived class must implement.
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data eg a multimedia file
+         *
+         * @param   "aReference"
+         *          This must be written to by the method to indicate whether the created buffer is
+         *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the source
+         *          and should be used in preference to the sink buffer provided the sink buffer
+         *          is also not a reference buffer
+         * .  
+         * @return  The created buffer
+         */
+    virtual CMMFBuffer* CreateSourceBufferL(
+                TMediaId aMediaId,
+                TBool &aReference ) {return NULL;}
+    
+        /**
+         * Returns a buffer created by the data source
+         *
+         * This is a virtual function that a derived class can implement.
+         * This can be used in preference to the above CreateSourceBufferL method in cases where
+         * the source buffer creation has a dependancy on the sink buffer
+         *
+         * @param   "aMediaId"
+         *          This identifies the type of media eg audio or video and the stream id.
+         *          This parameter is required in cases where the source can supply data
+         *          of more than one media type and/or multiple strams of data eg a multimedia file
+         *
+         * @param   "aSinkBuffer"
+         *          The sink buffer the nature of which may influence the creation of the source buffer
+         *
+         * @param   "aReference"
+         *          This must be written to by the method to indicate whether the created buffer is
+         *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the source
+         *          and should be used in preference to the sink buffer provided the sink buffer is not a reference buffer
+         * .  
+         * @return  The created buffer
+         */
+    virtual CMMFBuffer* CreateSourceBufferL(
+                TMediaId aMediaId,
+                CMMFBuffer& aSinkBuffer,
+                TBool &aReference ) {return NULL;}
+    
+        /**
+         * Method to 'logon' the data source to the same thread that source will be supplying data in.
+         *
+         * This method may be required as the thread that the data source was created in is not always
+         * the same thread that the data transfer will take place in.  Therefore any thread specific
+         * initialisation needs to be performed in the SourceThreadLogon rather than in the creation 
+         * of the data source.
+         *
+         * This is a virtual function that a derrived data source can implement if any thread specific
+         * initialisation is required and/or the data source can create any asynchronous events.
+         * 
+         * 
+         * @param   "aEventHandler"
+         *          This is an MAsyncEventHandler to handle asynchronous events that occur during the
+         *          transfer of multimedia data.  The event handler must be in the same thread as the data transfer
+         *          thread - hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor.
+         *
+         *
+         * @return  KErrNone if successful, otherwise a system wide error code.
+         */
+    virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;}
+    
+        /**
+         * Method to 'logoff' the data source from the same thread that source supplies data in.
+         *
+         * This method may be required as the thread that the data source is deleted in may not be
+         * the same thread that the data transfer took place in.  Therefore any thread specific
+         * releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor
+         *
+         * This is a virtual function that a derrived data source can implement if any thread specific
+         * releasing of resources is required.
+         */
+    virtual void SourceThreadLogoff() {}
+    
+        /**
+         * Method to 'prime' the data source
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific 'priming' is required
+         */
+    virtual TInt SourcePrimeL() {return 0;}
+    
+        /**
+         * Method to 'play' the data source
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific action is required prior to 'playing'ie the start of data transfer
+         */
+    virtual TInt SourcePlayL() {return 0;}
+    
+        /**
+         * Method to 'pause' the data source
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific action is required to 'pause'
+         */
+    virtual TInt SourcePauseL() {return 0;}
+    
+        /**
+         * Method to 'stop' the data source
+         *
+         * This is a virtual function that a derrived data source can implement if 
+         * any data source specific action is required to 'stop'
+         */
+    virtual TInt SourceStopL() {return 0;}
+    private:
+        TUid iDataSourceType;
+    };
+
+class MCommServer
+    {
+    };
+
+class MVtProtocolCommand
+    {
+    public:
+    enum TVtProtocolState 
+        {     
+        EIdle,           
+        EInitializing, 
+        ESetup, 
+        EConnecting,
+        EConnected,
+        EDisconnecting,
+        EResetting
+        };
+    };
+
+class MVtProtocolHandler 
+    {
+    public:
+        
+       /**
+        * Handle an event that has been generated.
+        *
+        * @param "aResponse"  "The response to a previously issued command."
+        */
+	      virtual void HandleSessionCommandEventL(const TVtCommandResponse& aResponse) = 0;
+
+	      /**
+	       * Handle an informational event that has been generated.
+	       *
+	       * @param "aEvent" "The event to be handled."
+	       */
+	      virtual void HandleSessionInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+
+          /**
+	       * Handle an error event that has been generated.
+	       *
+	       * @param "aEvent" "The event to be handled."
+	       */
+	      virtual void HandleSessionErrorEventL(const TVtErrorEvent& aEvent) = 0;
+
+	      /** 
+	      *  Signals completion of the audio output control command.
+	      *  @param aId The command id of the completed command.
+	      *  @param aCmd The command type.
+	      *  @param aContextData The context data passed in with the command.
+	      *  @param aStatus The command completion status.
+	      **/
+	      virtual void HandleAudioOutputControlCommandComplete(TInt aId, TVtAudioOutputControlCommand aCmd, TAny *aContextData ,TInt aStatus) = 0;
+	      /**
+	       * Handle an event that has been generated.
+         *
+	       * @param "aResponse"  "The response to a previously issued command."
+	       */
+	      virtual void HandleVideoEncoderCommandCompletedL(const TVtCommandResponse& aResponse) = 0;
+
+	      /**
+	       * Handle an event that has been generated.
+         *
+	       * @param "aEvent" "The event to be handled."
+	       */
+	      virtual void HandleVideoEncoderInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+
+        /**
+	       * Handle an event that has been generated.
+         *
+         * @param "aResponse"  "The response to a previously issued command."
+	       */
+	      virtual void HandleH324MConfigCommandCompletedL(const TVtCommandResponse& aResponse) = 0;
+
+	      /**
+	       * Handle an event that has been generated.
+         *
+	       * @param "aEvent" "The event to be handled."
+	       */
+	      virtual void HandleH324MConfigInformationalEventL(const TVtIndicationEvent& aEvent) = 0;
+	      virtual ~MVtProtocolHandler() {}
+    };
+
+
+class MVtSessionCommand : public MVtProtocolCommand
+    {
+    public:
+        /**
+         * This function is valid only in the EIdle state.  It is a no-op when
+         * invoked in any other state.  It causes the protocol to transition
+         * to the ESetup state.  The terminal remains in the EInitializing state during
+         * the transition.
+         *
+         *
+         * @param aInitInfo
+         *         A reference to a TVtInitInfo structure which set Mona on and off
+         *         
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt InitProtocolL(TVtInitInfo& aInitInfo) = 0;
+
+        /**
+         * For an incoming track (MVTVideoSink) this function  pauses sending
+         * media to the sink (output device) and stops the sink.  It then does the protocol
+         * negotiations with the remote terminal to pause the logical channel for
+         * the specified track.
+         *
+         * For outgoing, it pauses the sending of media from the source and calls Stop() on the
+         * source.  It also performs any necessary protocol negotiations with the remote terminal.
+         * EVtCommandPause will be sent to the observer when the processing completes.
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt PauseVideoL(MVTVideoSource& aDataSource) = 0;
+        virtual TInt PauseVideoL(MVTVideoSink& aDataSink) = 0;
+        virtual TInt PauseAudioL(MVTAudioSource& aAudioSource) = 0;
+        
+        /**
+         * Resume a previously paused incoming or outgoing track.  For incoming,
+         * this function starts resumes playing out the media to the appropriate
+         * sink based on the current settings.  For outgoing it resumes encoding
+         * and sending media from the source.
+         * EVtCommandResume will be invoked will be invoked on the observer when the processing completes.       
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ResumeVideoL(MVTVideoSource& aDataSource) = 0;
+        virtual TInt ResumeVideoL(MVTVideoSink& aDataSink) = 0;
+        virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource) = 0;
+
+        /**
+         * This function is valid only in the ESetup and EInitializing state.  It is a
+         * no-op when invoked in the EIdle state
+         *
+         * It causes the protocol to transition back to the EIdle state.  The
+         * terminal remains in the EResetting state during the transition.
+         *
+         * While resetting, the protocol de-allocates all resources resources that
+         * had been previously allocated.  When it completes, ResetComplete is called
+         * and the protocol reverts to the EIdle state.
+         *
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ResetProtocolL() = 0;
+
+        /**
+         * This function can be invoked only in the ESetup state.  The terminal starts connecting with the remote
+         * terminal based on the specified options and capabilities.
+         * The EVtCommandConnect command completion event will be passed to the observer
+         * when connect completes.
+         * Details about the negotiated session may be obtained by calling the GetSessionParamsL API.
+         * GetSessionParamsL may be called after call setup is started to get the list of available channels
+         * and their capabilities.
+         * Incoming tracks may be opened before ConnectL completes and will be indicated via the
+         * EVtIndicationIncommingTrack event.
+         *
+         * @param aComm
+         *         An optional pointer to a comm server to provide comm source and sink end-points.
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt ConnectToProtocolL(MCommServer* aComm) = 0;
+
+        /**
+         * Allows an application to provide a media source to be associated with a logical channel
+         * of communication with the peer.  Sources should be added after the EVtIndicationOutgoingTrack
+         * indication is received for a newly established logical channel.  The media type and
+         * channel id associated with the logical channel are specified as part of the indication.
+         * This function accepts a MVtVideoSource which provides additional functionality
+         * for advertizing capability and exposing configuration APIs.  
+         * Data sources could be of the following types:
+         * a)raw media sources like camera, microphone etc.
+         * b)sources of compressed data like file, gateway component etc.
+         *
+         * @param aChannelId
+         *          Indicates the channel id to be associated with this source.
+         * @param aDataSource
+         *          reference to the data source
+         * @leave   This method can leave with one of the following error codes
+         *          KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle
+         *          KErrNoMemory if the SDK failed to allocate memory during this operation
+         * @return A unique command id for asynchronous completion
+         */
+        virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource) = 0;
+        virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource) = 0;
+
+        /**
+         * Allows an application to provide a media sink for rendering an incoming media bitstream in a
+         * logical channel of communication with the peer.
+         * AddDataSinkL can be called only for established incoming logical channels identified by a unique
+         * channel id.
+         * Regular incoming channels are established by the peer and are
+         * indicated using the EVtIndicationIncomingTrack indication.
+         * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality
+         * for advertizing capability and exposing configuration APIs.  
+         * EVtCommandAddDataSink event is sent to the observer on completion of this call.
+         *
+         * @param aChannelId
+         *          Indicates the channel id to be associated with this sink.
+         * @param aDataSink The data sink to be added
+         *
+         * @return A unique command id for asynchronous completion
+         **/
+        virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink) = 0;
+        virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink) = 0;
+
+        /**
+         * This API is to allow the user to cancel all pending requests.  The current request being
+         * processed, if any, will also be aborted.
+         * EVtCommandCancelAllCommands will be passed to the command observer on completion.
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt CancelAllCommandsL( ) = 0;
+
+        /**
+         * The Disconnect call is valid only when invoked in the EConnecting, and
+         * EConnected states.  It causes the terminal to transition to the
+         * EDisconnecting state.  All the media tracks both incoming and outgoing
+         * will be closed on invoking Disconnect. On completion, the terminal
+         * goes to the ESetup state.
+         *
+         * It is a no-op when called in any other state.
+         *
+         * This is an asynchronous request.  The EvtCommandDisconnect event will be
+         * sent to the observer when the request processing is complete.  This
+         * is the only event the Phone application should expect after calling
+         * Disconnect.
+         *
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt DisconnectFromProtocolL() = 0;
+
+        /**
+         * This API is to allow for extensibility of the protocol interface.
+         * It allows a caller to ask for an instance of a particular interface object to be returned.
+         * The mechanism is analogous to the COM IUnknown method.  The interfaces are identified with
+         * an interface ID that is a UUID as in DCE and a pointer to the interface object is
+         * returned if it is supported.  Otherwise the returned pointer is NULL.
+         * @param aType
+         * @param aProtocolCommand
+         * @exception not_supported
+         * leaves if the specified interface id is not supported.
+         **/
+        virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand) = 0;
+
+        /**
+         * This APIis to be used to release an interface that was previously obtained using
+         * QueryInterfaceL.
+         * @param aType
+         * @param 
+         * @exception not_supported
+         * leaves if the specified interface id is not supported.
+         **/
+        virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*) = 0;
+        
+        /**
+         * Destructor.
+         */
+        virtual ~MVtSessionCommand() {}   
+    };
+
+class MVTUserInput
+    {
+    public:
+
+        /**
+        * @returns Returns the user input type.
+        **/
+        virtual TUserInputType GetType() = 0;
+        virtual ~MVTUserInput() {}
+    };
+
+class MVtH324ConfigCommand : public MVtProtocolCommand
+    {
+    public:
+
+        /**
+         * This API allows the user to specify observers for the 324m interface.
+         *
+         * @param aHandler     the observer for command status and unsolicited informational events
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+        /**
+         * Sets the vendor identification data.  This does not cause the stack to issue a vendor identifiation request.
+         * Set to NULL to disable sending vendor id.  If set to a valid parameter before Connect, it will cause the stack
+         * to automatically send it along with the TCS message.
+         * @param cc
+         *         T35 Country code
+         * @param ext
+         *         T35 Extension
+         * @param mc
+         *         T35 Manufacturer code
+         * @param aProduct
+         *         Product number
+         * @param aVersion
+         *         Version number
+         **/
+        virtual TInt SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion) = 0;
+        /**
+         * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+         * It is a request to the remote encoder to adjust its encoding in accordance with the tradeoff value.
+         * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+         * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+         * to precise values of spatial resolution or frame rate.
+         *
+         **/
+        virtual TInt SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff)=0;
+
+        /**
+         * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+         * It is an indication to the remote decoder that the local encoder has adjusted its encoding parameters
+         * according to the tradeoff value.
+         * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate.
+         * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond
+         * to precise values of spatial resolution or frame rate.
+         *
+         **/
+        virtual TInt SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff)=0;
+
+        /**
+         * This API allows the user to specify the supported resolutions for video for transmit and receive.
+         *
+         **/
+        virtual TInt SetSupportedResolutions( ) = 0;
+
+        /**
+        * This API allows the user to set options for fast call setup procedures
+        **/
+
+        virtual TInt SetFastCsupOptions( ) = 0;
+
+        /**
+         * Causes the protocol to send the specified user input to the remote terminal using
+         * control channel.  The user input can be either DTMF ot Alphanumeric
+         * @param user_input A pointer to MVTUserInput
+         * @returns A unique command id for asynchronous completion
+         **/
+        virtual TInt SendUserInputMessageL(MVTUserInput& user_input) = 0;        
+    };
+    
+class MVtVideoConfigCommand : public MVtProtocolCommand
+    {
+    public:
+
+        /**
+         * This API allows the user to specify separate observers for the extension interface.  
+         * 
+         * @param aHandler     the observer for unsolicited informational events
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+        /**
+         * Sets the I-Frame refresh rate of the encoded output.
+         *
+         * @param aIFrameInterval I-Frame rate in seconds per I-Frame
+         * @return True if successful, else false
+         */
+        virtual TInt SetIntraFrameInterval(TUint32 aIFrameInterval) = 0;
+        
+        /**
+         * Requests the encoder to encode the next frame as an I-Frame.  If successful, the next encoded
+         * frame will be an I-Frame.
+         *
+         * @return True for success, else false
+         */
+        virtual TInt RequestNextIntraFrame() = 0;
+        
+        /**
+         * Sets the frame rate of encoded output for the specified layer.
+         * @param aFrameRate Frame rate for the specified layer in frames per second.
+         * @return True if successful, else false.
+         */
+        virtual TInt SetVideoFrameRate(TUint32 aFrameRate) = 0;
+    };    
+
+class MVtAudioConfigCommand : public MVtProtocolCommand
+    {
+    public:
+
+        /**
+         * This API allows the user to specify observers for the 324m interface.
+         *
+         * @param aHandler
+         **/
+        virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0;
+
+        /**
+         * Method to set the playback volume to the specified value.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * It is also an asynchronous function which will be answered with a callback.
+         * 
+         * @param aNewVolume
+         *        An input parameter to hold the value for the requested playback volume.  
+         *
+         * @returns   Returns a command ID that can be used to identify a command completion result with corresponding request.
+         */
+        virtual TInt SetAudioVolumeL(TInt aVolume) = 0;
+        
+        /**
+         * Method to get the maximum valid value for the playback volume.
+         *
+         * This is a pure virtual function that each derived class must implement.
+         * It is also an asynchronous function which will be answered with a callback.
+         * 
+         * @param aMaxVolume
+         *        An output parameter to hold the value for the maximum valid playback volume.  
+         *            Note that the parameter should not be used until the callback indicates that the 
+         *            method has completed.
+         *
+         * @returns   Returns a command ID that can be used to identify a command completion result with corresponding request.
+         */
+        virtual TInt GetMaxAudioVolumeL(TInt& aMaxVolume) = 0;
+    };
+    
+class VTProtocolFactory
+    {
+    public:
+        
+        /**
+         * Create one instance.
+         */
+        IMPORT_C static MVtSessionCommand* CreateSessionCommandL(MVtProtocolHandler* aProtocolHandler, TBool aEnableProxy, TVt3G324MSupported& a3G324MSupported);
+    
+        /**                                                                       
+         * This function allows the application to delete an instance of a terminal 
+         * and reclaim all allocated resources.  A terminal should be deleted only in 
+         * the EIdle state.  An attempt to delete a terminal in any other state will 
+         * result in unpredictable behavior.                                            
+         *                                                                        
+         * @param terminal the terminal to be deleted. 
+         * 
+         **/
+        IMPORT_C static void DeleteSessionCommand( MVtSessionCommand* aSessionCommand ); 
+    
+        /**                                                                       
+         * Creates an instance of a DevSound audio data source.
+         *                                                                        
+         * @param None
+         *                                                                        
+         * @returns A pointer to the interface
+         **/                                                                      
+        IMPORT_C static MVTAudioSource* CreateAudioSource();
+    
+        /**                                                                       
+         * Deletes an instance of a DevSound audio data source
+         * that was previously created with CreateAudioSource();
+         *                                                                        
+         * @param aSource The audio data source to be deleted.
+         *                                                                        
+         * @returns status
+         **/                                                                      
+        IMPORT_C static TInt DeletAudioSource(MVTAudioSource *aSource); 
+    
+        /**                                                                       
+         * Creates an instance of a DevSound audio data sink.
+         *                                                                        
+         * @param None
+         *                                                                        
+         * @returns A pointer to the interface
+         **/                                                                      
+        IMPORT_C static MVTAudioSink* CreateAudioSink();
+    
+        /**                                                                       
+         * Deletes an instance of a DevSound audio data sink
+         * that was previously created with CreateAudioSink();
+         *                                                                        
+         * @param The audio data sink to be deleted.
+         *                                                                        
+         * @returns status
+         **/                                                                      
+        IMPORT_C static TInt DeleteAudioSink(MVTAudioSink *aSink);
+    
+        /**                                                                       
+         * Creates an instance of a comm server of a particular name, to be used to
+         * initialize the terminal.
+         *                                                                        
+         *                                                                        
+         * @returns A pointer to a terminal or leaves if the type is invalid or the system is out of resources                                                              
+         **/                                                                      
+        IMPORT_C static MCommServer* CreateCommServerL(const TDesC & aName, TBool aEnableBitReversal=EFalse);
+    
+        /**
+         * This function allows the application to delete an instance of a comm server
+         * and reclaim all allocated resources.  A comm server should be deleted only when the 
+         * protocol is in the EIdle state.  An attempt to delete a comm server in any other state 
+         * could result in memory corruption within the protocol.  This function will leave  with
+         * KErrInUse if the comm server is still in use.  However it will not check the state of the 
+         * protocol that is using the comm server.
+         * 
+         * @param aCommServer the comm server to be deleted.
+         * 
+         * @returns a status code indicating success or failure
+         **/
+        IMPORT_C static void DeleteCommServerL(MCommServer* aCommServer);
+        
+        /**
+         * Create instance.
+         * @param aUIITyep
+         * @param aTone
+         */
+        IMPORT_C static MVTUserInput* CreateUserInputIndication(TUserInputType aUIIType, TUint8 aTone);
+        
+        /**
+         * Delete instance.
+         * @param aUII
+         */
+        IMPORT_C static void DeleteUserInputIndication(MVTUserInput* aUII);
+        
+        /**
+         * 
+         * @param aAudioSink
+         */
+        IMPORT_C static MVtAudioConfigCommand* GetAudioConfigCommandL(MVTAudioSink* aAudioSink);
+    };
+
+#endif
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/caudioconfighandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 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:  Audio configuration implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "caudioconfighandler.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TAudioConfigHandler::TAudioConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TAudioConfigHandler::TAudioConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler<")));
+    __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::CAudioConfigCommand
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CAudioConfigCommand::CAudioConfigCommand() 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand<")));	
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand>")));		
+    }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::SetObserverL
+// This API allows the user to specify observers for the 324m interface.
+// -----------------------------------------------------------------------------
+//
+void CAudioConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL<")));	
+    iAudioConfigHandler = new (ELeave)TAudioConfigHandler(aHandler);
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::SetAudioVolumeL
+// Method to set the playback volume to the specified value.
+// -----------------------------------------------------------------------------
+//
+TInt CAudioConfigCommand::SetAudioVolumeL(TInt aVolume)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL")));	
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL aVolume %d"), aVolume));		
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::GetMaxAudioVolumeL
+// Method to get the maximum valid value for the playback volume.
+// -----------------------------------------------------------------------------
+//
+TInt CAudioConfigCommand::GetMaxAudioVolumeL(TInt& aMaxVolume)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL")));	
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL aMaxVolume %d"), aMaxVolume));		
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CAudioConfigCommand::~CAudioConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CAudioConfigCommand::~CAudioConfigCommand()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand>")));
+    delete iAudioConfigHandler;
+    __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand")));
+    }
+//  End of File
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/cdatasinkproxy.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 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:  Data sink proxy implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cdatasinkproxy.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::CDisplaySinkProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkProxy::CDisplaySinkProxy(MVTVideoSink* aDisplaySink) : iDisplaySink(aDisplaySink) 
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy<" ) ));
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy iDisplaySink %d>" ), iDisplaySink));
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CDisplaySinkProxy::ConstructL()
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL<" ) ));
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL>" ) ));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDisplaySinkProxy::NewL
+// -----------------------------------------------------------------------------
+//
+CDisplaySinkProxy* CDisplaySinkProxy::NewL(MVTVideoSink* aDisplaySink)
+    {
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL<" ) ));
+    CDisplaySinkProxy* self = new (ELeave)CDisplaySinkProxy(aDisplaySink);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL>" ) ));
+    return self;
+    }
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/cdatasourceproxy.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 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:  Data source proxy implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cdatasourceproxy.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::CVideoSourceProxy
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVideoSourceProxy::CVideoSourceProxy(MVTVideoSource* aDataSource) : iVideoSource(aDataSource) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy<")));
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy iVideoSource %d>"), iVideoSource));	
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVideoSourceProxy::ConstructL() 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL<")));
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL>")));	
+    }
+    
+// -----------------------------------------------------------------------------
+// CVideoSourceProxy::NewL
+// -----------------------------------------------------------------------------
+//
+CVideoSourceProxy* CVideoSourceProxy::NewL(MVTVideoSource* aDataSource) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL<")));
+    CVideoSourceProxy* self = new (ELeave)CVideoSourceProxy(aDataSource);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL>")));  
+    return self;
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/ch324confighandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 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:  H324 configuration implementation
+*
+*/
+
+
+#include "mvtprotocolhandler.h"
+#include "ch324confighandler.h"
+#include "cvtuserinput.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+
+// -----------------------------------------------------------------------------
+// TH324ConfigHandler::TH324ConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TH324ConfigHandler::TH324ConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler<")));	
+    __IF_DEBUG(Print(_L("VTProto: TH324ConfigHandler::TH324ConfigHandler>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetVendorId
+// Sets the vendor identification data.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetVendorId")));		
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand
+// This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffCommand")));			
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication
+// This API allows the user to send a videoTemporalSpatialTradeOff command to the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendVideoTemporalSpatialTradeoffIndication")));		
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetVideoResolutions
+// This API allows the user to specify the supported resolutions for video for transmit and receive.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetSupportedResolutions()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetSupportedResolutions")));	
+        
+    return KErrNone;    
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetFastCsupOptions
+// This API allows the user to set options for fast call setup procedures.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SetFastCsupOptions( )
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetFastCsupOptions")));	
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SendUserInputMessageL
+// Causes the vt2way to send the specified user input to the remote terminal using
+// control channel.
+// -----------------------------------------------------------------------------
+//
+TInt CH324ConfigCommand::SendUserInputMessageL(MVTUserInput& user_input)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL<")));	
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SendUserInputMessageL>")));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::SetObserverL
+// This API allows the user to specify observers for the 324m interface.
+// -----------------------------------------------------------------------------
+//
+void CH324ConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL<")));	 	
+    iH324ConfigHandler = new (ELeave)TH324ConfigHandler(aHandler);
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL observer %d"), iH324ConfigHandler));
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::SetObserverL>")));	 
+    }
+
+// -----------------------------------------------------------------------------
+// CH324ConfigCommand::~CH324ConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CH324ConfigCommand::~CH324ConfigCommand()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand<")));		
+    delete iH324ConfigHandler;
+    __IF_DEBUG(Print(_L("VTProto: CH324ConfigCommand::~CH324ConfigCommand>")));	
+    }    
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/csessionhandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 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:  Session command implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cdatasinkproxy.h"
+#include "cdatasourceproxy.h"
+#include "csessionhandler.h"
+#include "ccommserver.h"
+#include "ch324confighandler.h"
+#include "cvideoconfighandler.h"
+#include "caudioconfighandler.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TSessionHandler::TSessionHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TSessionHandler::TSessionHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler<")));	
+    __IF_DEBUG(Print(_L("VTProto: TSessionHandler::TSessionHandler>")));	
+    }
+
+   
+// -----------------------------------------------------------------------------
+// CSessionCommand::CSessionCommand
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CSessionCommand::CSessionCommand(TSessionHandler* aSessionHandler) 
+  : iSessionHandler(aSessionHandler) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand<")));
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CSessionCommand>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::~CSessionComman
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSessionCommand::~CSessionCommand()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand<")));	
+    delete iVideoSource;
+    delete iDisplaySink;
+    delete iSessionHandler;
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::~CSessionCommand>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ConnectToProtocolL
+// This function can be invoked only in the ESetup state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ConnectToProtocolL(MCommServer* aComm)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL")));		
+    CCommServer* commServer = static_cast<CCommServer*>(aComm);
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ConnectToProtocolL commServer %d"), commServer));
+    return KErrNone;    
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::DisconnectFromProtocolL
+// The Disconnect call is valid only when invoked in the EConnecting, and
+// EConnected states.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::DisconnectFromProtocolL()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DisconnectFromProtocolL")));			
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResetProtocolL
+// This function is valid only in the ESetup and EInitializing state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResetProtocolL()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResetProtocolL")));	
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::InitProtocolL
+// This function is valid only in the EIdle state.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::InitProtocolL(TVtInitInfo& aInitInfo)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::InitProtocolL")));	
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddVideoSinkL
+// Allows an application to provide a media sink for rendering an incoming media bitstream in a
+// logical channel of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddVideoSinkL(const TUint aChannelId, MVTVideoSink& aDataSink)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL")));	
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSinkL aChannelId %d"), aChannelId));
+    iDisplaySink =CDisplaySinkProxy::NewL(&aDataSink);
+    return KErrNone;        
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddVideoSourceL
+// Allows an application to provide a media source to be associated with a logical channel
+// of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddVideoSourceL(const TUint aChannelId, MVTVideoSource& aDataSource)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL")));	
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddVideoSourceL aChannelId %d"), aChannelId));
+    iVideoSource = CVideoSourceProxy::NewL(&aDataSource);
+    return KErrNone;        
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddAudioSourceL
+// Allows an application to provide a media source to be associated with a logical channel
+// of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL")));	
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSourceL aChannelId %d"), aChannelId));	
+    CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aDataSource);
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::AddAudioSinkL
+// Allows an application to provide a media sink for rendering an incoming media bitstream in a
+// logical channel of communication with the peer.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL")));	
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::AddAudioSinkL aChannelId %d"), aChannelId));	
+    CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(&aDataSink);
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseVideoL
+// For an incoming track (MVTVideoSink) this function  pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseVideoL(MVTVideoSource& aTrack)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL")));		
+    return KErrNone;    
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseVideoL
+// For an incoming track (MVtVideoSink) this function  pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseVideoL(MVTVideoSink& aTrack) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseVideoL")));		
+    return KErrNone;     
+    }        
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::PauseAudioL
+// For an incoming track (MVTAudioSource) this function  pauses sending
+// media to the sink (output device) and stops the sink.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::PauseAudioL(MVTAudioSource& aTrack)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::PauseAudioL")));		
+    CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack);
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeVideoL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeVideoL(MVTVideoSource& aTrack)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL")));		
+    return KErrNone;    
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeVideoL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeVideoL(MVTVideoSink& aTrack) 
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeVideoL")));		
+    return KErrNone;     
+    } 
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::ResumeAudioL
+// Resume a previously paused incoming or outgoing track.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::ResumeAudioL(MVTAudioSource& aTrack)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::ResumeAudioL")));		
+    CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(&aTrack);
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::CancelAllCommandsL
+// This API is to allow the user to cancel all pending requests.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::CancelAllCommandsL( )
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::CancelAllCommandsL")));	
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::GetProtocolInterfaceL
+// This API is to allow for extensibility of the protocol interface.
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL<")));		
+    TInt commandId = 0;
+    if (aType == EVtH324Config)
+        {
+        CH324ConfigCommand* H324ConfigCommand = new (ELeave)CH324ConfigCommand();
+                
+        aProtocolCommand = H324ConfigCommand;
+        }
+    else if (aType == EVtVideoEncoderConfig)
+        {
+        CVideoConfigCommand* videoConfigCommand = new (ELeave)CVideoConfigCommand();
+                
+        aProtocolCommand = videoConfigCommand;
+        }
+    else
+        {
+        ;
+        }
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::GetProtocolInterfaceL aType %d, aProtocolCommand %d>"), aType, aProtocolCommand));    
+    return commandId;
+    }
+
+// -----------------------------------------------------------------------------
+// CSessionCommand::DeleteProtocolInterfaceL
+// This APIis to be used to release an interface that was previously obtained using
+// -----------------------------------------------------------------------------
+//
+TInt CSessionCommand::DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL<")));
+    TInt commandId = 0;
+    if (aType == EVtH324Config)
+            {
+            CH324ConfigCommand* H324ConfigCommand = static_cast<CH324ConfigCommand*>(aProtocolCommand);
+            
+            delete H324ConfigCommand;
+            }
+        else if (aType == EVtVideoEncoderConfig)
+            {
+            CVideoConfigCommand* videoConfigCommand = static_cast<CVideoConfigCommand*>(aProtocolCommand);
+            
+            delete videoConfigCommand;
+            }
+        else
+            {
+            ;
+            }
+    __IF_DEBUG(Print(_L("VTProto: CSessionCommand::DeleteProtocolInterfaceL aType, aProtocolCommand %d>"), aType, aProtocolCommand));        
+    return commandId;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/cvideoconfighandler.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 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 configuration implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cvideoconfighandler.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// TVideoConfigHandler::TVideoConfigHandler
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+TVideoConfigHandler::TVideoConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler<")));
+    __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler>")));	
+    }
+    
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetObserverL
+// This API allows the user to specify separate observers for the extension interface.
+// -----------------------------------------------------------------------------
+//
+void CVideoConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL<")));	
+    iVideoConfigHandler = new (ELeave)TVideoConfigHandler(aHandler);
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetIntraFrameInterval
+// Sets the I-Frame refresh rate of the encoded output.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::SetIntraFrameInterval(TUint32 aIFrameInterval)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval")));
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval aIFrameInterval %d"), aIFrameInterval));			
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::RequestNextIntraFrame
+// Requests the encoder to encode the next frame as an I-Frame.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::RequestNextIntraFrame()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::RequestNextIntraFrame")));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::SetVideoFrameRate
+// Sets the frame rate of encoded output for the specified layer.
+// -----------------------------------------------------------------------------
+//
+TInt CVideoConfigCommand::SetVideoFrameRate(TUint32 aFrameRate)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate")));
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate aFrameRate %d"), aFrameRate));		
+    return KErrNone;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CVideoConfigCommand::~CVideoConfigCommand
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVideoConfigCommand::~CVideoConfigCommand()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));	
+    delete iVideoConfigHandler;
+    __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/cvtuserinput.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 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:  VT User input implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cvtuserinput.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::ConstructL
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+void CVTUserInputDtmf::ConstructL(TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::ConstructL<")));	
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::ConstructL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::CVTUserInputDtmf
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputDtmf* CVTUserInputDtmf::NewL(TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::NewL<")));	
+    CVTUserInputDtmf* self = new (ELeave)CVTUserInputDtmf();
+    CleanupStack::PushL(self);
+    self->ConstructL(aTone);
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::NewL>")));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::~CVTUserInputDtmf
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputDtmf::~CVTUserInputDtmf()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::~CVTUserInputDtmf<")));	
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputDtmf::~CVTUserInputDtmf>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::GetType
+// Virtual function to return the user input type
+// -----------------------------------------------------------------------------
+//
+TUserInputType CVTUserInputDtmf::GetType()
+    {
+    return EVtUiiDTFM;
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputDtmf::ConstructL
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+void CVTUserInputAlphanumeric::ConstructL(TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::ConstructL<")));	
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::ConstructL>")));
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::CVTUserInputAlphanumeric
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputAlphanumeric* CVTUserInputAlphanumeric::NewL(TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::NewL<")));
+    CVTUserInputAlphanumeric* self = new (ELeave)CVTUserInputAlphanumeric();
+    CleanupStack::PushL(self);
+    self->ConstructL(aTone);
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::NewL>")));   
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric()
+    {
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric<")));		
+    __IF_DEBUG(Print(_L("VTProto: CVTUserInputAlphanumeric::~CVTUserInputAlphanumeric>")));		
+    }
+
+// -----------------------------------------------------------------------------
+// CVTUserInputAlphanumeric::GetType
+// Virtual function to return the user input type.
+// -----------------------------------------------------------------------------
+//
+TUserInputType CVTUserInputAlphanumeric::GetType()
+    {
+    return EVtUiiAlphaNumeric;
+    }
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtprotocolsstub/src/vtprotocolfactory.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 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:  Protocol factory implementation
+*
+*/
+
+#include "mvtprotocolhandler.h"
+#include "cdatasourceproxy.h"
+#include "cdatasinkproxy.h"
+#include "csessionhandler.h"
+#include "caudioconfighandler.h"
+#include "cvtuserinput.h"
+#include "ccommserver.h"
+
+#ifdef _DEBUG
+#    define __IF_DEBUG(t) {RDebug::t;}
+#else
+#    define __IF_DEBUG(t)
+#endif
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateSessionCommandL
+// Create one instance. 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtSessionCommand* VTProtocolFactory::CreateSessionCommandL(MVtProtocolHandler* aProtocolHandler, TBool aEnableProxy, TVt3G324MSupported& a3G324MSupported)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateSessionCommandL<")));
+    a3G324MSupported = EVt3G324MMissing;	
+    TSessionHandler * sessionHandler = new (ELeave)TSessionHandler(aProtocolHandler);
+    CleanupStack::PushL(sessionHandler);
+    CSessionCommand* sessionCommand = new (ELeave)CSessionCommand(sessionHandler);
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateSessionCommandL sessionCommand %d>"), sessionCommand));
+    return sessionCommand;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteSessionCommand
+// This function allows the application to delete an instance of a terminal 
+// and reclaim all allocated resources.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C  void VTProtocolFactory::DeleteSessionCommand( MVtSessionCommand* aSessionCommand )
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteSessionCommand<")));		
+    CSessionCommand* sessionCommand = static_cast<CSessionCommand*>(aSessionCommand);
+    delete aSessionCommand;
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteSessionCommand>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateAudioSource
+// Creates an instance of a DevSound audio data source.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTAudioSource* VTProtocolFactory::CreateAudioSource()
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSource<")));
+    TInt err( KErrNone );
+    CAudioSourceProxy* audioSourceProxy = NULL;	
+    TRAP (err, audioSourceProxy = new (ELeave) CAudioSourceProxy() );
+    if (err != KErrNone)
+        {
+        return NULL;
+        }    
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSource audioSourceProxy %d>"), audioSourceProxy));
+    return audioSourceProxy;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeletAudioSource
+// Deletes an instance of a DevSound audio data source.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt VTProtocolFactory::DeletAudioSource(MVTAudioSource *aSource)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeletAudioSource<")));	
+    CAudioSourceProxy* audioSourceProxy = static_cast<CAudioSourceProxy*>(aSource);
+    delete aSource;
+   __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeletAudioSource>")));	
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateAudioSink
+// Creates an instance of a DevSound audio data sink.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTAudioSink* VTProtocolFactory::CreateAudioSink()
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSink<")));
+    TInt err( KErrNone );		
+    CAudioSinkProxy* audioSinkProxy = NULL;
+    TRAP(err, audioSinkProxy = new (ELeave) CAudioSinkProxy() );
+    if (err != KErrNone)
+        {
+        return NULL;
+        }
+    
+   __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateAudioSink audioSinkProxy %d>"), audioSinkProxy));		
+    return audioSinkProxy;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteAudioSink
+// Deletes an instance of a DevSound audio data sink
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt VTProtocolFactory::DeleteAudioSink(MVTAudioSink *aSink)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteAudioSink<")));			
+    CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(aSink);
+    delete aSink;
+     __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteAudioSink>")));
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateCommServerL
+// Creates an instance of a comm server of a particular name, to be used to
+// initialize the terminal.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MCommServer* VTProtocolFactory::CreateCommServerL(const TDesC & aName, TBool aEnableBitReversal)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateCommServerL<")));	
+    CCommServer* commServer = new (ELeave)CCommServer();
+    CleanupStack::PushL(commServer);
+    CleanupStack::Pop();
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateCommServerL commServer %d>"), commServer));	
+    return commServer;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteCommServerL
+// This function allows the application to delete an instance of a comm server
+// and reclaim all allocated resources.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteCommServerL(MCommServer* aCommServer)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteCommServerL<")));		
+    CCommServer* commServer = static_cast<CCommServer*>(aCommServer);
+    delete aCommServer;
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::DeleteCommServerL>")));	
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::CreateUserInputIndication
+// Create instance .
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVTUserInput* VTProtocolFactory::CreateUserInputIndication(TUserInputType aUIIType, TUint8 aTone)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::CreateUserInputIndication")));	
+    if (aUIIType == EVtUiiDTFM)
+        {
+        CVTUserInputDtmf* uii = CVTUserInputDtmf::NewL(aTone);
+        return uii;
+        }
+    else if (aUIIType == EVtUiiAlphaNumeric)
+        {
+        CVTUserInputAlphanumeric* uii = CVTUserInputAlphanumeric::NewL(aTone);
+        return uii;
+        }
+    else
+        {
+        return NULL;
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::DeleteUserInputIndication
+// Delete instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void VTProtocolFactory::DeleteUserInputIndication(MVTUserInput* aUII)
+    {
+    delete aUII;
+    }
+
+// -----------------------------------------------------------------------------
+// VTProtocolFactory::GetAudioConfigCommandL
+// Get one instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MVtAudioConfigCommand* VTProtocolFactory::GetAudioConfigCommandL(MVTAudioSink* aAudioSink)
+    {
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::GetAudioConfigCommandL<")));		
+    CAudioSinkProxy* audioSinkProxy = static_cast<CAudioSinkProxy*>(aAudioSink);
+    CAudioConfigCommand* audioConfigCommand = new (ELeave)CAudioConfigCommand();
+    __IF_DEBUG(Print(_L("VTProto: VTProtocolFactory::GetAudioConfigCommandL audioConfigCommand %d>"), audioConfigCommand));	
+    return audioConfigCommand;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* 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:  Build information for Vtuis subsystem.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Include components' bld.inf files
+#include "../videotelui/group/bld.inf"
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/aif/videoteluiaif.rss	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* 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:  AIF resource for Video Telephone.
+*
+*/
+
+
+
+//  INCLUDES
+#include <aiftool.rh>
+
+
+//  RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+//   
+// AIF_DATA
+// Resource for AIF.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AIF_DATA
+    {
+    app_uid = 0x101F8681;
+    num_icons = 1;
+    hidden = KAppIsHidden;
+    }
+
+// End of File
Binary file vtuis/videotelui/cenrep/keys_s60videotelephony.xls has changed
Binary file vtuis/videotelui/conf/s60videotelephony.confml has changed
Binary file vtuis/videotelui/conf/s60videotelephony_102072D0.crml has changed
Binary file vtuis/videotelui/conf/s60videotelephony_10281872.crml has changed
Binary file vtuis/videotelui/data/VtStartRecord.wav has changed
Binary file vtuis/videotelui/data/VtStopRecord.wav has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/data/videotelui.rss	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1913 @@
+/*
+* Copyright (c) 2004, 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:  Resources for Video Telephone application.
+*
+*/
+
+
+
+//  RESOURCE IDENTIFIER
+NAME        VTUI
+
+//  INCLUDES
+#include    <eikon.rh>
+#include    <avkon.rsg>
+#include    <avkon.rh>
+#include    <avkon.loc>
+#include    <data_caging_paths_strings.hrh>
+#include    <avkon.mbg>
+#include    <videotelui.mbg>
+#include    <aknsconstants.hrh>
+
+#include    <videotelui.loc>
+#include    "videotelui.hrh"
+
+
+#include    <appinfo.rh>
+
+//  CONSTANTS
+#define KVtStartSoundFile   "z:\\system\\sounds\\digital\\VtStartRecord.wav"
+#define KVtStopSoundFile    "z:\\system\\sounds\\digital\\VtStopRecord.wav"
+//  RESOURCE DEFINITIONS
+
+// -----------------------------------------------------------------------------
+//
+// Resource file signature.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+// -----------------------------------------------------------------------------
+//
+// Default name of the document. No such document, so empty.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF
+    {
+    buf = "";
+    }
+
+// -----------------------------------------------------------------------------
+//
+// Application information.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO
+    {
+    status_pane = r_videotelui_status_pane;
+    menubar = r_videotelui_menubar;
+    cba = r_videotelui_softkeys_end_call;
+    custom_app_info_extension = r_videotelui_info_extension;
+    }
+// -----------------------------------------------------------------------------
+//
+// Info extension
+// r_videotelui_info_extension
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO_EXT r_videotelui_info_extension
+    {
+    popup_toolbar = r_videotelui_fixed _toolbar;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_localisable_app_info
+// Captions for this application.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE LOCALISABLE_APP_INFO r_videotelui_localisable_app_info
+    {
+    short_caption = qtn_apps_videophone_grid;
+    caption_and_icon =
+        CAPTION_AND_ICON_INFO
+            {
+            caption = qtn_apps_videophone_grid;
+#ifdef __SCALABLE_ICONS
+            number_of_icons = 1;
+
+
+            icon_file =
+                "Z:"APP_BITMAP_DIR"\\videotelui_aif.mif";
+#else
+            number_of_icons = 1;
+            icon_file =
+                "Z:"APP_BITMAP_DIR"\\videotelui_aif.mbm";
+
+
+#endif // __SCALABLE_ICONS
+            };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_status_pane
+// Status pane for the application.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE STATUS_PANE_APP_MODEL r_videotelui_status_pane
+    {
+    layout = R_AVKON_STATUS_PANE_LAYOUT_USUAL;
+    panes =
+        {
+        SPANE_PANE
+            {
+            id = EEikStatusPaneUidTitle;
+            type = EAknCtTitlePane;
+            resource = r_videotelui_title_pane;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_menubar
+// Menubar for the application.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_videotelui_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_videotelui_menu;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_ok_menubar
+// Menubar for the application.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_videotelui_ok_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_videotelui_ok_menu;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_menu
+// Options menu for the application. This menu is opened when Options softkey
+// is pressed.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_videotelui_menu
+    {
+    items =
+        {
+        MENU_ITEM // Enable
+            {
+            command = EVtUiCmdEnableMain;
+            txt = qtn_incal_enable_main_option;
+            cascade = r_videotelui_enable_menu;
+            },
+        MENU_ITEM // Disable
+            {
+            command = EVtUiCmdDisableMain;
+            txt = qtn_incal_disable_main_option;
+            cascade = r_videotelui_disable_menu;
+            },
+        MENU_ITEM // Use primary camera
+            {
+            command = EVtUiCmdUsePrimaryCamera;
+            txt = qtn_incal_camera_1_option;
+            },
+        MENU_ITEM // Use secondary camera
+            {
+            command = EVtUiCmdUseSecondaryCamera;
+            txt = qtn_incal_camera_2_option;
+            },
+        MENU_ITEM // Swap images places
+            {
+            command = EVtUiCmdSwapImagesPlaces;
+            txt = qtn_incal_swap_vt_images;
+            },
+        MENU_ITEM // Snapshot
+            {
+            command = EVtUiCmdSnapshot;
+            txt = qtn_incal_snapshot_option;
+            },
+        MENU_ITEM // Send DTMF
+            {
+            command = EVtUiCmdSendDTMF;
+            txt = qtn_incal_send_dtmf_tone_option;
+            },
+        MENU_ITEM // Share file
+            {
+            command = EVtUiCmdShareObjectImage;
+            txt = qtn_incal_video_call_share_file;
+            },
+        MENU_ITEM // Handset (deactivate loudspeaker)
+            {
+            command = EVtUiCmdDeactivateLoudspeaker;
+            txt = qtn_incal_deact_ihf_option;
+            },
+        MENU_ITEM // Loudspeaker
+            {
+            command = EVtUiCmdActivateLoudspeaker;
+            txt = qtn_incal_act_ihf_option;
+            },
+        MENU_ITEM // BT handsfree
+            {
+            command = EVtUiCmdActivateBT;
+            txt = qtn_incal_bt_handsfree_option;
+            },
+        MENU_ITEM // Handset (deactivate BT)
+            {
+            command = EVtUiCmdDeactivateBT;
+            txt = qtn_incal_handset_option;
+            },
+        MENU_ITEM // Video to voice
+            {
+            command = EVtUiCmdCreateVoice;
+            txt = qtn_incal_video_to_voice;
+            },
+        MENU_ITEM
+            {
+            command = EVtUiCmdAdjustVideo;
+            txt = qtn_incal_video_adjust_option;
+            cascade = r_videotelui_video_adjust_menu;
+            },
+        MENU_ITEM // Zoom
+            {
+            command = EVtUiCmdZoom;
+            txt = qtn_incal_zoom_own_video;
+            },
+        MENU_ITEM // End active call
+            {
+            command = EVtUiCmdEndActiveCall;
+            txt = qtn_incal_drop_option;
+            },
+        MENU_ITEM // Go to Idle
+            {
+            command = EVtUiCmdGoToIdle;
+#ifdef RD_BOOT_CUSTOMIZABLE_AI
+            txt = qtn_incal_goto_idle;
+#else
+            txt = qtn_incal_goto_active_idle;
+#endif // RD_BOOT_CUSTOMIZABLE_AI
+            },
+        MENU_ITEM // Help
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM // Exit
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_ok_menu
+// Options menu for the application. This menu is opened when selection key
+// is pressed.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_videotelui_ok_menu
+    {
+    items =
+        {
+        MENU_ITEM // Disable
+            {
+            command = EVtUiCmdDisableMain;
+            txt = qtn_incal_disable_main_option;
+            cascade = r_videotelui_disable_menu;
+            },
+        MENU_ITEM // Snapshot
+            {
+            command = EVtUiCmdSnapshot;
+            txt = qtn_incal_snapshot_option;
+            },
+        MENU_ITEM // End active call
+            {
+            command = EVtUiCmdEndActiveCall;
+            txt = qtn_incal_drop_option;
+            },
+        MENU_ITEM // Use primary camera
+            {
+            command = EVtUiCmdUsePrimaryCamera;
+            txt = qtn_incal_camera_1_option;
+            },
+        MENU_ITEM // Use secondary camera
+            {
+            command = EVtUiCmdUseSecondaryCamera;
+            txt = qtn_incal_camera_2_option;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_enable_menu
+// "Enable" submenu for the application.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_videotelui_enable_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EVtUiCmdEnableVideo;
+            txt = qtn_incal_change_video_option;
+            },
+        MENU_ITEM
+            {
+            command = EVtUiCmdEnableAudio;
+            txt = qtn_incal_change_audio_option;
+            },
+        MENU_ITEM
+            {
+            command = EVtUiCmdEnableBoth;
+            txt = qtn_incal_change_both_option;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_disable_menu
+// "Disable" submenu for the application.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_videotelui_disable_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EVtUiCmdDisableVideo;
+            txt = qtn_incal_change_video_option;
+            },
+        MENU_ITEM
+            {
+            command = EVtUiCmdDisableAudio;
+            txt = qtn_incal_change_audio_option;
+            },
+        MENU_ITEM
+            {
+            command = EVtUiCmdDisableBoth;
+            txt = qtn_incal_change_both_option;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_video_adjust_menu
+// "Adjust video" submenu for the application.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_videotelui_video_adjust_menu
+	{
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EVtUiCmdAdjustVideoVideoQuality;
+            txt = qtn_incal_video_prefer_option;
+            },
+        MENU_ITEM
+            {
+            command = EVtUiCmdAdjustVideoWhiteBalance;
+            txt = qtn_incal_video_white_balance_option;
+            },
+        MENU_ITEM
+            {
+            command = EVtUiCmdAdjustVideoBrightness;
+            txt = qtn_incal_video_brightness_option;
+            },
+        MENU_ITEM
+            {
+            command = EVtUiCmdAdjustVideoContrast;
+            txt = qtn_incal_video_contrast_option;
+            },
+        MENU_ITEM
+            {
+            command = EVtUiCmdAdjustVideoColourTone;
+            txt = qtn_incal_video_colour_tone_option;
+            }
+        };
+	}
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_enable_video
+// Options & Enable video softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_enable_video
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdEnableVideo;
+            txt = qtn_incal_softk_enable_video;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyContextOptions;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_enable_audio
+// Options & Enable audio softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_enable_audio
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdEnableAudio;
+            txt = qtn_incal_softk_enable_audio;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyContextOptions;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_handset_b
+// Options & Handset both softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_handset_b
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdDeactivateLoudspeaker;
+            txt = qtn_incal_softk_handset;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyContextOptions;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_loudspeaker
+// Options & Handset both softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_loudspeaker
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdActivateLoudspeaker;
+            txt = qtn_incal_softk_laudspek;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyContextOptions;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_bt_handsfree
+// Options & Handset both softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_bt_handsfree
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdActivateBT;
+            txt = qtn_incal_softk_bt_handsfree;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyContextOptions;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_end_call
+// Options & End call softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_end_call
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdEndActiveCall;
+            txt = qtn_incal_softk_end_this;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyContextOptions;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_capture_video
+// Capture & Cancel video softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_capture_video
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EVtUiCmdCapture;
+            txt = qtn_softk_capture;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdCancelCapture;
+            txt = text_softkey_cancel;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdCapture;
+            txt = qtn_softk_capture;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_share_object_image
+// Options & Stop image object sharing
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_share_object_image
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdStopSharingObjectImage;
+            txt = qtn_softk_disable_share;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyContextOptions;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_blank_dlg
+// Blank dialog.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_videotelui_blank_dlg
+    {
+    flags = ( EEikDialogFlagNoDrag |
+              EEikDialogFlagNoTitleBar |
+              EEikDialogFlagFillAppClientRect |
+              EEikDialogFlagCbaButtons |
+              EEikDialogFlagWait );
+
+    buttons = r_videotelui_softkeys_empty;
+
+    items =
+        {
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_blank_nowait_dlg
+// Blank dialog, no wait flag.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_videotelui_blank_nowait_dlg
+    {
+    flags = ( EEikDialogFlagNoDrag |
+              EEikDialogFlagNoTitleBar |
+              EEikDialogFlagFillAppClientRect |
+              EEikDialogFlagCbaButtons );
+
+    buttons = r_videotelui_softkeys_empty;
+
+    items =
+        {
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_empty
+//
+// Empty softkeys. Note that AVKON empty softkey
+// resource can not be used, because flags are needed.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_empty
+    {
+    flags = EAknCBAFlagRespondWhenInvisible;
+
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_qtn_incal_muted_pane
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_incal_muted_pane
+    {
+    buf = qtn_incal_muted_pane;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_allow_video_query
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_videotelui_allow_video_query
+    {
+    flags =
+        EEikDialogFlagNoDrag |
+        EEikDialogFlagNoTitleBar |
+        EEikDialogFlagCbaButtons |
+        EEikDialogFlagNotifyEsc ;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationLayout;
+                label = "";
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_switch_to_voice_query
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_videotelui_create_voice_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationLayout;
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------
+//
+// r_videotelui_qtn_send_video_image
+//
+// ---------------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_send_video_image
+    {
+    buf = qtn_incal_send_video_image;
+    }
+
+// ---------------------------------------------------------
+//
+// r_videotelui_qtn_call_number_video
+//
+// ---------------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_call_number_video
+    {
+    buf = qtn_call_number_video;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_videotelui_title_pane
+//    It defines default title pane.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TITLE_PANE r_videotelui_title_pane
+    {
+    txt = " ";
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_qtn_incal_waiting_image
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_incal_waiting_image
+    {
+    buf = qtn_incal_waiting_image;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_emergency_note
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_videotelui_emergency_note
+    {
+    flags = EEikDialogFlagNoDrag |
+            EEikDialogFlagNoTitleBar |
+            EEikDialogFlagCbaButtons;
+
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EGeneralLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_videotelui_information_note
+//    It defines note template for information notes. Text
+//    must be replaced to correct in code. Note does not have wait
+//    flag.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_videotelui_information_note
+    {
+    flags =
+        EEikDialogFlagNoDrag |
+        EEikDialogFlagNoTitleBar |
+        EEikDialogFlagCbaButtons;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control =
+                AVKON_NOTE
+                    {
+                    layout = EGeneralLayout;
+                    singular_label = " ";
+                    plural_label = "";
+                    animation = R_QGN_NOTE_INFO_ANIM;
+                    };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_qtn_incal_close_camcorder
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_incal_close_camcorder
+    {
+    buf = qtn_incal_close_camcorder;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_bthf_connect_wait_note
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_videotelui_bthf_connect_wait_note
+    {
+    flags = EEikDialogFlagNoDrag |
+            EEikDialogFlagNoTitleBar |
+            EEikDialogFlagCbaButtons |
+            EEikDialogFlagWait;
+
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                singular_label = qtn_wait_connecting_to_bt;
+                plural_label = "";
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_qtn_bt_device_not_avail
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_bt_device_not_avail
+    {
+    buf = qtn_bt_device_not_avail;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_text_not_allowed
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_text_not_allowed
+    {
+    buf = text_not_allowed;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_text_call_not_allowed
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_text_call_not_allowed
+    {
+    buf = text_call_not_allowed;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_qtn_err_cam_swap
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_err_cam_swap
+    {
+    buf = qtn_err_cam_swap;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_qtn_query_create_voice_call
+//
+//
+RESOURCE TBUF r_videotelui_qtn_query_create_voice_call
+    {
+    buf = qtn_query_create_voice_call;
+    }
+//----------------------------------------------------
+//
+//    r_videotelui_qtn_err_unable_to_open_image
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_err_unable_to_open_image
+    {
+    buf = qtn_tel_info_unable_open_image;
+    }
+
+//----------------------------------------------------
+//
+//    r_videotelui_qtn_incal_note_decoding_failed
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_incal_note_decoding_failed
+    {
+    buf = qtn_incal_note_decoding_failed;
+    }
+
+//----------------------------------------------------
+//
+//    r_videotelui_qtn_err_drm_not_allowed
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_err_drm_not_allowed
+    {
+    buf = qtn_drm_not_allowed;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_tooltip_zoom
+//
+//
+RESOURCE TBUF r_videotelui_tooltip_zoom
+    {
+    buf = qtn_vt_tooltip_zoom;
+    }
+
+//----------------------------------------------------
+//
+//    r_image_load_wait_note
+//    Image initialization wait note.
+//
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_progress_decoding_image_wait_note
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                singular_label = qtn_vt_progress_decoding_image;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_videotelui_context_options_cba_button
+//    Cba button resource for number entry.
+//
+//----------------------------------------------------
+//
+RESOURCE CBA_BUTTON r_videotelui_context_options_cba_button
+    {
+    id=EAknSoftkeyContextOptions;
+    txt=text_softkey_empty;
+    }
+
+//----------------------------------------------------
+//
+//    r_videotelui_select_cba_button
+//    Empty cba button resource for toolbar.
+//
+//----------------------------------------------------
+//
+RESOURCE CBA_BUTTON r_videotelui_select_cba_button
+    {
+    id = EAknSoftkeySelect;
+    txt= text_softkey_select;
+    }
+
+//----------------------------------------------------
+//
+//    r_videotelui_empty_cba_button
+//    Empty cba button resource for number entry.
+//
+//----------------------------------------------------
+//
+RESOURCE CBA_BUTTON r_videotelui_empty_cba_button
+    {
+    id = EAknSoftkeyEmpty;
+    txt= text_softkey_empty;
+    }
+
+//----------------------------------------------------
+//
+//    r_videotelui_floating_toolbar
+//    Empty resource for floating toolbar.
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_TOOLBAR r_videotelui_floating_toolbar
+    {
+    flags = KAknToolbarWithoutCba | KAknToolbarAlwaysFocusing |
+            KAknToolbarFlexiblePosition;
+    items =
+        {
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_videotelui_fixed_toolbar
+//    Empty resource for fixed toolbar.
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_TOOLBAR r_videotelui_fixed_toolbar
+    {
+    flags = KAknToolbarFixed;
+    items =
+        {
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_videotelui_video_record_start_sound_path
+//    Path to a sound file to play when starting video recording
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_video_record_start_sound_path
+    {
+    buf = KVtStartSoundFile;
+    }
+
+
+//----------------------------------------------------
+//
+//    r_videotelui_video_record_stop_sound_path
+//    Path to a sound file to play when stopping video recording
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_video_record_stop_sound_path
+    {
+    buf = KVtStopSoundFile;
+    }
+
+//----------------------------------------------------
+//
+//   r_disable_video_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_disable_video_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbVideoDisable;
+    //skinid = KAknsIIDQgnIndiTbVideoDisable;
+    }
+
+//----------------------------------------------------
+//
+//   r_enable_video_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_enable_video_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbVideo;
+    //skinid = KAknsIIDQgnIndiTbVideo;
+    }
+
+//----------------------------------------------------
+//
+//   r_mute_microphone_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mute_microphone_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbMicrophoneMute;
+    //skinid = KAknsIIDQgnIndiTbMicrophoneMute;
+    }
+
+//----------------------------------------------------
+//
+//   r_unmute_microphone_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_unmute_microphone_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbMicrophoneUnmute;
+    //skinid = KAknsIIDQgnIndiTbMicrophoneUnmute;
+    }
+
+//----------------------------------------------------
+//
+//   r_primary_cam_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_primary_cam_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbCameraMain ;
+    //skinid = KAknsIIDQgnIndiTbCameraMain;
+    }
+
+//----------------------------------------------------
+//
+//   r_secondary_cam_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_secondary_cam_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbCameraSecondary;
+    //skinid = KAknsIIDQgnIndiTbCameraSecondary;
+    }
+
+//----------------------------------------------------
+//
+//   r_zoom_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_zoom_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbZoom;
+    //skinid = KAknsIIDQgnIndiTbZoom;
+    }
+
+//----------------------------------------------------
+//
+//   r_share_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_swap_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbSwapImages;
+    //skinid = KAknsIIDQgnIndiTbSwapImages;
+    }
+
+//----------------------------------------------------
+//
+//   r_share_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_share_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbGallery;
+    //skinid = KAknsIIDQgnIndiTbGallery;
+    }
+
+//----------------------------------------------------
+//
+//   r_handset_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_handset_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbHandset;
+    //skinid = KAknsIIDQgnIndiTbHandset;
+    }
+
+//----------------------------------------------------
+//
+//   r_ihf_on_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_ihf_on_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbIhfOn;
+    //skinid = KAknsIIDQgnIndiTbIhfOn;
+    }
+
+//----------------------------------------------------
+//
+//   r_bt_hf_button_state_extension
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_bt_hf_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbBthf;
+    //skinid = KAknsIIDQgnIndiTbBthf;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_avkonbutton_toggle_video_button
+// This button disables and enables video.
+// This button has two states.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_avkonbutton_toggle_video_button
+    {
+    flags  = 0;
+    states =
+        {
+        AVKON_BUTTON_STATE  // disable video button (0)
+            {
+            bmpfile =  "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_video_disable;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_video_disable_mask;
+            helptxt = qtn_vt_tooltip_disable_video;
+            extension = r_disable_video_button_state_extension;
+            },
+        AVKON_BUTTON_STATE // disable video button (dummy state) (1)
+            {
+            bmpfile =  "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_video_disable;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_video_disable_mask;
+            extension = r_disable_video_button_state_extension;
+ 			  	  },
+        AVKON_BUTTON_STATE  // enable video button (2)
+            {
+            bmpfile =  "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_video;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_video_mask;
+            helptxt = qtn_vt_tooltip_enable_video;
+            extension = r_enable_video_button_state_extension;
+            },
+        AVKON_BUTTON_STATE // enable video button (dummy state) (3)
+            {
+            bmpfile =  "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_video;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_video_mask;
+            extension = r_enable_video_button_state_extension;
+ 			  	  }
+        };
+    }
+// -----------------------------------------------------------------------------
+//
+// r_avkonbutton_toggle_microphone_button
+// This button mutes and unmutes microphone.
+// This button has two states.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_avkonbutton_toggle_microphone_button
+    {
+    flags  = 0;
+    states =
+        {
+        AVKON_BUTTON_STATE  // mute mic button (0)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_microphone_mute;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_microphone_mute_mask;
+            helptxt = qtn_vt_tooltip_mute_microphone;
+            extension = r_mute_microphone_button_state_extension;
+            },
+        AVKON_BUTTON_STATE  // mute mic button (dummy state) (1)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_microphone_mute;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_microphone_mute_mask;
+            extension = r_mute_microphone_button_state_extension;
+            },
+        AVKON_BUTTON_STATE  // unmute mic button (2)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_microphone_unmute;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_microphone_unmute_mask;
+            helptxt = qtn_vt_tooltip_unmute_microphone;
+            extension = r_unmute_microphone_button_state_extension;
+            },
+        AVKON_BUTTON_STATE  // unmute mic button  (dummy state) (3)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_microphone_unmute;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_microphone_unmute_mask;
+            extension = r_unmute_microphone_button_state_extension;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_avkonbutton_toggle_camera_button
+// This button changes used camera between primary and secondary.
+// This button has two states.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_avkonbutton_toggle_camera_button
+    {
+    flags  = 0;
+    states =
+        {
+        AVKON_BUTTON_STATE  // primary camera button (0)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_camera_main;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_camera_main_mask;
+            helptxt = qtn_vt_tooltip_primary_cam;
+            extension = r_primary_cam_button_state_extension;
+            },
+        AVKON_BUTTON_STATE  // primary camera button (dummy state) (1)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_camera_main;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_camera_main_mask;
+            extension = r_primary_cam_button_state_extension;
+            },
+        AVKON_BUTTON_STATE  // secondary camera button (2)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_camera_secondary;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_camera_secondary_mask;
+            helptxt = qtn_vt_tooltip_secondary_cam;
+             extension = r_secondary_cam_button_state_extension;
+            },
+        AVKON_BUTTON_STATE  // secondary camera button (dummy state) (3)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_camera_secondary;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_camera_secondary_mask;
+            extension = r_secondary_cam_button_state_extension;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_avkonbutton_swap_images_button
+// This button swaps images
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_avkonbutton_swap_images_button
+    {
+    flags  = 0;
+    states =
+        {
+        AVKON_BUTTON_STATE
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_swap_images;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_swap_images_mask;
+            helptxt = qtn_vt_tooltip_swap_images;
+            extension = r_swap_button_state_extension;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_avkonbutton_activate_zoom_mode_button
+// This button activates zoom mode.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_avkonbutton_activate_zoom_mode_button
+    {
+    flags  = 0;
+    states =
+        {
+        AVKON_BUTTON_STATE
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_zoom;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_zoom_mask;
+            helptxt =  qtn_vt_tooltip_zoom;
+            extension = r_zoom_button_state_extension;
+            },
+         AVKON_BUTTON_STATE
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid  = EMbmVideoteluiQgn_indi_tb_zoom;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_zoom_mask;
+            flags = KAknButtonStateHasLatchedFrame;
+            helptxt = qtn_vt_tooltip_zoom;
+            extension = r_zoom_button_state_extension;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_avkonbutton_share_file_button
+// This button starts the file sharing.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_avkonbutton_share_file_button
+    {
+    flags  = 0;
+    states =
+        {
+        AVKON_BUTTON_STATE
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid  = EMbmVideoteluiQgn_indi_tb_gallery;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_gallery_mask;
+            helptxt = qtn_vt_tooltip_share;
+            extension = r_share_button_state_extension;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_avkonbutton_snapshot_button
+// This button sets capture mode on.
+//
+// -----------------------------------------------------------------------------
+//
+/* Not in use currently
+RESOURCE AVKON_BUTTON r_avkonbutton_snapshot_button
+    {
+    flags  = 0;
+    states =
+        {
+        AVKON_BUTTON_STATE
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid  =  EMbmVideoteluiQgn_indi_cams_tb_capture;
+            bmpmask = EMbmVideoteluiQgn_indi_cams_tb_capture_mask;
+            helptxt = qtn_vt_tooltip_send_snapshot;
+            //extension is also needed here
+            }
+        };
+    }
+*/
+
+
+// -----------------------------------------------------------------------------
+//
+// r_mini_dialer_editor
+// This is a resource for a hidden focused editor for minidialer (touch input).
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE SECRETED r_mini_dialer_editor
+    {
+    num_letters=255;
+    }
+
+//----------------------------------------------------
+//
+//    video preference options
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_videotelui_qtn_incal_normal_list_option
+    {
+    buf = qtn_incal_normal_list_option;
+    }
+
+RESOURCE TBUF r_videotelui_qtn_incal_details_list_option
+    {
+    buf = qtn_incal_details_list_option;
+    }
+
+RESOURCE TBUF r_videotelui_qtn_incal_motion_list_option
+    {
+    buf = qtn_incal_motion_list_option;
+    }
+
+//----------------------------------------------------
+//
+//    white balance options
+//
+//----------------------------------------------------
+RESOURCE TBUF r_videotelui_qtn_incal_automatic_option
+    {
+    buf = qtn_incal_automatic_option;
+    }
+
+RESOURCE TBUF r_videotelui_qtn_incal_sunny_option
+    {
+    buf = qtn_incal_sunny_option;
+    }
+
+RESOURCE TBUF r_videotelui_qtn_incal_cloudy_option
+    {
+    buf = qtn_incal_cloudy_option;
+    }
+
+RESOURCE TBUF r_videotelui_qtn_incal_incandescent_option
+    {
+    buf = qtn_incal_incandescent_option;
+    }
+
+RESOURCE TBUF r_videotelui_qtn_incal_fluorescent_option
+    {
+    buf = qtn_incal_fluorescent_option;
+    }
+
+//----------------------------------------------------
+//
+//    colour tone options
+//
+//----------------------------------------------------
+RESOURCE TBUF r_videotelui_qtn_incal_ct_normal_option
+    {
+    buf = qtn_incal_ct_normal_option;
+    }
+
+RESOURCE TBUF r_videotelui_qtn_incal_sepia_option
+    {
+    buf = qtn_incal_sepia_option;
+    }
+
+RESOURCE TBUF r_videotelui_qtn_incal_b_and_w_option
+    {
+    buf = qtn_incal_b_and_w_option;
+    }
+
+RESOURCE TBUF r_videotelui_qtn_incal_negative_option
+    {
+    buf = qtn_incal_negative_option;
+    }
+
+// ---------------------------------------------------------
+//		r_videotelui_white_balance_setting_page
+//		White balance item array for setting page
+//
+// ---------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_videotelui_white_balance_setting_page
+     {
+     label = qtn_incal_video_white_balance_option;
+     softkey_resource =  R_AVKON_SOFTKEYS_OK_CANCEL;
+     type = EAknSetListBox;
+     editor_resource_id = r_videotelui_transparent_setting_listbox;
+     }
+
+// ---------------------------------------------------------
+//		r_videotelui_color_tone_setting_page
+//		White balance item array for setting page
+//
+// ---------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_videotelui_color_tone_setting_page
+     {
+     label = qtn_incal_video_colour_tone_option;
+     softkey_resource =  R_AVKON_SOFTKEYS_OK_CANCEL;
+     type = EAknSetListBox;
+     editor_resource_id = r_videotelui_transparent_setting_listbox;
+     }
+
+//----------------------------------------------------
+//
+//    r_videotelui_transparent_setting_listbox
+//    Listbox for transparent setting page
+//
+//----------------------------------------------------
+//
+RESOURCE LISTBOX r_videotelui_transparent_setting_listbox
+     {
+     flags = 0x0001;
+     }
+
+// ---------------------------------------------------------
+//		r_videotelui_video_quality_array
+//		Item array for the selection list dialog
+//
+// ---------------------------------------------------------
+//
+RESOURCE ARRAY r_videotelui_video_quality_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_incal_normal_list_option;
+			},
+		LBUF
+			{
+			txt = qtn_incal_details_list_option;
+			},
+		LBUF
+			{
+			txt = qtn_incal_motion_list_option;
+			}
+		};
+	}
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_select_cancel
+// Videoquality softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_select_cancel
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeySelect;
+            txt= text_softkey_select;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;
+            txt = text_softkey_cancel;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeySelect;
+            txt= text_softkey_select;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_empty_dialerexit
+// Dialer softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_empty_dialerexit
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiDialerExit;
+            txt = text_softkey_back;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//r_videotelui_softkeys_empty_active_command
+// Dialer softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_empty_active_command
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyEmpty;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_avkonbutton_audio_routing_button
+// This button changes audio routing.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_avkonbutton_audio_routing_button
+    {
+    flags  = 0;
+    states =
+        {
+        AVKON_BUTTON_STATE // Deactivate loudspeaker (0)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_handset;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_handset_mask;
+            helptxt = qtn_vt_tooltip_audio_handset;
+            extension =  r_handset_button_state_extension;
+            },
+        AVKON_BUTTON_STATE // Deactivate loudspeaker (dummy state) (1)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_handset;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_handset_mask;
+            extension = r_handset_button_state_extension;
+            },
+        AVKON_BUTTON_STATE // Deactivate bthf == Activate loudspkr (2)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_ihf_on;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_ihf_on_mask;
+            helptxt = qtn_vt_tooltip_audio_loudspeaker;
+            extension = r_ihf_on_button_state_extension;
+            },
+        AVKON_BUTTON_STATE // Deactivate bthf (dummy state) (3)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_ihf_on;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_ihf_on_mask;
+            extension = r_ihf_on_button_state_extension;
+            },
+         AVKON_BUTTON_STATE // Activate loudspeaker (4)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid  = EMbmVideoteluiQgn_indi_tb_ihf_on;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_ihf_on_mask;
+            helptxt = qtn_vt_tooltip_audio_loudspeaker;
+            extension = r_ihf_on_button_state_extension;
+            },
+        AVKON_BUTTON_STATE // Activate loudspeaker (dummy state) (5)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_ihf_on;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_ihf_on_mask;
+            extension = r_ihf_on_button_state_extension;
+            },
+         AVKON_BUTTON_STATE // Activate bt hf (6)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid  = EMbmVideoteluiQgn_indi_tb_bthf;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_bthf_mask;
+            helptxt = qtn_vt_tooltip_audio_bthf;
+            extension = r_bt_hf_button_state_extension;
+            },
+        AVKON_BUTTON_STATE // Activate bt hf (dummy state) (7)
+            {
+            bmpfile = "Z:"APP_BITMAP_DIR"\\videotelui.mif";
+            bmpid = EMbmVideoteluiQgn_indi_tb_bthf;
+            bmpmask = EMbmVideoteluiQgn_indi_tb_bthf_mask;
+            extension = r_bt_hf_button_state_extension;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_videotelui_softkeys_dialer
+// Options & Dialer open softkeys
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_videotelui_softkeys_dialer
+    {
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EVtUiCmdSendDTMF;
+            txt = qtn_incal_softk_dialer;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyContextOptions;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/data/videotelui_caption.rss	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* 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:  Captions for Video Telephone application.
+*
+*/
+
+
+
+//  INCLUDES
+#include    <apcaptionfile.rh>
+#include    "videotelui.loc"
+
+//  RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+//   
+// CAPTION_DATA
+// Captions for Video Telephone application.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CAPTION_DATA
+    {
+    caption = qtn_apps_videophone_grid;
+    shortcaption = qtn_apps_videophone_grid;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/data/videotelui_reg.rss	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* 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:  Registration file for Video Telephone application.
+*
+*/
+
+
+#include <appinfo.rh>
+#include <videotelui.rsg>
+#include <data_caging_paths_strings.hrh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x101F8681 // application UID
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "videotelui";
+    hidden = KAppIsHidden;
+    localisable_resource_file = 
+        APP_RESOURCE_DIR"\\videotelui";
+    localisable_resource_id = R_VIDEOTELUI_LOCALISABLE_APP_INFO;
+    }
+
+// End of File
Binary file vtuis/videotelui/data/videotelui_stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/data/videotelui_stub.pkg	Mon Nov 23 14:47:47 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:
+;
+; Languages
+&EN
+
+; Header
+#{"videotelui"}, (0x101F8681), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\videotelui.exe"
+""-"z:\resource\apps\videotelui.rsc"
+""-"z:\resource\apps\videotelui_aif.mif"
+""-"z:\resource\apps\videotelui.mif"
+""-"z:\private\10003a3f\import\apps\videotelui_reg.rsc"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/group/bld.inf	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2004 - 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 for Video Telephone application.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/VideoTelephonyVariant.hrh        |../../../inc/videotelephonyvariant.hrh
+../inc/VideoTelephonyInternalCRKeys.h   |../../../inc/videotelephonyinternalcrkeys.h
+../data/videotelui_stub.SIS             /epoc32/data/z/system/install/videotelui_stub.sis
+
+// Export LOC file
+../loc/videotelui.loc                   APP_LAYER_LOC_EXPORT_PATH(videotelui.loc)
+
+// Export IBY files
+../rom/videotelui.iby                   CORE_APP_LAYER_IBY_EXPORT_PATH(videotelui.iby)
+../rom/videoteluiResources.iby          LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(videoteluiresources.iby)
+
+// Generic configuration interface for component cenrep settings  
+
+../conf/s60videotelephony.confml                        APP_LAYER_CONFML(s60videotelephony.confml)
+../conf/s60videotelephony_102072D0.crml 	        APP_LAYER_CRML(s60videotelephony_102072d0.crml)
+../conf/s60videotelephony_10281872.crml 	        APP_LAYER_CRML(s60videotelephony_10281872.crml)
+
+
+#if defined ( RD_VT_RTF )
+../Data/VtStartRecord.wav /epoc32/release/winscw/urel/z/system/sounds/digital/VtStartRecord.wav
+../Data/VtStartRecord.wav /epoc32/release/winscw/udeb/z/system/sounds/digital/VtStartRecord.wav
+../Data/VtStartRecord.wav /epoc32/release/armv5/urel/z/system/sounds/digital/VtStartRecord.wav
+../Data/VtStartRecord.wav /epoc32/release/armv5/udeb/z/system/sounds/digital/VtStartRecord.wav
+
+../Data/VtStopRecord.wav /epoc32/release/winscw/urel/z/system/sounds/digital/VtStopRecord.wav
+../Data/VtStopRecord.wav /epoc32/release/winscw/udeb/z/system/sounds/digital/VtStopRecord.wav
+../Data/VtStopRecord.wav /epoc32/release/armv5/urel/z/system/sounds/digital/VtStopRecord.wav
+../Data/VtStopRecord.wav /epoc32/release/armv5/udeb/z/system/sounds/digital/VtStopRecord.wav
+#endif //RD_VT_RTF
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+  OPTION TARGETFILE videotelui.mif
+  OPTION HEADERFILE videotelui.mbg
+  OPTION SOURCES \
+    -c8,8 qgn_graf_call_video_out_bg -c8 qgn_indi_call_video_blind_in -c8 qgn_indi_call_video_blind_out \
+    /1 qgn_graf_zoom_area -c8,1 qgn_indi_zoom_dir -c8 qgn_indi_zoom_min \
+    -c8 qgn_indi_zoom_max -8 qgn_indi_call_video_blind_in_mask_icon -8 qgn_indi_call_video_blind_out_mask_icon \
+    -c8,8 qgn_indi_tb_camera_main -c8,8 qgn_indi_tb_camera_secondary -c8,8 qgn_indi_tb_gallery \
+    -c8,8 qgn_indi_tb_microphone_mute -c8,8 qgn_indi_tb_microphone_unmute -c8,8 qgn_indi_tb_swap_images \
+    -c8,8 qgn_indi_tb_video -c8,8 qgn_indi_tb_video_disable -c8,8 qgn_indi_tb_zoom \
+    -c8,8 qgn_indi_cams_tb_capture -c8,8 qgn_indi_tb_ihf_on -c8,8 qgn_indi_tb_handset \
+    -c8,8 qgn_indi_tb_bthf  
+END
+
+START EXTENSION s60/mifconv
+  OPTION TARGETFILE videotelui_aif.mif
+  OPTION SOURCES -c8,8 qgn_menu_call_video
+END
+
+
+
+PRJ_MMPFILES
+/* 
+gnumakefile ../group/videotelui_icons_dc.mk
+#ifdef __SCALABLE_ICONS
+gnumakefile ../group/videotelui_icons_aif_scalable_dc.mk
+#else
+gnumakefile ../group/videotelui_icons_aif_bitmaps_dc.mk
+#endif
+*/
+../group/videotelui.mmp
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/group/videotelui.mmp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2004 - 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:  Project specification for Video Telephone application.
+*
+*/
+
+
+#include    <platform_paths.hrh>
+#include    <data_caging_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_APPLICATION MultiMediaDD NetworkControl CommDD
+
+// Assign Vendor ID.
+VENDORID VID_DEFAULT
+
+TARGET          videotelui.exe
+TARGETTYPE      exe
+EPOCSTACKSIZE   0x5000
+EPOCHEAPSIZE    0x190000 0x500000
+UID             0x100039CE 0x101F8681
+
+SOURCEPATH      ../src
+SOURCE          CVtUiApp.cpp
+SOURCE          CVtUiAppUi.cpp
+SOURCE          CVtUiDoc.cpp
+SOURCE          CVtUiMainControl.cpp
+SOURCE          CVtUiContextControl.cpp
+SOURCE          CVtUiNaviPane.cpp
+SOURCE          CVtUiNaviPaneControl.cpp
+SOURCE          VtUiLayout.cpp
+SOURCE          VtUiUtility.cpp
+SOURCE          VtUiPanic.cpp
+SOURCE          CVtUiBlankControl.cpp
+SOURCE          CVtUiBlankDialog.cpp
+SOURCE          CVtUiExecuteCmdDialog.cpp
+SOURCE          CVtUiMutedControl.cpp
+SOURCE          CVtUiZoomControl.cpp
+SOURCE          CVtUiAllowVideoDialog.cpp
+SOURCE          CVtUiActiveExec.cpp
+SOURCE          CVtUiActivateBtHfDialog.cpp
+SOURCE          TVtUiCallParameters.cpp
+SOURCE          CVtUiNumberEntryActivationControl.cpp
+SOURCE          CVtUiBitmapManager.cpp
+
+SOURCE          tvtuiappstatebase.cpp
+SOURCE          tvtuistatestarting.cpp
+SOURCE          tvtuistaterunning.cpp
+SOURCE          tvtuistateresetting.cpp
+SOURCE          cvtuiappshutter.cpp
+SOURCE          cvtuivideocontrolbase.cpp
+SOURCE          cvtuidtmfbuffer.cpp
+SOURCE          CVtUiRemoteVideoControl.cpp
+
+// COMMAND FW
+SOURCEPATH      ../src/commands
+SOURCE          cvtuicmdbase.cpp
+SOURCE          cvtuifeaturecmdbase.cpp
+SOURCE          cvtuicmdcontext.cpp
+SOURCE          cvtuicmdvalidationactionbase.cpp
+SOURCE          cvtuicmdvalidatorbase.cpp
+SOURCE          cvtuicommandpolicymanager.cpp
+SOURCE          cvtuiprimarycmdpolicy.cpp
+SOURCE          cvtuicommandmanager.cpp
+SOURCE          tvtuimediastate.cpp
+SOURCE          tvtuiaudiostate.cpp
+SOURCE          tvtuilocalvariation.cpp
+SOURCE          tvtuistates.cpp
+SOURCE          cvtuicommandmodifybase.cpp
+SOURCE          cvtuicmdcustomvalidationactionbase.cpp
+SOURCE          cvtuicmdstatecheckaction.cpp
+SOURCE          cvtuiexecutioncontext.cpp
+SOURCE			tVtuifeaturevariation.cpp
+
+// FEATURE FW
+SOURCEPATH      ../src/features
+SOURCE          cvtuifeaturebase.cpp
+SOURCE          cvtuifeaturemanager.cpp
+
+SOURCEPATH      ../src/features/toolbar
+SOURCE          cvtuitoolbarbase.cpp
+SOURCE          cvtuitoolbarcontext.cpp
+SOURCE          cvtuihidetoolbaritemaction.cpp
+SOURCE 	        tvtuitoolbarcommanditerator.cpp
+SOURCE          cvtuitoolbarskmodifier.cpp
+SOURCE          cvtuitoolbarbutton.cpp
+SOURCE          cvtuitoolbarcmdpolicy.cpp
+SOURCE          cvtuifloatingtoolbar.cpp
+SOURCE          cvtuifixedtoolbar.cpp
+
+
+SOURCEPATH      ../src/features/menu
+SOURCE          cvtuimenus.cpp
+SOURCE          cvtuimenucontext.cpp
+SOURCE          cvtuimenuitemdimmeraction.cpp
+SOURCE          tvtuimenucommanditerator.cpp
+
+SOURCEPATH      ../src/features/softkey
+SOURCE          cvtuisoftkeys.cpp
+SOURCE          cvtuisoftkeycontext.cpp
+SOURCE          cvtuisoftkeyvalidationaction.cpp
+SOURCE          cvtuisoftkeysetting.cpp
+
+
+SOURCEPATH      ../src/features/numberentry
+SOURCE          cvtuinumberentry.cpp
+SOURCE          CVtUiNumberEntryControl.cpp
+
+SOURCEPATH      ../src/features/prefs
+SOURCE          cvtuitransparentsettingpage.cpp
+SOURCE          cvtuiprefsettinglistbase.cpp
+SOURCE          cvtuiwhitebalance.cpp
+SOURCE          cvtuicolortone.cpp
+SOURCE          cvtuivideoquality.cpp
+SOURCE          cvtuiprefpopupbase.cpp
+SOURCE          cvtuiprefsliderbase.cpp
+SOURCE          cvtuibrightness.cpp
+SOURCE          cvtuibrightnesspopup.cpp
+SOURCE          cvtuicontrast.cpp
+SOURCE          cvtuicontrastpopup.cpp
+
+SOURCEPATH      ../src/features/dialer
+SOURCE          cvtuidialer.cpp
+SOURCE          cvtuidialervideocontrol.cpp
+SOURCE          cvtuidialercontainer.cpp
+SOURCE          cvtuicmdopendialer.cpp
+SOURCE          cvtuicmdclosedialer.cpp
+SOURCE          cvtuidialerskmodifier.cpp
+
+// COMPONENT MANAGER FW
+SOURCEPATH      ../src/compman
+SOURCE          cvtuicomponentmanager.cpp
+SOURCE          tvtuicomponentstate.cpp
+SOURCE          tvtuiblocklists.cpp
+
+// SLIDERS
+SOURCEPATH      ../src/sliders
+SOURCE          cvtuipopupbase.cpp
+SOURCE          cvtuisliderbase.cpp
+
+// VOLUME SLIDER
+SOURCEPATH      ../src/features/volume
+SOURCE          cvtuivolume.cpp
+SOURCE          cvtuivolumepopup.cpp
+SOURCE          cvtuivolumecontrol.cpp
+
+// ZOOM SLIDER
+SOURCEPATH      ../src/features/zoom
+SOURCE          cvtuizoom.cpp
+SOURCE          cvtuizoompopup.cpp
+
+SOURCEPATH      ../data
+
+START RESOURCE  videotelui.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS
+END
+
+START RESOURCE  videotelui_reg.rss
+DEPENDS videotelui.rsg
+TARGETPATH      /private/10003a3f/apps
+END
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../inc/commands
+USERINCLUDE     ../inc/features
+USERINCLUDE     ../inc/compman
+USERINCLUDE     ../inc/features/softkey
+USERINCLUDE     ../inc/features/menu
+USERINCLUDE     ../inc/features/toolbar
+USERINCLUDE     ../inc/features/numberentry
+USERINCLUDE     ../inc/features/prefs
+USERINCLUDE     ../inc/features/dialer
+USERINCLUDE     ../inc/features/volume
+USERINCLUDE     ../inc/features/zoom
+USERINCLUDE     ../inc/sliders
+USERINCLUDE     ../loc
+
+SYSTEMINCLUDE   ../../../inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib
+LIBRARY         ws32.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         apgrfx.lib
+LIBRARY         fbscli.lib
+LIBRARY         eikdlg.lib
+LIBRARY         gdi.lib
+LIBRARY         bitgdi.lib
+LIBRARY         egul.lib
+LIBRARY		    ecom.lib
+
+LIBRARY         aknlayout.lib
+LIBRARY         aknlayout2.lib
+LIBRARY         avkon.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknnotify.lib
+
+LIBRARY         hlplch.lib
+LIBRARY         featmgr.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+
+
+LIBRARY         videoteleng.lib
+DEBUGLIBRARY    vtlogger.lib
+
+LIBRARY         phoneclient.lib
+
+LIBRARY         cdlengine.lib
+LIBRARY         aknicon.lib
+LIBRARY         aknlayout2scalable.lib
+
+LIBRARY         mgfetch.lib
+LIBRARY         bafl.lib
+LIBRARY         caf.lib
+LIBRARY         cafutils.lib
+LIBRARY         eikctl.lib
+LIBRARY         fepbase.lib
+
+LIBRARY         remconinterfacebase.lib
+LIBRARY         remconcoreapi.lib
+
+LIBRARY         dialer.lib
+
+LIBRARY         gfxtrans.lib
+
+SOURCEPATH      ../loc
+DOCUMENT        videotelui.loc
+
+SOURCEPATH      ../inc
+DOCUMENT        videotelui.hrh
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/group/videotelui_icons.mk	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,89 @@
+#
+# 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:  Makefile to generate icon file for Video
+#               Telephone application.
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\system\apps\videotelui
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\videotelui.mif
+HEADERFILENAME=$(HEADERDIR)\videotelui.mbg
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+        /c8,8 qgn_graf_call_video_out_bg.bmp \
+        /c8 qgn_indi_call_video_blind_in.bmp \
+        /c8 qgn_indi_call_video_blind_out.bmp \
+        /1 qgn_graf_zoom_area.bmp \
+        /c8,1 qgn_indi_zoom_dir.bmp \
+        /c8 qgn_indi_zoom_min.bmp \
+        /c8 qgn_indi_zoom_max.bmp \
+        /8 qgn_indi_call_video_blind_in_mask_icon.bmp \
+        /8 qgn_indi_call_video_blind_out_mask_icon.bmp \
+        /c8 qgn_indi_tb_camera_main.bmp \
+        /c8 qgn_indi_tb_camera_secondary.bmp \
+        /c8 qgn_indi_tb_gallery.bmp \
+        /c8 qgn_indi_tb_microphone_mute.bmp \
+        /c8 qgn_indi_tb_microphone_unmute.bmp \
+        /c8 qgn_indi_tb_swap_images.bmp \
+        /c8 qgn_indi_tb_video.bmp \
+        /c8 qgn_indi_tb_video_disable.bmp \
+        /c8 qgn_indi_tb_zoom.bmp \
+        /c8 qgn_indi_cams_tb_capture.bmp \
+        /c8 qgn_indi_tb_ihf_on.bmp \
+       /c8 qgn_indi_tb_handset.bmp \
+       /c8 qgn_indi_tb_bthf.bmp
+
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+    @echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
+
+# End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/group/videotelui_icons_aif_bitmaps.mk	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2004-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:  Makefile to generate AIF icons for bitmap version.
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\system\apps\videotelui
+ICONTARGETFILENAME=$(TARGETDIR)\videotelui_aif.mbm
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) \
+        /c8,8 qgn_menu_call_video_lst.bmp
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/group/videotelui_icons_aif_bitmaps_dc.mk	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2004-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:  Makefile to generate AIF icons for bitmap version.
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\videotelui_aif.mbm
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) \
+        /c8,8 qgn_menu_call_video_lst.bmp
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/group/videotelui_icons_aif_scalable.mk	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2004-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:  Makefile to generate AIF icons for scalable version.
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\system\apps\videotelui
+ICONTARGETFILENAME=$(TARGETDIR)\videotelui_aif.mif
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) \
+        /c8,8 qgn_menu_call_video.svg
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/group/videotelui_icons_aif_scalable_dc.mk	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2004-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:  Makefile to generate AIF icons for scalable version.
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\videotelui_aif.mif
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) \
+        /c8,8 qgn_menu_call_video.svg
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/group/videotelui_icons_dc.mk	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,88 @@
+#
+# Copyright (c) 2004-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:  Makefile to generate icon file for Video
+#               Telephone application.
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\videotelui.mif
+HEADERFILENAME=$(HEADERDIR)\videotelui.mbg
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+        /c8,8 qgn_graf_call_video_out_bg.bmp \
+        /c8 qgn_indi_call_video_blind_in.bmp \
+        /c8 qgn_indi_call_video_blind_out.bmp \
+        /1 qgn_graf_zoom_area.bmp \
+        /c8,1 qgn_indi_zoom_dir.bmp \
+        /c8 qgn_indi_zoom_min.bmp \
+        /c8 qgn_indi_zoom_max.bmp \
+        /8 qgn_indi_call_video_blind_in_mask_icon.bmp \
+        /8 qgn_indi_call_video_blind_out_mask_icon.bmp \
+        /c8,8 qgn_indi_tb_camera_main.bmp \
+        /c8,8 qgn_indi_tb_camera_secondary.bmp \
+        /c8,8 qgn_indi_tb_gallery.bmp \
+        /c8,8 qgn_indi_tb_microphone_mute.bmp \
+        /c8,8 qgn_indi_tb_microphone_unmute.bmp \
+        /c8,8 qgn_indi_tb_swap_images.bmp \
+        /c8,8 qgn_indi_tb_video.bmp \
+        /c8,8 qgn_indi_tb_video_disable.bmp \
+        /c8,8 qgn_indi_tb_zoom.bmp \
+        /c8,8 qgn_indi_cams_tb_capture.bmp \
+        /c8,8 qgn_indi_tb_ihf_on.bmp \
+        /c8,8 qgn_indi_tb_handset.bmp \
+        /c8,8 qgn_indi_tb_bthf.bmp
+
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+    @echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
+
+# End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiActivateBtHfDialog.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,108 @@
+/*
+* 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:  Bluetooth HF activation dialog for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIACTIVATEBTHFDIALOG_H
+#define CVTUIACTIVATEBTHFDIALOG_H
+
+//  INCLUDES
+#include    <aknwaitdialog.h>
+#include    <mvtengcommandobserver.h>
+#include    <mvtengaudio.h>
+
+// FORWARD DECLARATIONS
+class MVtEngCommandHandler;
+class MVtUiEngineCommandManager;
+
+// CLASS DECLARATION
+
+/**
+*  Bluetooth HF activation dialog for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiActivateBtHfDialog
+    : public CAknWaitDialog,
+      private MVtEngCommandObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        *
+        * @param aSelfPtr optional pointer to itself.
+        * @param aError optional pointer to error code variable.
+        * @param aCommandHandler command handler.
+        * @param aCommandManager command manager.
+        */
+        CVtUiActivateBtHfDialog(
+            CEikDialog** aSelfPtr,
+            TInt* aError,
+            MVtEngCommandHandler& aCommandHandler,
+            MVtUiEngineCommandManager& aCommandManager );
+
+        /**
+        * Destructor.
+        */
+        ~CVtUiActivateBtHfDialog();
+
+    public: // New functions
+
+        /**
+        * Executes bluetooth activation dialog.
+        */
+        void ExecuteDialogLD();
+
+    protected: // Functions from base classes
+
+        /**
+        * @see CEikDialog::PostLayoutDynInitL.
+        */
+        virtual void PostLayoutDynInitL();
+
+    private:
+
+        /**
+        * @see MVtEngCommandObserver::HandleVTCommandPerformedL.
+        */
+        virtual void HandleVTCommandPerformedL(
+            TVtEngCommandId aCommand,
+            const TInt aError );
+
+    private:
+
+        // Reference to command handler.
+        MVtEngCommandHandler& iCommandHandler;
+
+        // Reference to command manager.
+        MVtUiEngineCommandManager& iCommandManager;
+
+        // ETrue if command is performed.
+        TBool iCommandPerformed;
+
+        // Pointer to error code variable.
+        TInt* iError;
+
+        // Audio routing setting.
+        TPckgBuf< MVtEngAudio::TVtEngRoutingSetting > iAudioRouting;
+
+    };
+
+#endif      // CVTUIACTIVATEBTHFDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiActiveExec.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* 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:  Asynchronous execution class for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIACTIVEEXEC_H
+#define CVTUIACTIVEEXEC_H
+
+//  INCLUDES
+#include    <e32base.h>
+
+// FORWARD DECLARATIONS
+class CVtUiActiveExec;
+
+// CLASS DECLARATION
+
+/**
+*  Interface for asynchronous execution.
+*
+*  @since Series 60 2.6
+*/
+class MVtUiActiveExec
+    {
+    public: // New functions
+
+        /**
+        * Starts execution of a command.
+        * @param aActiveExec active executor.
+        * @param aState state based on which execution can be started.
+        * @param aNextState next state.
+        * @param aRequest request status, which should be used if operation is 
+        *        asynchronous.
+        * @return ETrue if operation was synchronous, otherwise EFalse.
+        */
+        virtual TBool ActiveExecExecuteL( 
+            CVtUiActiveExec& aActiveExec,
+            const TInt aState, 
+            TInt& aNextState,
+            TRequestStatus& aRequest ) = 0; 
+
+        /**
+        * Decide whether to continue or not.
+        * @param aActiveExec active executor.
+        * @param aState current state, should be updated to new state.
+        * @param aError error code.
+        * @return ETrue if continued, EFalse if stopped.
+        */
+        virtual TBool ActiveExecContinue(
+            CVtUiActiveExec& aActiveExec,
+            TInt& aState, 
+            const TInt aError ) = 0;
+
+        /**
+        * Cancels operation of specific state.
+        * @param aActiveExec active executor.
+        * @param aState state.
+        */
+        virtual void ActiveExecCancel( 
+            CVtUiActiveExec& aActiveExec,
+            const TInt aState ) = 0;
+
+        /**
+        * Informs that operation has been finished.
+        * @param aActiveExec active executor.
+        * @param aInitialState initial state.
+        */
+        virtual void ActiveExecDone( 
+            CVtUiActiveExec& aActiveExec,
+            const TInt aInitialState ) = 0;
+
+    };
+
+/**
+*  Asynchronous execution class for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiActiveExec 
+    : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param aPriority priority of the active object.
+        */
+        CVtUiActiveExec(
+            const TInt aPriority );
+
+        /**
+        * Destructor.
+        */
+        ~CVtUiActiveExec();
+
+    public: // New functions
+
+        /**
+        * Starts execution.
+        * @param aStartState initial state.
+        * @param aExec executor.
+        */
+        void Start( 
+            TInt aStartState, 
+            MVtUiActiveExec& aExec );
+
+        /**
+        * Initial state of currently
+        * active operation.
+        *
+        * @return initial state, or KErrNotFound if no operation ongoing.
+        */
+        TInt InitialState() const;
+
+        /**
+        * Returns request status.
+        * @return request status.
+        */
+        TInt RequestStatus() const;
+
+    public: // Functions from base classes
+
+        /**
+        * @see CActive::RunL.
+        */
+        virtual void RunL();
+
+        /**
+        * @see CActive::DoCancel.
+        */
+        virtual void DoCancel();
+
+        /**
+        * @see CActive::RunError.
+        */
+        virtual TInt RunError( TInt aError );
+
+    private:
+
+        // Ref to active executor.
+        MVtUiActiveExec* iActiveExec;
+
+        // Initial state.
+        TInt iInitialState;
+
+        // Current state.
+        TInt iCurrentState;
+
+        // Next state.
+        TInt iNextState;
+
+    };
+
+#endif // CVTUIACTIVEEXEC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiAllowVideoDialog.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* 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:  'Allow video image' query for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIALLOWVIDEODIALOG_H
+#define CVTUIALLOWVIDEODIALOG_H
+
+//  INCLUDES
+#include    <aknquerydialog.h>
+
+// CLASS DECLARATION
+
+/**
+*  'Allow video image' query for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiAllowVideoDialog
+    : public CAknQueryDialog
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Constructor.
+        *
+        * @param aSelfPtr optional pointer to itself.
+        * @param aTone tone to be played.
+        */
+        CVtUiAllowVideoDialog( 
+            CEikDialog** aSelfPtr,
+            const TTone& aTone );
+
+        /**
+        * Destructor.
+        */
+        ~CVtUiAllowVideoDialog();
+
+    public: // New functions
+
+        /**
+        * Enumerates different results which
+        * can be completed to request status.
+        */
+        enum TResult
+            {
+            // Query was canceled.
+            EQueryCanceled = 1,
+            // Query was dismissed due to timeout.
+            EQueryDismissedTimeout,
+            // User denied video sending.
+            EUserDenied,
+            // User allowed video sending.
+            EUserAllowed
+            };
+
+        /**
+        * Runs dialog.
+        * @param aStatus request status.
+        */
+        void ExecuteDialogLD(
+            TRequestStatus& aStatus );
+
+    protected: // Functions from base classes
+       
+        /**
+        * @see CAknQueryDialog::PostLayoutDynInitL.
+        */
+        virtual void PostLayoutDynInitL();
+
+        /**
+        * @see CAknQueryDialog::OkToExitL.
+        */
+        virtual TBool OkToExitL( TInt aCommand );
+
+    private:
+
+        /**
+        * Callback function. Called when this query
+        * is dismissed.
+        * @param aAny pointer to instance of this class.
+        * @return KErrNone.
+        */
+        static TInt DoDismissDialogTimeoutL( TAny* aAny );
+
+    private:
+
+        // Pointer to pointer to this instance.
+        CEikDialog** iSelfPtr;
+
+        // Timer for dismissing the query after timeout.
+        CPeriodic* iQueryTimer;
+
+        // Request status.
+        TRequestStatus* iRequestStatus;
+
+    };
+
+#endif      // CVTUIALLOWVIDEODIALOG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiApp.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* 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:  Application class for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIAPP_H
+#define CVTUIAPP_H
+
+//  INCLUDES
+#include    <aknapp.h>
+
+// CLASS DECLARATION
+
+/**
+*  Application class for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiApp 
+    : public CAknApplication
+    {
+    public: // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CVtUiApp();
+
+    public: // Functions from base classes
+
+        /**
+        * From CAknApplication, creates document instance.
+        * @return document instance.
+        */
+        virtual CApaDocument* CreateDocumentL();
+
+        /**
+        * From CAknApplication, returns UID of the application.
+        * @return UID of the application.
+        */
+        virtual TUid AppDllUid() const;
+
+    };
+
+#endif      // CVTUIAPP_H  
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiAppUi.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1469 @@
+/*
+* 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:  Application UI class for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIAPPUI_H
+#define CVTUIAPPUI_H
+
+//  INCLUDES
+#include    <aknappui.h>
+#include    <vtengcommands.h>
+#include    <mvtengmedia.h>
+#include    <tvtengrendering.h>
+#include    <tvtengrenderingdsa.h>
+#include    <tvtengrenderingdp.h>
+#include    <tvtengrenderingnga.h>
+#include    <aknprogressdialog.h>
+#include    <mvtengaudio.h>
+#include    <remconcoreapi.h>
+
+#include    "CVtUiActiveExec.h"
+#include    "tvtuilocalvariation.h"
+#include    "tvtuiappstatebase.h"
+
+
+// FORWARD DECLARATION
+class CVtUiBlankControl;
+class CAknNavigationControlContainer;
+class CAknTitlePane;
+class CVtEngModel;
+class MVtUiVideoWindow;
+class CRepository;
+class CAknQueryDialog;
+class CAknProgressDialog;
+class TVtUiStates;
+class CVtUiCommandManager;
+class CVtUiComponentManager;
+class CVtUiFeatureManager; // TOOLBAR MOD
+class MVtUiNumberSource;
+class CVtUiMainControl;
+class CVtUiContextControl;
+class CVtUiBitmapManager;
+class CVtUiVolumeControl;
+class CAknIncallBubble;
+class CVtUiRemoteVideoControl;
+
+// CLASS DECLARATION
+
+/**
+*  Application UI class for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiAppUi
+    : public CAknAppUi,
+      protected MVtUiActiveExec,
+      public MVtUiStateContext,
+      public MProgressDialogCallback
+    {
+    public:
+
+        // Rendering modes
+        enum TRenderingMode
+            {
+            ERenderingModeDefault,
+            ERenderingModeDialer
+            };
+
+    public: // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        */
+        CVtUiAppUi();
+
+        /**
+        * Symbian constructor.
+        */
+        void ConstructL();
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiAppUi();
+
+    public: // New functions
+
+        /*
+        *  This function decides possibility of swapimg image places.
+        */
+        TBool CanSwapImagePlaces();
+
+        /*
+        * Switches status pane between flat and normal one.
+        */
+        void SwitchLayoutToFlatStatusPaneL( TBool aSwitch );
+
+        /**
+        * Refreshes all.
+        */
+        void RefreshL();
+
+        /**
+        * Refreshes navi pane.
+        */
+        void RefreshNaviPaneL();
+
+        /**
+        * Refreshes softkeys.
+        */
+        void RefreshSoftkeysL();
+        
+        /**
+        * Refreshes menu.
+        */
+        void RefreshMenuL();
+
+        /**
+        * Refresh zoom popup
+        */
+        void RefreshZoomPopupL();
+        
+        /**
+        * Stop brightness or Contrast
+        */        
+        void StopBrightnessOrContrast();
+        /**
+        * Refreshes blind flags.
+        */
+        void RefreshBlind();
+
+        /**
+        * Refreshes synchronisation.
+        */
+        void RefreshSynchronise();
+
+        /**
+        * Opens number entry.
+        * @return ETrue if number entry opened.
+        */
+        TBool OpenNumberEntryL();
+
+        /**
+        * Handles EKeyPhoneSend presses
+        */
+        TKeyResponse HandlePhoneSendKeyL( const TKeyEvent& aKeyEvent,
+            TEventCode aType );
+
+        /**
+        * Returns pointer to cba.
+        */
+        CEikButtonGroupContainer* GetCba();
+
+        /**
+        * Sets zoom mode.
+        * @param aEnableZoomMode Etrue if zoom mode is on.
+        * EFalse otherwise.
+        * @param aIsPermanent ETrue if zoomindicator's timeout
+        * should be ignored. EFalse otherwise..
+        */
+        void SetZoomModeL( const TBool aEnableZoomMode,
+            const TBool aIsPermanent = EFalse );
+
+        /**
+        * Checks if command is active.
+        * @param aCommand Command id.
+        * @return Etrue if command is active
+        * EFalse otherwise.
+        */
+        TBool IsActiveCommand( TInt aCommand ) const;
+
+        TVtUiAppStateBase& State();
+
+        /**
+        * Returns reference to bitmap manager.
+        */
+        CVtUiBitmapManager& BitmapManager();
+
+        /**
+        * Sets given zoom step, if it allowed.
+        * @param aZoomStep New zoom step to be set.
+        */
+        void SetZoomFactorL( TInt aZoomStep );
+
+    public: // Functions from base classes
+
+        /**
+        * From CAknAppUi, handles window server events.
+        * @param aEvent event.
+        * @param aDestination destination control.
+        */
+        virtual void HandleWsEventL(
+            const TWsEvent& aEvent,
+            CCoeControl* aDestination );
+
+        /**
+        * From CAknAppUi, processes commands.
+        * @param aCommand the identifier of the command to be handled.
+        */
+        virtual void ProcessCommandL(
+            TInt aCommand );
+
+        /**
+        * From CAknAppUi, handles commands.
+        * @param aCommand the identifier of the command to be handled.
+        */
+        virtual void HandleCommandL(
+            TInt aCommand );
+
+        /**
+        * From CAknAppUi, handles dynamic initialisation of menu panes.
+        * @param aResourceId the resource identifier for the pane.
+        * @param aMenuPane the menu pane corresponding to the resource.
+        */
+        virtual void DynInitMenuPaneL(
+            TInt aResourceId,
+            CEikMenuPane* aMenuPane );
+
+        /**
+        * From CAknAppUi, handles key events.
+        * @param aKeyEvent event to be handled.
+        * @param aType type of the key event.
+        * @return response code (EKeyWasConsumed, EKeyWasNotConsumed)
+        */
+        virtual TKeyResponse HandleKeyEventL(
+            const TKeyEvent& aKeyEvent,
+            TEventCode aType );
+
+        /**
+        * From CAknAppUi, handles resouce changes.
+        * @param aType type of resource change.
+        */
+        virtual void HandleResourceChangeL( TInt aType );
+
+        /**
+        * From CAknAppUi, handles foreground status changes.
+        * @param aForeground ETrue if foreground.
+        */
+        virtual void HandleForegroundEventL( TBool aForeground );
+
+        /**
+        * Returns a pointer to CEikonEnv.
+        */
+        CEikonEnv* GetEikonEnv();
+
+    protected: // Functions from base classes
+
+        /**
+        * From CAknAppUi, returns help context.
+        * @return help context.
+        */
+        virtual CArrayFix<TCoeHelpContext>* HelpContextL() const;
+
+        /**
+        * @see MVtUiActiveExec::ActiveExecExecuteL.
+        */
+        virtual TBool ActiveExecExecuteL(
+            CVtUiActiveExec& aActiveExec,
+            const TInt aState,
+            TInt& aNextState,
+            TRequestStatus& aRequest );
+
+        /**
+        * @see MVtUiActiveExec::ActiveExecContinue.
+        */
+        virtual TBool ActiveExecContinue(
+            CVtUiActiveExec& aActiveExec,
+            TInt& aState,
+            const TInt aError );
+
+        /**
+        * @see MVtUiActiveExec::ActiveExecCancel.
+        */
+        virtual void ActiveExecCancel(
+            CVtUiActiveExec& aActiveExec,
+            const TInt aState );
+
+        /**
+        * @see MVtUiActiveExec::ActiveExecDone.
+        */
+        virtual void ActiveExecDone(
+            CVtUiActiveExec& aActiveExec,
+            const TInt aInitialState );
+
+    public: // from MVtUiStateContext
+
+        /** @see MVtUiStateContext::StartupPhase1L */
+        virtual void StartupPhase1L();
+
+        /** @see MVtUiStateContext::ShutdownL */
+        virtual void ShutdownL();
+
+        /** @see MVtUiStateContext::StartupPhase2L */
+        virtual void StartupPhase2L();
+
+        /** @see MVtUiStateContext::ChangeApplicationFocus */
+        virtual void ChangeApplicationFocus( const TBool aForeground );
+
+        /** @see MVtUiStateContext::ChangeState */
+        virtual void ChangeState( TVtUiAppStateBase* aState );
+
+        /** @see MVtUiStateContext::StartTone */
+        virtual void StartDtmfTone( const TChar& aTone );
+
+        /** @see MVtUiStateContext::StopTone */
+        virtual void StopDtmfTone();
+
+        /** @see MVtUiStateContext::Model */
+        virtual CVtEngModel& Model();
+
+        /** @see MVtUiStateContext::VideoTelephonyVariation */
+        virtual const TVtUiVideoTelephonyVariation&
+            VideoTelephonyVariation() const;
+
+        /** @see MVtUiStateContext::NumberSource*/
+        virtual MVtUiNumberSource* NumberSource() const;
+
+        /** @see MVtUiStateContext::RefreshL */
+        virtual void RefreshL( const TInt aRefreshFlags );
+
+        /** @see MVtUiStateContext::DoExecuteCmdL */
+        virtual void DoExecuteCmdL(
+            const TVtEngCommandId aCommand,
+            TDesC8* aParams );
+
+        /** @see MVtUiStateContext::DoHandleLayoutChangedL */
+        virtual void DoHandleLayoutChangedL();
+
+        /** From MVtUiShutterObserver via MVtUiStateContext
+        *  Exits the application.
+        */
+        virtual void HandleShutdownReady();
+
+        /**
+        * Gets reference to context control.
+        * @return reference to context control.
+        */
+        CVtUiContextControl& ContextControl();
+
+        /**
+        * Gets reference to main control.
+        * @return reference to main control.
+        */
+        CVtUiMainControl& MainControl();
+
+        /**
+        * Gets reference to remote video control.
+        * @return reference to remote video control.
+        */        
+        CVtUiRemoteVideoControl& RemoteVideoControl();
+
+        /**
+        * Switches viewfinder to main pane if it is currently in context
+        * pane.
+        */
+        void SwitchViewFinderToMainPaneL( TBool aUpdateState = ETrue );
+
+        /**
+        * Switches viewfinder to context pane if it is currently in main
+        * pane.
+        */
+        void SwitchViewFinderToContextPaneL( TBool aUpdateState = ETrue );
+
+        /**
+        * Restores viewfinder back to pane where it was prior to calling the
+        * switch ViewFinderToMainPane() or ViewFinderToContextPane() methods.
+        */
+        void RestoreViewFinderL();
+
+        /*
+        * Updates volume to the Video Telephone engine.
+        */
+        void CmdUpdateVolumeL( MVtEngAudio::TVtEngOutputVolume aVolume );
+
+        /**
+        * Increases "command activating" ref.count and adds cleanup item
+        * to decrease it. Refreshes commands in case of first increment from
+        * zero. When PopAndDestroy() is called, cleanup decreases reference
+        * count and if it reduces back to zero command refresh is again done.
+        */
+        void EnableCommandActivatingAndCleanupPushL();
+
+    private: // from MProgressDialogCallback
+
+        /**
+        * @see MProgressDialogCallback::DialogDismissedL
+        */
+        void DialogDismissedL( TInt aButtonId );
+
+    private:
+
+        // COMMAND HANDLING
+
+        /**
+        * Checks if command is allowed.
+        * @param aCommand command identifier.
+        * @return ETrue if allowed, EFalse otherwise.
+        */
+        TBool IsCommandAllowedL( const TInt aCommand );
+
+        /**
+        * Refreshes iDisabledFlags.
+        */
+        void RefreshDisabledFlagsL();
+
+        /**
+        * Refreshes camera option availability.
+        * @param aUsePrimaryCameraNotAllowed it will be updated to ETrue if
+        *        it is not allowed to activate primary camera.
+        * @param aUseSecondaryCameraNotAllowed it will be updated to ETrue if
+        *        it is not allowed to activate secondary camera.
+        */
+        void RefreshCameraOptionAvailability(
+            TBool& aUsePrimaryCameraNotAllowed,
+            TBool& aUseSecondaryCameraNotAllowed );
+
+        /**
+        * Enables capture mode.
+        */
+        void CmdSnapshotL();
+
+        /**
+        * Freezes outgoing video image.
+        */
+        void CmdCaptureL();
+
+        /**
+        * Disables capture mode.
+        */
+        void CmdCancelCaptureL();
+
+
+        /**
+        * Enables video.
+        */
+        void CmdEnableVideoL();
+
+        /**
+        * Enables audio (unmute microphone).
+        */
+        void CmdEnableAudioL();
+
+        /**
+        * Disables video.
+        */
+        void CmdDisableVideoL();
+
+        /**
+        * Disables audio (mute microphone).
+        */
+        void CmdDisableAudioL();
+
+        /**
+        * Activates Bluetooth handsfree.
+        */
+        void CmdActivateBtL();
+
+        /**
+        * Deactivates Bluetooth handsfree.
+        */
+        void CmdDeactivateBtL();
+
+        /**
+        * Activates loudspeaker.
+        */
+        void CmdActivateLoudspeakerL();
+
+        /**
+        * Deactivates loudspeaker.
+        */
+        void CmdDeactivateLoudspeakerL();
+
+        /**
+        * Ends active call.
+        */
+        void CmdEndActiveCallL();
+
+        /**
+        * Swaps images places.
+        */
+        void CmdSwapImagesPlacesL();
+
+        /**
+        * Switches used camera.
+        * @param aPrimaryCamera ETrue if primary camera is to be selected,
+        *        EFalse if secondary camera is to be selected.
+        */
+        void CmdUseCameraL( const TBool aPrimaryCamera );
+
+        /**
+        * Launches help application.
+        */
+        void CmdHelpL();
+
+        /**
+        * Prepare exiting the application.
+        */
+        void PrepareExitL();
+
+        /**
+        * Updates zoom step to Video Telephone engine.
+        */
+        void CmdUpdateZoomL();
+
+        /**
+        * Dials emergency call.
+        */
+        void CmdDialEmergencyL();
+
+        /**
+        * Goes to Idle.
+        */
+        void CmdGoToIdleL();
+
+        /**
+        * Initialize image sharing.
+        */
+        void CmdInitializeShareImageL( TBool& aNeedRefresh );
+
+        /**
+        * Start sharing image.
+        */
+        void CmdShareImageL();
+
+        /**
+        * Stops sharing image.
+        */
+        void CmdStopShareImageL( TBool& aNeedRefresh );
+
+		/**
+        * Handles change in call waiting state.
+        * @param aIsWaiting The state of call waiting.
+        */
+	    void HandleWaitingStateChange( TBool aIsWaiting );
+
+        // STATE TRANSITIONS
+
+        /**
+        * @see MVtUiActiveExec::ActiveExecExecuteL.
+        */
+        TBool ActiveExecInitExecuteL(
+            const TInt aState,
+            TInt& aNextState,
+            TRequestStatus& aRequest );
+
+        /**
+        * @see MVtUiActiveExec::ActiveExecContinue.
+        */
+        TBool ActiveExecInitContinue(
+            TInt& aState,
+            const TInt aError );
+
+        /**
+        * @see MVtUiActiveExec::ActiveExecCancel.
+        */
+        void ActiveExecInitCancel(
+            const TInt aState );
+
+        /**
+        * @see MVtUiActiveExec::ActiveExecDone.
+        */
+        void ActiveExecInitDone(
+            const TInt aInitialState );
+
+        /**
+        * Executes command taking no parameters.
+        * @param aCommand command to be performed.
+        * @param aRequest request status.
+        */
+        void ActiveExecInitExecuteCommandL(
+            const TVtEngCommandId aCommand,
+            TRequestStatus& aRequest );
+
+        /**
+        * Executes command taking no parameters.
+        * @param aCommand command to be performed.
+        * @param aParam command parameters.
+        * @param aRequest request status.
+        */
+        template < class T >
+        void ActiveExecInitExecuteCommandL(
+            const TVtEngCommandId aCommand,
+            T& aParam,
+            TRequestStatus& aRequest );
+
+        /**
+        * Executes 'prepare camera' command.
+        * @param aSource source to be prepared.
+        * @param aRequest request status.
+        */
+        void ActiveExecInitPrepareCameraL(
+            const MVtEngMedia::TMediaSource aSource,
+            TRequestStatus& aRequest );
+
+        /**
+        * Executes 'set source' command.
+        * @param aSource source to be selected.
+        * @param aRequest request status.
+        */
+        void ActiveExecInitSetSourceL(
+            const MVtEngMedia::TMediaSource aSource,
+            TRequestStatus& aRequest );
+
+        /**
+        * Executes prepare viewfinder command.
+        * @param aRequest request status to be completed when finished.
+        */
+        void ActiveExecInitPrepareViewFinderL(
+            TRequestStatus& aRequest );
+
+        /**
+        * Executes prepare remote render command.
+        * @param aRequest request status to be completed when finished.
+        */
+        void ActiveExecInitPrepareRemoteRenderL(
+            TRequestStatus& aRequest );
+
+
+        /**
+        * Executes command taking no parameters.
+        * @param aCommand command to be performed.
+        * @param aRequest request status.
+        */
+        void ActiveExecCmdExecuteCommandL(
+            const TVtEngCommandId aCommand,
+            TRequestStatus& aRequest );
+
+        /**
+        * Executes 'set source' command.
+        * @param aSource source to be selected.
+        * @param aRequest request status.
+        */
+        void ActiveExecCmdSetSourceL(
+            const MVtEngMedia::TMediaSource aSource,
+            TRequestStatus& aRequest );
+
+        /**
+        * Executes 'prepare camera' command.
+        * @param aSource source to be selected.
+        * @param aRequest request status.
+        */
+        void ActiveExecCmdPrepareCameraL(
+            const MVtEngMedia::TMediaSource aSource,
+            TRequestStatus& aRequest );
+
+
+        /**
+        * Determines main control options.
+        * @param aRemoteVideo for remote video.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptions
+            DetermineMainControlOptions( TBool aRemoteVideo );
+
+        /**
+        * Determines context control options.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptions DetermineContextControlOptions();
+
+        /**
+        * Determines dialer control options.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptions DetermineDialerControlOptions();
+
+        /**
+        * Determines main control DSA options.
+        * @param aRemoteVideo for remote video.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptionsDSA
+            DetermineMainControlOptionsDSA( TBool aRemoteVideo );
+
+        /**
+        * Determines context control DSA options.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptionsDSA DetermineContextControlOptionsDSA();
+
+        /**
+        * Determines dialer control DSA options.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptionsDSA DetermineDialerControlOptionsDSA();
+
+        /**
+        * Determines main control DP options.
+        * @param aRemoteVideo for remote video.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptionsDP
+            DetermineMainControlOptionsDP( TBool aRemoteVideo );
+
+        /**
+        * Determines context control DP options.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptionsDP DetermineContextControlOptionsDP();
+
+        /**
+        * Determines dialer control DP options.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptionsDP DetermineDialerControlOptionsDP();
+
+        /**
+        * Determines remote video  control options.
+        * @return rendering options.
+        */
+        TVtEngRenderingOptionsNGA
+            DetermineRemoteVideoControlOptionsNGA();
+
+        // SYNCHRONOUS / BLOCKING EXECUTION:
+
+        /**
+        * Performs a command without any parameters.
+        * @param aCommand command to be performed.
+        */
+        void ExecuteCmdL( const TVtEngCommandId aCommand );
+
+        /**
+        * Performs a command with a parameter.
+        * @param aCommmand command to be performed.
+        * @param aParam parameter.
+        */
+        template< class T >
+        void ExecuteCmdL(
+            const TVtEngCommandId aCommand,
+            T& aParam );
+
+        // ASYNCHRONOUS EXECUTION:
+
+        /**
+        * Performs a command without any parameters.
+        * @param aDialogPtr pointer to which returned value is stored.
+        * @param aCommand command to be performed.
+        * @param aStatus request status.
+        * @return dialog.
+        */
+        CEikDialog* ExecuteCmdAsyncL(
+            CEikDialog** aDialogPtr,
+            const TVtEngCommandId aCommand,
+            TRequestStatus& aStatus );
+
+        /**
+        * Performs a command with a parameter.
+        * @param aDialogPtr pointer to which returned value is stored.
+        * @param aCommmand command to be performed.
+        * @param aParam parameter.
+        * @param aStatus request status.
+        * @return dialog.
+        */
+        template< class T >
+        CEikDialog* ExecuteCmdAsyncL(
+            CEikDialog** aDialogPtr,
+            const TVtEngCommandId aCommand,
+            T& aParam,
+            TRequestStatus& aStatus );
+
+        /**
+        * Performs a command.
+        * @param aDialogPtr pointer to which returned value is stored.
+        * @param aCommand command.
+        * @param aParams parameter, optional.
+        * @param aStatus request status.
+        * @return dialog.
+        */
+        CEikDialog* DoExecuteCmdAsyncL(
+            CEikDialog** aDialogPtr,
+            const TVtEngCommandId aCommand,
+            TDesC8* aParams,
+            TRequestStatus& aStatus );
+
+        /**
+        * Executes command in TRAP harnness.
+        * @param aCommand command identifier.
+        * @param aParam optional, parameters.
+        * @return error code.
+        */
+        TInt Execute( const TVtEngCommandId aCommand, TDesC8* aParam );
+
+        // EVENT HANDLING
+
+        /**
+        * Handles foreground changed events.
+        * @param aIsForeground ETrue if foreground, EFalse otherwise.
+        */
+        void HandleForegroundChangedL(
+            TBool aIsForeground );
+
+        /**
+        * Handles engine reset.
+        */
+        void HandleEngineResetL();
+
+        /**
+        * Handles successful answer operation.
+        */
+        void HandleAnswerL();
+
+        /**
+        * Stops waiting image text showing.
+        */
+        void StopWaitingImage();
+
+        /**
+         * Stops white balance showing.
+         */
+        void StopWhiteBalanceOrColortone();
+        
+        /**
+        * Handles layout changes basically calling HandleLayoutChangedL
+        * in trap harness.
+        * @return error code.
+        */
+        TInt HandleLayoutChanged();
+
+        /**
+        * Handles layout changes.
+        */
+        void HandleLayoutChangedL();
+
+        /**
+        * Handles video frame.
+        * @param aLocal local frame if ETrue, EFalse if remote.
+        * @param aBitmap frame, ownership not transferred.
+        */
+        void HandleVideoFrameL(
+            const TBool aLocal,
+            CFbsBitmap* aBitmap );
+
+        void SetVideoFrame(
+            const TBool aLocal,
+            CFbsBitmap* aBitmap );
+
+          /**
+        * Handles video call details.
+        * @param aCallID call id.
+        * @param aCallName call name.
+        * @param aIsPeerAddressAvailable is peer address available.
+        */
+        void HandleVideoCallDetailsL(
+            const TInt aCallId,
+            const TDesC& aCallName,
+            const TBool aIsPeerAddressAvailable );
+
+        /**
+        * Checks if it's time to bring this application
+        * to the foreground.
+        */
+        void CheckBringToForeground();
+
+        /**
+        * Checks if it's time to send this application
+        * to the background.
+        */
+        void CheckSendToBackground();
+
+        /**
+        * Handles remote problem.
+        */
+        void HandleVideoFrameRemoteProblemL();
+
+        /**
+        * Handles local problem.
+        */
+        void HandleVideoFrameLocalProblemL();
+
+        /**
+        * Set a new remote video layout.
+        */
+        void ChangeRemoteVideoLayoutL();
+
+        /**
+        * Show image initialization progress dialog.
+        */
+        void ShowImageInitializeProgressL();
+
+        /**
+        * Hide image initialization progress dialog.
+        */
+        void HideImageInitializeProgressL();
+
+        /**
+        * Sets SQCif usage.
+        * @param aUseSQCif SQCif is used.
+        */
+        void RemoteVideoIsSQCif( TBool aUseSQCif );
+
+        /**
+        * Sets SQCif usage to control.
+        * @param aUseSQCif SQCif is used.
+        */
+        void ControlUsesSQCif( TBool aUseSQCif );
+
+        /**
+        * Checks if beating needs to be started.
+        * @param aCallDurationEnabled call duration enabled status.
+        */
+        void CheckBeatL( const TBool aCallDurationEnabled );
+
+        /**
+        * Handles heart beats.
+        */
+        void HandleBeat();
+
+        // UTILITY METHODS
+
+        /**
+        * Informs the user that camera is reserved by another application.
+        */
+        void ShowCameraInUseNoteL() const;
+
+        /**
+        * Informs the user that the selected operation is not allowed.
+        */
+        void ShowNotAllowedNoteL() const;
+
+        /**
+        * Informs the user that it is not allowed to create normal call.
+        */
+        void ShowCallNotAllowedNoteL() const;
+
+        /**
+        * Informs the user that the other camera is not usable.
+        */
+        void ShowOtherCameraNotUsableNoteL() const;
+
+        /**
+        * Informs the user that image loading failed.
+        */
+        void ShowUnableToOpenNoteL() const;
+
+        /**
+        * Informs the user that error happened during image decoding.
+        * Note: Cannot be constant because DoExecuteL() is used for
+        * calling this method.
+        */
+        void ShowImageDecodingErrorNoteL();
+
+        /**
+        * Informs the user that image is DRM protected and cannot be opened.
+        */
+        void ShowDRMNotAllowedNoteL() const;
+
+        /**
+        * Sets softkeys.
+        * @param aSoftkeyResourceId softkey resource id.
+        */
+        void SetSoftkeysL( const TInt aSoftkeyResourceId );
+
+        /**
+        * Sets application hidden from fast swap window.
+        * @param aHidden ETrue if to be hidden, EFalse if visible.
+        */
+        void SetHiddenL( const TBool aHidden );
+
+        /**
+        * Updates title pane to show call index.
+        * @param aCallId call id.
+        */
+        void SetCallIdL( const TInt aCallId );
+
+        /**
+        * Updates title pane to show name.
+        * @param aName name to be displayed in title pane.
+        * @return ETrue if succeeded, EFalse if not enough memory.
+        */
+        TBool SetCallNameL( const TDesC& aName );
+
+        /**
+        * Brings Telephone application to the foreground.
+        */
+        void BringTelephoneToForeground();
+
+        /**
+        * Returns window group identifier of the principal
+        * telephone application.
+        * @return window group id or 0 if failed.
+        */
+        TInt TelephoneApplicationWgId();
+
+        /**
+        * Returns ETrue if number entry should be shown to the user.
+        * This can be called only after ReadTelephonyVariant has
+        * been called.
+        * @return ETrue if number entry should be shown to the user.
+        */
+        inline TBool ShowNumberEntry() const;
+
+        /**
+        * Checks if active idle is enabled.
+        * @return ETrue if active idle is enabled.
+        */
+        TBool IsActiveIdleEnabledL() const;
+
+        /**
+        * Checks engine functionality.
+        */
+        void CheckEngineFunctionality();
+
+        /**
+        * Returns navi pane.
+        * @return navi pane instance. Ownership not transferred.
+        */
+        inline CAknNavigationControlContainer* NaviPaneL();
+
+        /**
+        * Returns title pane.
+        * @return title pane instance. Ownership not transferred.
+        */
+        inline CAknTitlePane* TitlePaneL();
+
+        /**
+        * Pushes item to cleanup stack to update softkeys.
+        */
+        inline void CleanupPushRefreshL();
+
+        /**
+        * Pushes item to cleanup stack to enable blind status setting.
+        */
+        inline void CleanupPushEnableBlindL();
+
+        /**
+        * Callback function to refresh navi pane and softkeys.
+        * @param aAny pointer to an instance of this class.
+        */
+        static void DoRefresh( TAny* aAny );
+
+        /**
+        * Callback function to enable blind status checking.
+        * @param aAny pointer to an instance of this class.
+        */
+        static void DoEnableBlindSetting( TAny* aAny );
+
+        /**
+        * Callback function to disable command activation
+        * state.
+        * @param aAny pointer to an instance of this class.
+        */
+        static void DoDisableCommandActivating( TAny* aAny );
+
+        /**
+        * Decreases command activation ref.count and refreshes
+        * states if count gets zero.
+        */
+        void HandleCommandDeactivationL();
+
+        /**
+        * Callback function to handle exit timeout.
+        * @param aAny pointer to instance of this class.
+        * @return KErrNone always.
+        */
+        static TInt DoHandleExitTimeout( TAny* aAny );
+
+        /**
+        * Callback function to exit.
+        * @param aAny pointer to instance of this class.
+        * @return KErrNone always.
+        */
+        static TInt DoExit( TAny* aAny );
+
+        /**
+        * Checks whether viewfinder is currently in main pane.
+        * @return ETrue if viewfinder is in main pane.
+        */
+        TBool IsViewFinderInMainPane() const;
+
+public:
+        /**
+        * Checks whether viewfinder is currently in context pane.
+        * @return ETrue if viewfinder is in context pane.
+        */
+        TBool IsViewFinderInContextPane() const;
+private:
+        /**
+        * Updates context pane icon
+        */
+        void UpdateContextPaneIconL();
+
+        /**
+        * Enables or disables the incall bubble.
+        */
+        void SetIncallBubbleAllowedInUsualL( TBool aAllowed );
+
+        /**
+        * Shows progress dialog using given resource.
+        */
+        void ShowProgressDialogL( TInt aResourceId,
+            MProgressDialogCallback* aCallback = NULL );
+
+        /**
+        * Hides (completes) progress dialog.
+        */
+        void HideProgressDialogL();
+
+        /**
+        * Static async callback for switching viewfinder to MainPane, also
+        * starts image sharing.
+        */
+        static TInt AsyncViewFinderToMainPaneAndShare( TAny* aPtr );
+
+        /**
+        * Static async callback for starting image share.
+        */
+        static TInt AsyncShare( TAny* aPtr );
+
+        /**
+        * Static async callback for showing error note and resharing image.
+        */
+        static TInt AsyncShowErrorAndRestartShare( TAny* aPtr );
+
+        /**
+        * Static async callback for handling layout change.
+        */
+        static TInt DelayedHandleLayoutChanged( TAny* aPtr );
+
+        /**
+        * Gets current camera orientations for primary and secondary camera.
+        */
+        void GetCameraOrientations();
+
+        /**
+        * Sets initial camera orientation.
+        */
+        void SetInitialCameraOrientationL();
+
+        /**
+        * Sets current camera orientation.
+        */
+        void SetCameraOrientationL();
+
+        /**
+        * Updates engine states.
+        */
+        void RefreshStatesL();
+
+        /**
+        * Starts video preference feature specified by command id.
+        */
+        void CmdAdjustVideoL( TInt aCommand );
+
+        /**
+        * AppUi has been initialized and its current state is EVtUiAppUiAnswered.
+        * Do any other needed initilization here e.g. start features.
+        */
+        void AppUiInitDoneDoPostInitL();
+
+        /*
+        *  This function decides how the wsevent should be handled
+        * if zoom mode is on.
+        * @param  aEvent window server event.
+        * @return ETrue if caller function should return, EFalse otherwise.
+        */
+        TBool ProcessWsEventIfZoomModeIsActiveL( const TWsEvent& aEvent );
+
+        /*
+        *  This function hides the brightness, contrast, volume slider if their mode is on.
+        */
+        void StopSliders();
+
+        /**
+        * Does pre handling to key events, especially for Zoom in and Zoom out
+        * HW keys.
+        * @param aEvent event.
+        */
+        TBool PreHandleKeyEventL( const TWsEvent& aEvent );
+
+        /**
+        * Calls SimulateKeyEventL() for stored zoom key event.
+        */
+        void SimulateStoredKeyEventL( const TEventCode aEventCode );
+
+        /**
+        * Stores zoom key event. If there is different zoom key event
+        * already stored, keyup event is sent for that event before
+        * new event is stored.
+        */
+        void StoreKeyEventL( const TKeyEvent& aKeyEvent );
+
+        /**
+        * Callback function that calls TryToStartTb function
+        */
+        static TInt DoTryToStartTbL( TAny* aAny );
+
+        /*
+        * Tries to start toolbar. Toolbar is started if
+        * option menus is not visible.
+        */
+        void TryToStartTbL();
+
+        /*
+        * Update video prefrence
+        */
+        void UpdateVBSettingL();
+
+
+        /**
+        * Sets current rendering mode (i.e. default or dialer)
+        */
+        void SetRenderingModeL( const TRenderingMode aMode,
+            MVtUiVideoWindow* aDownlink );
+
+        /**
+        * Updates rendering parameters.
+        */
+        void UpdateRenderingParametersL();
+
+        /*
+        * Media state has been changed
+        */
+        void MediaStateChangedL();
+
+        /*
+        * Updates volume slider
+        */
+        void RefreshVolumeL();
+
+        /*
+        * Adjusts volume up or down one step.
+        */
+        void AdjustVolumeL( TRemConCoreApiOperationId aOperationId );
+
+    private:
+
+        // Pointer to stored downlink window.
+        MVtUiVideoWindow* iStoredDownlinkWindow;
+
+        // Current rendering mode
+        TRenderingMode iRenderingMode;
+
+        // Command framework instance
+        CVtUiCommandManager* iCommandManager;
+
+        // Inner class.
+        class CInstance;
+
+        // Model instance. Exists only while there is a video call.
+        CInstance* iInstance;
+
+        // Inner class to observe all events.
+        class CEventObserver;
+
+        // Inner class for verifying media gallery objects
+        class CVtUiAppUiMGVerifier;
+
+        // Owned event observer.
+        CEventObserver* iEventObserver;
+
+        // Owned blank control for reset & shutdown.
+        CVtUiBlankControl* iBlankControl;
+
+        /**
+        * Enumerates disabled flags:
+        * EDisabledVideo - video disabled,
+        * EDisabledAudio - audio disabled,
+        * EVideoOptionsDisabled - video options disabled.
+        */
+        enum TDisabledFlags
+            {
+            EDisabledVideo = 1,
+            EDisabledAudio = 2,
+            EVideoOptionsDisabled = 4
+            };
+
+		// The Ihf Note id.
+		TInt iIhfNoteId;
+
+        // Flags for disabled. Sum of subset of TDisabledFlags.
+        TInt iDisabledFlags;
+
+        // Current softkey resource id.
+        TInt iCurrentSoftkeys;
+
+        // Telephony variant.
+        TVtUiVideoTelephonyVariation iVTVariation;
+
+        // Window group id of this application.
+        TInt iThisApplicationWgId;
+
+        // Window group id of eikon server.
+        TInt iEikonServerWgId;
+
+        // Window group id for AknCapServer
+        TInt iAknCapServerWgId;
+
+        // Window group id for Akn Notifier Server
+        TInt iAknNfyServerWgId;
+
+        // Owned active executor for initialisation / uninitialisation.
+        CVtUiActiveExec* iActiveExec;
+
+        // Owned current dialog on execution.
+        CEikDialog* iExecDialog;
+
+        // Owned blank dialog.
+        CEikDialog* iExecBlankDialog;
+
+        // Reference to request status.
+        TRequestStatus* iShutdownRequest;
+
+        // Owned active executor for command execution.
+        CVtUiActiveExec* iCmdActiveExec;
+
+        // Owned current dialog on command execution.
+        CEikDialog* iCmdExecDialog;
+
+        // Owned blank dialog on command execution.
+        CEikDialog* iCmdExecBlankDialog;
+
+
+        // Owned timer for making sure that
+        // the application is terminated in time.
+        CPeriodic* iExitTimer;
+
+        // DTMF tone, used as parameter to KVtEngStartDtmfTone.
+        TPckgBuf< TChar > iDtmfTone;
+
+        // Pointer to uplink window.
+        MVtUiVideoWindow* iUplinkWindow;
+
+        // Pointer to downlink window.
+        MVtUiVideoWindow* iDownlinkWindow;
+
+        // Query dialog for switching to voice call
+        CAknQueryDialog* iCreateVoiceCallDlg;
+
+        // Progress dialog shown when initializing
+        CAknProgressDialog* iProgressDlg;
+
+        // ASync callback.
+        CAsyncCallBack* iAsyncCallback;
+
+        // Async callback for layout change
+        CAsyncCallBack* iLayoutChangeCallback;
+
+        // Camera orientation for primary camera
+        MVtEngMedia::TCameraOrientation iPrimaryCameraOrientation;
+
+        // Camera orientation for secondary camera
+        MVtEngMedia::TCameraOrientation iSecondaryCameraOrientation;
+
+        // Currently used camera orientation
+        MVtEngMedia::TCameraOrientation iCurrentCameraOrientation;
+
+        // Current loudspeaker volume
+        TInt iLoudspeakerVolume;
+
+        // Current handset volume
+        TInt iHandsetVolume;
+
+        // Ui states (media, audio, boolean variables)
+        TVtUiStates* iUiStates;
+
+        // Component manager instance
+        CVtUiComponentManager* iComponentManager;
+
+        // Feature manager instance
+        CVtUiFeatureManager* iFeatureManager;
+
+        // Pointer to cba
+        CEikButtonGroupContainer* iCba;
+
+        // Active number source
+        MVtUiNumberSource* iNumberSource;
+
+        TVtUiAppStateBase*  iState;
+
+        // Stored zoom key event
+        TKeyEvent iStoredKeyEvent;
+
+        // ETrue if incoming call is waiting call
+        TBool iIsWaitingCallState;
+
+        // ETrue if key event has been stored
+        TBool iIsStoredKeyEvent;
+
+        // Timer for starting the toolbar
+        CPeriodic* iTbPeriodic;
+
+        // Owned volume control class for adjusting
+        // engine side volume
+        CVtUiVolumeControl* iVolCtrl;
+
+    private: // Friend classes
+
+        // Inner class.
+        friend class CInstance;
+
+        // Inner class.
+        friend class CEventObserver;
+
+    private:
+
+        // Class for active command handling
+        class TActiveCommand
+            {
+
+        public:
+
+            /**
+            * Constructor.
+            * @param aActiveCommands array of command ids.
+            * @param aCommand command id.
+            */
+            TActiveCommand( RArray< TInt >& aActiveCommands, TInt aCommandId );
+
+            /**
+            * Destructor
+            */
+            ~TActiveCommand();
+
+            /**
+            * Adds command to active commands
+            */
+            void OpenL();
+
+        private:
+
+            /**
+            * Removes command from active commands
+            */
+            void Close();
+
+        private:
+
+            // Reference to array of active command ids.
+            RArray< TInt >& iActiveCommands;
+
+            // Command id.
+            const TInt iCommandId;
+
+            };
+
+
+    private:
+        // Active command ids.
+        RArray< TInt > iActiveCommands;
+        // The last time swap image operation occured.
+        TTime iLastSwapTime;
+        // Incall bubble.
+        CAknIncallBubble* iIncallBubble;
+        //This flag is used to check if orientation changed before some action
+        //Currently is only used for prepare remote render and start remote render
+        TBool iIsLandScapeOrientation;
+        //flag indicates layoutchang session
+        TBool iLayoutChg;
+        //save cmd for later use 
+        TInt iDelayedCmd;
+    };
+
+#endif      // CVTUIAPPUI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiBitmapManager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2004, 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:  Bitmap manager for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIBITMAPMANAGER_H
+#define CVTUIBITMAPMANAGER_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <gdi.h>
+#include    "videotelui.hrh"
+
+// DATA TYPES
+
+/**
+* Type definition for bitmap pool identifier.
+* Zero is reserved as invalid identifier.
+*/
+typedef TInt TVtUiBitmapPoolId;
+
+// FORWARD DECLARATION
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+/**
+*  Bitmap manager for Video Telephone application.
+*  @since Series 60 2.8
+*/
+class CVtUiBitmapManager
+    : public CBase
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Constructor.
+        */
+        CVtUiBitmapManager();
+
+        /**
+        * Destructor.
+        */
+        ~CVtUiBitmapManager();
+
+    public: // New functions
+
+        /**
+        * Adds bitmaps to the pool.
+        * @param aBitmapId bitmap identifier.
+        * @param aBitmapMaskId bitmap mask identifier, 
+        *        KErrNotFound if no mask.
+        * @param aExpectDefaultColor ETrue if default color is to be expected.
+        * @return bitmap pool identifier.
+        */
+        TVtUiBitmapPoolId AddBitmapsL(
+            TVtUiBitmapId aBitmapId, 
+            TVtUiBitmapId aBitmapMaskId,
+            TBool aExpectDefaultColor );
+
+        /**
+        * Adds bitmap to the pool.Note that this bitmap does not have mask.
+        * @param aBitmapId bitmap identifier.
+        * @param aExpectDefaultColor ETrue if default color is to be expected.
+        * @return bitmap pool identifier.
+        */
+        TVtUiBitmapPoolId AddBitmapL(
+            TVtUiBitmapId aBitmapId,
+            TBool aExpectDefaultColor );
+        
+        /**
+        * Removes bitmap from the pool.
+        * @param aId bitmap pool identifier.
+        */
+        void RemoveBitmap( TVtUiBitmapPoolId aId );
+
+        /**
+        * Sets size of the specified bitmap. This method must be 
+        * called before bitmap is used.
+        *
+        * @param aId bitmap pool identifier.
+        * @param aSize size of the bitmap.
+        */
+        void SetSize( 
+            TVtUiBitmapPoolId aId, 
+            const TSize& aSize );
+
+        /**
+        * Sets size and default color of the specified bitmap. 
+        * This method must be called before bitmap is used.
+        *
+        * @param aId bitmap pool identifier.
+        * @param aSize size of the bitmap.
+        * @param aDefaultColor default color of the bitmap.
+        */
+        void SetSizeAndColor( 
+            TVtUiBitmapPoolId aId,
+            const TSize& aSize, 
+            const TRgb& aDefaultColor );
+
+        /**
+        * Sets aspect ratio preservation status.
+        * @param aId bitmap pool identifier.
+        * @param aPreserve ETrue if aspect ration is to be preserved.
+        */
+        void SetAspectRatio( 
+            TVtUiBitmapPoolId aId,
+            TBool aPreserve );
+
+        /**
+        * This method is called to inform that bitmap is required.
+        * @param aId bitmap pool identifier.
+        */
+        void RequireBitmap( TVtUiBitmapPoolId aId );
+
+        /**
+        * Gets bitmap & its mask.
+        * @param aId bitmap pool identifier.
+        * @param aBitmap it will be updated to hold bitmap pointer, 
+        *        or NULL if bitmap is not available. This pointer
+        *        must not be kept any longer than absolutely required.
+        * @param aBitmapMask it will be updated to hold bitmap mask pointer, 
+        *        or NULL if bitmap mask is not available. This pointer
+        *        must not be kept any longer than absolutely required.
+        */
+        void GetBitmaps(
+            TVtUiBitmapPoolId aId,
+            CFbsBitmap*& aBitmap,
+            CFbsBitmap*& aBitmapMask );
+
+        /**
+        * Gets bitmap & its mask.
+        * @param aId bitmap pool identifier.
+        * @param aBitmap it will be updated to hold bitmap pointer, 
+        *        or NULL if bitmap is not available. This pointer
+        *        must not be kept any longer than absolutely required.
+        */
+        void GetBitmap(
+            TVtUiBitmapPoolId aId,
+            CFbsBitmap*& aBitmap );
+
+        /**
+        * Invalidates bitmaps. This is called on theme / layout change.
+        */
+        void InvalidateBitmaps();
+
+    private:
+
+        // Inner class.
+        class CBitmapInfo;
+
+        /**
+        * Finds bitmap based on pool identifier.
+        * @param aId bitmap pool identifier.
+        * @return KErrNotFound if not found, or index to array.
+        */ 
+        TInt Find( TVtUiBitmapPoolId aId ) const;
+
+    private:
+
+        // Owned array of bitmap information instances.
+        RPointerArray< CBitmapInfo > iBitmapArray;
+
+        // Bitmap pool identifier used to generate bitmaps.
+        TVtUiBitmapPoolId iBitmapId;
+
+        // Temporary instance for getting bitmap file name.
+        TFileName iTmpFileName;
+
+    };
+
+#endif      // CVTUIBITMAPMANAGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiBlankControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,98 @@
+/*
+* 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:  Blank control for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIBLANKCONTROL_H
+#define CVTUIBLANKCONTROL_H
+
+//  INCLUDES
+#include    <coecntrl.h>
+
+// CLASS DECLARATION
+
+/**
+*  Blank control for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiBlankControl
+    : public CCoeControl
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CVtUiBlankControl();
+
+        /**
+        * Symbian constructor.
+        * @param aRect control rectangle.
+        */
+        void ConstructL( const TRect& aRect );
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiBlankControl();
+
+    public: // New functions
+
+        /**
+        * Sets blanker active / inactive.
+        * @param aStatus ETrue if to be activated.
+        */
+        void SetActive( TBool aStatus );
+
+    protected: // Functions from base classes
+
+        /**
+        * From CCoeControl, handles key events.
+        * @param aKeyEvent key event.
+        * @param aType type of event.
+        */
+        virtual TKeyResponse OfferKeyEventL(
+            const TKeyEvent& aKeyEvent,
+            TEventCode aType );
+
+        /**
+        * From CCoeControl, draws the control.
+        * @param aRect area to be drawn.
+        */
+        virtual void Draw( const TRect& aRect ) const;
+
+        /**
+        * From CCoeControl, handles size changes.
+        */
+        virtual void SizeChanged();
+
+        /**
+        * From CCoeControl, handles position changes.
+        */
+        virtual void PositionChanged();
+
+    private: 
+
+        // ETrue if blanker is active.
+        TBool iBlankerActive;
+
+    };
+
+#endif      // CVTUIBLANKCONTROL_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiBlankDialog.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* 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:  Blank dialog for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIBLANKDIALOG_H
+#define CVTUIBLANKDIALOG_H
+
+//  INCLUDES
+#include    <eikdialg.h>
+
+// CLASS DECLARATION
+
+/**
+*  Blank dialog for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiBlankDialog
+    : public CEikDialog
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Constructor.
+        *
+        * @param aSelfPtr optional pointer to itself.
+        */
+        CVtUiBlankDialog( CEikDialog** aSelfPtr );
+
+        /**
+        * Destructor. If a pointer was passed in constructor, 
+        * it will be cleared here.
+        */
+        ~CVtUiBlankDialog();
+
+    public: // New functions
+
+        /**
+        * Executes blank dialog, no wait flag set.
+        */
+        void ExecuteDialogNoWaitLD();
+
+        /**
+        * Executes blank dialog.
+        * @param aRequest request status, optional.
+        */
+        void ExecuteDialogLD( 
+            TRequestStatus* aRequest );
+
+    protected: // New functions
+
+        /**
+        * Completes dialog with error.
+        * Note: this method will delete the dialog.
+        * @param aError error code.
+        */
+        void Complete( const TInt aError );
+
+    protected: // Functions from base classes
+
+        /**
+        * @see CEikDialog::PreLayoutDynInitL.
+        */
+        void PreLayoutDynInitL();
+        
+        /**
+        * @see CEikDialog::PostLayoutDynInitL.
+        */
+        void PostLayoutDynInitL();
+
+        /**
+        * @see CEikDialog::OkToExitL.
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+        /**
+        * @see CEikDialog::Draw.
+        */
+        void Draw( const TRect& aRect ) const;
+
+    private:
+
+        // Pointer to itself.
+        CEikDialog** iSelfPtr;
+
+        // Error code.
+        TInt* iError;
+
+        // Request status.
+        TRequestStatus* iRequest;
+    };
+
+#endif      // CVTUIBLANKDIALOG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiContextControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2004, 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:  Context pane control for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUICONTEXTCONTROL_H
+#define CVTUICONTEXTCONTROL_H
+
+//  INCLUDES
+#include    <aknwseventobserver.h>
+#include    "cvtuivideocontrolbase.h"
+
+// FORWARDS
+class CVtUiAppUi;
+class TVtUiStates;
+
+/**
+*  Context pane control for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiContextControl : public CVtUiVideoControlBase,
+    public MAknWsEventObserver
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        * @param aBitmapManager bitmap manager.
+        * @param aLargeViewfinder ETrue if large viewfinder wanted.
+        * @param aAppUi application UI.
+        * @param aUiStates UI states.
+        */
+        static CVtUiContextControl* NewL(
+            CVtUiBitmapManager& aBitmapManager,
+            CVtUiAppUi& aAppUi,
+            TVtUiStates& aUiStates );
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiContextControl();
+
+        /**
+        * LayoutRemoteVideo
+        */
+       void LayoutRemoteVideo();
+       
+    public: // from CCoeControl
+
+        /**
+        * @see CCoeControl::HandlePointerEventL
+        */
+        void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+
+    private: // from CVtUiVideoControlBase
+
+        /**
+        * @see CVtUiVideoControlBase::HandleSizeChanged
+        */
+        void HandleSizeChanged();
+
+        /**
+        * @see CVtUiVideoControlBase::DrawColoredBackground
+        */
+        void DrawColoredBackground( CWindowGc& aGc ) const;
+
+        /**
+        * @see CVtUiVideoControlBase::StreamBlitPosition
+        */
+        TPoint StreamBlitPosition() const;
+
+        /**
+        * @see CVtUiVideoControlBase::StreamBlitPosition
+        */
+        TRect StreamClippingRect() const;
+
+        /**
+        * @see CVtUiVideoControlBase::BlindImage
+        */
+        CFbsBitmap* BlindImage() const;
+
+        /**
+        * @see CVtUiVideoControlBase::BlindMask
+        */
+        CFbsBitmap* BlindMask() const;
+
+        /**
+        * @see CVtUiVideoControlBase::BlindBlitPosition
+        */
+        TPoint BlindBlitPosition() const;
+
+    public: // from MAknWsEventObserver
+
+        /**
+        * @see MAknWsEventObserver::HandleWsEventL
+        */
+        void HandleWsEventL( const TWsEvent& aEvent,
+            CCoeControl* aDestination );
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CVtUiContextControl(
+            CVtUiBitmapManager& aBitmapManager,
+            CVtUiAppUi& aAppUi,
+            TVtUiStates& aUiStates );
+
+        /**
+        * Symbian constructor.
+        */
+        void ConstructL();
+
+    private:
+
+        // Background icon identifier.
+        TVtUiBitmapPoolId iBackgroundId;
+
+        // Blind icon identifier.
+        TVtUiBitmapPoolId iBlindId;
+
+        // Blind icon mask identifier.
+        TVtUiBitmapPoolId iBlindMaskId;
+
+        // Reference to application UI.
+        CVtUiAppUi& iAppUi;
+
+        // Reference to UI states.
+        TVtUiStates& iUiStates;
+
+        // Background bitmap layout.
+        TAknLayoutRect iBackGround;
+
+        // Blind icon rect
+        TRect iBlindRect;
+
+        // Stream rect
+        TRect iStreamRect;
+
+        // ETrue if it is ok to swap images on button up
+        TBool iOkToSwapOnButtonUp;
+
+    };
+
+#endif      // CVTUICONTEXTCONTROL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiDoc.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* 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:  Document class for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIDOC_H
+#define CVTUIDOC_H
+
+//  INCLUDES
+#include    <akndoc.h>
+
+// CLASS DECLARATION
+
+/**
+*  Document class for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiDoc
+    : public CAknDocument
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        * @param aApp application instance.
+        */
+        CVtUiDoc( CEikApplication& aApp );
+
+    public: // Functions from base classes
+
+        /**
+        * From CAknDocument, creates application UI instance.
+        * @return application UI instance.
+        */
+        virtual CEikAppUi* CreateAppUiL();
+
+        /**
+        * From CAknDocument, updates task name.
+        * @param aWgName window group name instance.
+        */
+        virtual void UpdateTaskNameL( CApaWindowGroupName* aWgName );
+
+    };
+
+#endif      // CVTUIDOC_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiExecuteCmdDialog.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* 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:  Dialog for command execution for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIEXECUTECMDDIALOG_H
+#define CVTUIEXECUTECMDDIALOG_H
+
+//  INCLUDES
+#include    "CVtUiBlankDialog.h"
+#include    <mvtengcommandobserver.h>
+
+// FORWARD DECLARATIONS
+class MVtEngCommandHandler;
+class MVtUiEngineCommandManager;
+
+// CLASS DECLARATION
+
+/**
+*  Dialog for command execution for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiExecuteCmdDialog
+    : public CVtUiBlankDialog,
+      private MVtEngCommandObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        *
+        * @param aSelfPtr optional pointer to itself.
+        * @param aCommandHandler command handler.
+        * @param aCommandManager command manager.
+        */
+        CVtUiExecuteCmdDialog(
+            CEikDialog** aSelfPtr,
+            MVtEngCommandHandler& aCommandHandler,
+            MVtUiEngineCommandManager& aCommandManager );
+
+        /**
+        * Destructor.
+        */
+        ~CVtUiExecuteCmdDialog();
+
+    public: // New functions
+
+        /**
+        * Executes command dialog.
+        * @param aCommandId command identifier.
+        * @param aParams parameters.
+        * @param aRequest request status, optional.
+        */
+        void ExecuteCmdLD(
+            const TVtEngCommandId aCommandId,
+            TDesC8* aParams,
+            TRequestStatus* aRequest );
+
+    protected: // Functions from base classes
+
+        /**
+        * @see CVtUiBlankDialog::PostLayoutDynInitL.
+        */
+        void PostLayoutDynInitL();
+
+    private:
+
+        /**
+        * @see MVtEngCommandObserver::HandleVTCommandPerformedL.
+        */
+        virtual void HandleVTCommandPerformedL(
+            TVtEngCommandId aCommand,
+            const TInt aError );
+
+        /**
+        * Handles execution failure.
+        * @param aResult error code.
+        */
+        void HandleExecuteFailed( TInt aResult );
+
+    private:
+
+        // Inner class.
+        class CActiveCmd;
+
+        // Friend.
+        friend class CActiveCmd;
+
+        // Ref to command handler.
+        MVtEngCommandHandler& iCommandHandler;
+
+        // Ref to command manager.
+        MVtUiEngineCommandManager& iCommandManager;
+
+        // Command to be executed.
+        TVtEngCommandId iCommand;
+
+        // Owned parameters.
+        HBufC8* iCommandParams;
+
+        // ETrue if command has been completed.
+        TBool iCommandCompleted;
+
+        // Owned active object to perform the command.
+        CActiveCmd* iActiveCmd;
+
+    };
+
+#endif      // CVTUIEXECUTECMDDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiMainControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2004, 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:  Main pane control for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIMAINCONTROL_H
+#define CVTUIMAINCONTROL_H
+
+//  INCLUDES
+#include    "cvtuivideocontrolbase.h"
+
+// CLASS DECLARATION
+class TVtUiStates;
+class TAknTextLineLayout;
+
+/**
+*  Main pane control for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiMainControl : public CVtUiVideoControlBase
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param aBitmapManager bitmap manager.
+        * @param aUiStates Ui states class.
+        */
+        static CVtUiMainControl* NewL( CVtUiBitmapManager& aBitmapManager,
+            TVtUiStates& aUiStates );
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiMainControl();
+
+    public: // New functions.
+
+        /**
+        * Sets SQCif mode on/off.
+        * @param aIsSupported whether on/off
+        */
+        void SupportSQCif( TBool aIsSupported );
+
+         /**
+         * LayoutRemoteVideo
+         */
+        void LayoutRemoteVideo();
+
+    private: // from CVtUiVideoControlBase
+
+        /**
+        * @see CVtUiContextControl::HandleSizeChanged
+        */
+        void HandleSizeChanged();
+
+        /**
+        * @see CVtUiContextControl::DrawWaitingText
+        */
+        TBool DrawWaitingText( CWindowGc& aGc ) const;
+
+        /**
+        * @see CVtUiContextControl::StreamBlitPosition
+        */
+        TPoint StreamBlitPosition() const;
+
+        /**
+        * @see CVtUiContextControl::StreamClippingRect
+        */
+        TRect StreamClippingRect() const;
+
+        /**
+        * @see CVtUiContextControl::BlindImage
+        */
+        CFbsBitmap* BlindImage() const;
+
+        /**
+        * @see CVtUiContextControl::BlindMask
+        */
+        CFbsBitmap* BlindMask() const;
+
+        /**
+        * @see CVtUiContextControl::BlindBlitPosition
+        */
+        TPoint BlindBlitPosition() const;
+
+        /**
+        * @see CVtUiContextControl::WaitingTextLayout
+        */
+        TAknTextLineLayout WaitingTextLayout( TInt aLine );
+
+    private:
+
+        /**
+        * Private constructor.
+        */
+        CVtUiMainControl( CVtUiBitmapManager& aBitmapManager,
+            TVtUiStates& aUiStates );
+
+        /**
+        * C++ constructor.
+        * @param aBitmapManager bitmap manager.
+        */
+        CVtUiMainControl();
+
+        /**
+        * Symbian constructor.
+        */
+        void ConstructL();
+
+    private:
+
+        // Background layout.
+        TAknLayoutRect iBackgroundLayout;
+
+        // Blind icon identifier.
+        TVtUiBitmapPoolId iBlindId;
+
+        // Blind icon mask identifier.
+        TVtUiBitmapPoolId iBlindMaskId;
+
+        // Blind icon layout.
+        TAknLayoutRect iBlindLayout;
+
+        // Stream layout.
+        TAknLayoutRect iStreamLayoutRect;
+
+        // ETrue if sqcif is used in remote video.
+        TBool iSQCifRemote;
+
+        // reference to uistates
+        TVtUiStates& iUiStates;
+
+    };
+
+#endif      // CVTUIMAINCONTROL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiMutedControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* 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:  Navi pane control for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIMUTEDCONTROL_H
+#define CVTUIMUTEDCONTROL_H
+
+//  INCLUDES
+#include    <coecntrl.h>
+#include    <aknutils.h>
+
+// CLASS DECLARATION
+
+/**
+*  Navi pane control for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiMutedControl
+    : public CCoeControl
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        CVtUiMutedControl();
+
+        /**
+        * Symbian constructor.
+        */
+        void ConstructL();
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiMutedControl();
+
+    public: // Functions from base classes
+
+        /**
+        * From CCoeControl, handles resource change.
+        * @param aType type of change.
+        */ 
+        virtual void HandleResourceChange(
+            TInt aType );
+
+    protected: // Functions from base classes
+
+        /**
+        * From CCoeControl, draws the control.
+        * @param aRect area to be drawn.
+        */
+        virtual void Draw( const TRect& aRect ) const;
+
+        /**
+        * From CCoeControl, handles size changes.
+        */
+        virtual void SizeChanged();
+
+        /**
+        * From CCoeControl, handles position changes.
+        */
+        virtual void PositionChanged();
+
+        /**
+        * From CCoeControl, returns amount of component controls.
+        * @return amount of component controls.
+        */
+        virtual TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl, returns specified control.
+        * @param aIndex index of control.
+        * @return control.
+        */
+        virtual CCoeControl* ComponentControl(
+            TInt aIndex ) const;
+
+    private:
+
+        // Owned muted label.
+        CEikLabel* iMutedLabel;
+
+    };
+
+#endif      // CVTUIMUTEDCONTROL_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiNaviPane.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2004, 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:  Controller for navi pane for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUINAVIPANE_H
+#define CVTUINAVIPANE_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <coedef.h>
+#include    <w32std.h>
+#include    <coecobs.h>
+
+// FORWARD DECLARATIONS
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CVtUiNaviPaneControl;
+class CVtUiAppUi;
+
+// CONSTANTS
+
+// Minimum volume.
+const TInt KVtUiVolumeMinimum = 0;
+
+// Maximum volume.
+const TInt KVtUiVolumeMaximum = 10;
+
+// CLASS DECLARATION
+
+/**
+*  Controller for navi pane for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiNaviPane : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aNaviPane reference to navipane.
+        * @param aAppUi application UI.
+        */
+        static CVtUiNaviPane* NewL(
+            CAknNavigationControlContainer& aNaviPane,
+            CVtUiAppUi& aAppUi );
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiNaviPane();
+
+    public: // New functions
+
+        /**
+        * Updates current speaker.
+        * @param aLoudspeaker Loudspeaker if ETrue, handset otherwise.
+        */
+        void SetCurrentSpeaker(
+            const TBool aLoudspeaker );
+
+        /**
+        * Changes muted status.
+        * @param aStatus status.
+        */
+        void SetMuted(
+            const TBool aStatus );
+
+        /**
+        * Updates call duration.
+        * @param aDuration current duration.
+        * @param aEnabled ETrue if call duration enabled.
+        */
+        void SetCallDuration(
+            const TTimeIntervalSeconds& aDuration,
+            const TBool aEnabled );
+
+        /**
+        * Commits changes. This method should be called after above
+        * Set* methods to make sure that display is up to date.
+        */
+        void CommitL();
+
+        /**
+        * Gets speaker volume.
+        * @param aLoudspeaker ETrue if loudspeaker, EFalse if handset.
+        * @param aValue it will be updated to contain volume of the speaker.
+        */
+        void GetSpeakerVolume(
+            const TBool aLoudspeaker,
+            TInt& aValue ) const;
+
+        /**
+        * Handles resource changes.
+        * @param aType type of change.
+        */
+        void HandleResourceChange(
+            TInt aType );
+
+    protected: // From base classes
+
+        /**
+        * Called by CActive when operation needs to be canceled.
+        */
+        void DoCancel();
+
+        /**
+        * Called by CActiveScheduler when operation has been
+        * finished.
+        */
+        void RunL();
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aNaviPane navipane instance.
+        * @param aAppUi application UI.
+        */
+        CVtUiNaviPane(
+            CAknNavigationControlContainer& aNaviPane,
+            CVtUiAppUi& aAppUi );
+
+        /**
+        * Symbian constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Pushes indicators after timeout.
+        */
+        void PushAfterTimeout();
+
+        /**
+        * Pushes new decorator to navi pane replacing the
+        * previous one.
+        * @param aNew new to replace the old one.
+        */
+        void PushL( CAknNavigationDecorator* aNew );
+
+        /**
+        * Returns indicator that should be used currently.
+        * @return indicator to be shown.
+        */
+        CAknNavigationDecorator* DefaultIndicator() const;
+
+    private:
+
+        // Slider types in navipane
+        enum TSliderControlType
+                {
+                ENone,
+                EZoom,      // Zoom control visible
+                EVolume     // Volume control visible
+                };
+
+
+        // Holds current slider type
+        TSliderControlType iSliderType;
+
+        // Ref to navi pane.
+        CAknNavigationControlContainer& iNaviPane;
+
+        // Ref to top navi pane element.
+        CAknNavigationDecorator* iCurrent;
+
+        // Owned controller for call duration
+        CAknNavigationDecorator* iMainIndicators;
+
+        // Reference to navi pane control.
+        CVtUiNaviPaneControl* iNaviPaneControl;
+
+        // Owned muted indicator.
+        CAknNavigationDecorator* iMutedIndicator;
+
+        // Owned timer instance.
+        RTimer iTimer;
+
+        // ETrue if call duration was enabled.
+        TBool iOldCallDurationEnabled;
+
+        // ETrue if call duration is enabled.
+        TBool iCallDurationEnabled;
+
+        // ETrue if loudspeaker, EFalse if handset.
+        TBool iLoudspeaker;
+
+        // Old microphone status.
+        TBool iOldMicrophoneMuted;
+
+        // ETrue if microphone is muted.
+        TBool iMicrophoneMuted;
+
+        // Reference to application UI.
+        CVtUiAppUi& iAppUi;
+    };
+
+#endif      // CVtUiNaviPane_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiNaviPaneControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2004, 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:  Navi pane control for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUINAVIPANECONTROL_H
+#define CVTUINAVIPANECONTROL_H
+
+//  INCLUDES
+#include    <coecntrl.h>
+#include    <aknutils.h>
+
+// CONSTANTS
+
+// Maximum length of call duration buffer.
+const TInt KVtUiCallDurationBufferLength = 16;
+
+// FORWARD DECLARATIONS
+class CVtUiNaviPane;
+
+// CLASS DECLARATION
+
+/**
+*  Navi pane control for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiNaviPaneControl
+    : public CCoeControl
+    {
+    public: // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        * @param aNaviPane eference to navipane.
+        */
+        CVtUiNaviPaneControl( CVtUiNaviPane& aNaviPane ); 
+
+        /**
+        * Symbian constructor.
+        */
+        void ConstructL();
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiNaviPaneControl();
+
+    public: // New functions
+
+        /**
+        * Sets call duration.
+        * @param aDuration call duration.
+        * @param aEnabled ETrue if enabled.
+        */
+        void SetCallDuration( 
+            const TTimeIntervalSeconds& aDuration,
+            const TBool aEnabled );
+
+        /**
+        * Updates screen to reflect changes.
+        */
+        void CommitL();
+
+    protected: // Functions from base classes
+
+        /**
+        * From CCoeControl, draws the control.
+        * @param aRect area to be drawn.
+        */
+        virtual void Draw( const TRect& aRect ) const;
+
+        /**
+        * From CCoeControl, handles size changes.
+        */
+        virtual void SizeChanged();
+
+        /**
+        * From CCoeControl, handles position changes.
+        */
+        virtual void PositionChanged();
+
+    private:
+
+        /**
+        * Gets call duration text.
+        * @return reference to text.
+        */
+        const TDesC& GetCallDurationText() const;
+
+        /**
+        * Appends character to the buffer.
+        * @param aBuffer buffer.
+        * @param aChar character.
+        */
+        static void AppendChar( 
+            TDes& aBuffer,
+            const TChar& aChar );
+
+        /**
+        * Appends a number to the buffer.
+        * @param aBuffer buffer.
+        * @param aNumber number, 0 .. 99.
+        */
+        static void AppendNum(
+            TDes& aBuffer,
+            const TInt aNumber );
+
+    private:
+
+        // Call duration layout.
+        TAknLayoutText iCallDurationLayout;
+
+        // ETrue if call duration is enabled.
+        TBool iCallDurationEnabled;
+
+        // Duration in seconds.
+        TTimeIntervalSeconds iCallDuration;
+
+        // Buffer for call duration.
+        mutable TBuf< KVtUiCallDurationBufferLength > iCallDurationBuffer;
+
+        // Current speaker, ETrue if loudspeaker, EFalse if handset.
+        TBool iLoudspeaker;
+        
+        // Reference to navipane.
+        CVtUiNaviPane& iNaviPane;
+
+    };
+
+#endif      // CVTUINAVIPANECONTROL_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiNumberEntryActivationControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* 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:  Number entry activation control for 
+*                Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUINUMBERENTRYACTIVATIONCONTROL_H
+#define CVTUINUMBERENTRYACTIVATIONCONTROL_H
+
+//  INCLUDES
+#include    <coecntrl.h>
+
+// FORWARD DECLARATIONS
+class CVtUiAppUi;
+
+// CLASS DECLARATION
+
+/**
+*  Number entry activation control for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiNumberEntryActivationControl
+    : public CCoeControl
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        * @param aAppUi application ui.
+        */
+        CVtUiNumberEntryActivationControl( CVtUiAppUi& aAppUi );
+
+        /**
+        * Symbian constructor.
+        * @param aRect initial area.
+        */
+        void ConstructL( const TRect& aRect );
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiNumberEntryActivationControl();
+
+    public: // Functions from base classes
+        
+        /**
+        * @see CCoeControl::SizeChanged.
+        */
+        virtual void SizeChanged();
+
+        /**
+        * @see CCoeControl::PositionChanged.
+        */
+        virtual void PositionChanged();
+
+        /**
+        * @see CCoeControl::Draw.
+        */
+        virtual void Draw( const TRect& aRect ) const;
+    
+        /**
+        * @see CCoeControl::OfferKeyEventL.
+        */
+        virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+            TEventCode aType );
+
+    public: // New functions
+        
+        /**
+        * Set control's activation status.
+        * @param aIsActive ETrue if key events should 
+        * be handled oterherwise EFalse.
+        */
+        void SetActive( TBool aIsActive );
+  
+    private:
+
+        /**
+        * Checks if event should open number entry.
+        * @param aKeyEvent event.
+        * @param aDtmfTone event as character tone.
+        * @return ETrue if number entry should be opened.
+        */
+        static TBool IsNumericEvent( 
+            const TKeyEvent& aKeyEvent,
+            TChar& aDtmfTone );
+
+    private:
+
+        // Reference to application ui.
+        CVtUiAppUi& iAppUi;
+
+        // ETrue if this control has been added to stack.
+        TBool iAddedToStack;
+        
+        // ETrue if key events should be handled oterherwise EFalse.
+        TBool iIsActive;
+
+    };
+
+#endif      // CVTUINUMBERENTRYACTIVATIONCONTROL_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiRemoteVideoControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* 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:  class for Remote Video Control.
+*
+*/
+
+#ifndef CVTUIREMOTEVIDEOCONTROL_H_
+#define CVTUIREMOTEVIDEOCONTROL_H_
+
+#include    <coecntrl.h>
+#include    <aknwseventobserver.h>
+
+class CVtUiVideoControlBase;
+class CVtUiAppUi;
+
+/**
+ *  CVtUiRemoteVideoControl
+ *
+ *  Remote Video control.
+ *
+ *  @since S60 v5.0
+ */
+class CVtUiRemoteVideoControl : public CCoeControl,
+    public MAknWsEventObserver
+    {
+public:
+
+    /**
+    * Static Constructor.
+    */
+    static CVtUiRemoteVideoControl* NewL(CVtUiAppUi& aAppUi);
+    
+    RWindow& GetRWindow();
+
+    /**
+     * Destructor
+     */
+    ~CVtUiRemoteVideoControl();    
+
+protected:
+
+    /**
+     * Constructor
+     */
+    CVtUiRemoteVideoControl(CVtUiAppUi& aAppUi);
+
+    /**
+     * 2nd constructor
+     */
+    void ConstructL();
+    
+public: // from CCoeControl
+
+    /**
+    * @see CCoeControl::HandlePointerEventL
+    */
+    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+    
+public: // from MAknWsEventObserver
+
+    /**
+    * @see MAknWsEventObserver::HandleWsEventL
+    */
+    void HandleWsEventL( const TWsEvent& aEvent,
+        CCoeControl* aDestination );    
+
+protected: // virtual methods
+
+    /**
+    * The size changed method. If you need to do special handling after the
+    * control's size has changed, overwrite this method.
+    */
+    virtual void HandleSizeChanged();
+
+private: // from CCoeControl
+    /**
+    * @see CCoeControl::Draw
+    */
+    void Draw( const TRect& aRect ) const;
+
+    /**
+    * @see CCoeControl::SizeChanged
+    */
+    void SizeChanged();
+
+    /**
+    * @see CCoeControl::PositionChanged
+    */
+    void PositionChanged();
+    
+    /**
+    * The draw method.
+    */
+    void DoDraw( CWindowGc& aGc ) const;
+
+private:    
+    
+    // Reference to application UI.
+    CVtUiAppUi& iAppUi;
+    
+
+    };
+
+#endif /*CVTUIREMOTEVIDEOCONTROL_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/CVtUiZoomControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2004, 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:  Navi pane zoom indicator control for 
+*                Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUIZOOMCONTROL_H
+#define CVTUIZOOMCONTROL_H
+
+//  INCLUDES
+#include    <coecntrl.h>
+#include    <aknutils.h>
+#include    "CVtUiBitmapManager.h"
+
+// CLASS DECLARATION
+
+/**
+*  Navi pane zoom indicator control for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiZoomControl
+    : public CCoeControl
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        * @param aBitmapManager bitmap manager.
+        */
+        CVtUiZoomControl( CVtUiBitmapManager& aBitmapManager );
+
+        /**
+        * Symbian constructor.
+        */
+        void ConstructL();
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiZoomControl();
+
+    public: // New functions
+
+        /**
+        * Sets zoom parameters.
+        * @param aStepCount amount of steps, 0 if zooming disabled.
+        * @param aCurrentStep current step, 0 .. aStepCount.
+        */
+        void SetZoomParams( 
+            const TInt aStepCount, 
+            const TInt aCurrentStep );
+
+        /**
+        * Commits changes.
+        */
+        void CommitL();
+
+        /**
+        * Returns ETrue if zooming is enabled.
+        * @return ETrue if enabled.
+        */
+        TBool IsZoomEnabled() const;
+
+        /**
+        * Gets zoom parameters.
+        * @param aStepCount amount of steps, 0 if zooming disabled.
+        * @param aCurrentStep current step, 0 .. aStepCount.
+        */
+        void GetZoomParams(
+            TInt& aStepCount,
+            TInt& aCurrentStep ) const;
+
+        /**
+        * Updates zoom. This method should be called periodically during zooming.
+        * @return ETrue if zoom step was updated.
+        */
+        TBool UpdateZoomL();
+
+        /**
+        * Stops zoom. 
+        */
+        void StopZoom();
+
+    public: // Functions from base classes
+
+        /**
+        * From CCoeControl, handles key events.
+        * @param aKeyEvent key event.
+        * @param aType type of event.
+        * @return response indicating if key was consumed.
+        */
+        virtual TKeyResponse OfferKeyEventL(
+            const TKeyEvent& aKeyEvent,
+            TEventCode aType );
+
+        /**
+        * From CCoeControl, handles resource change.
+        * @param aType type of change.
+        */ 
+        virtual void HandleResourceChange(
+            TInt aType );
+
+    protected: // Functions from base classes
+
+        /**
+        * From CCoeControl, draws the control.
+        * @param aRect area to be drawn.
+        */
+        virtual void Draw( const TRect& aRect ) const;
+
+        /**
+        * From CCoeControl, handles size changes.
+        */
+        virtual void SizeChanged();
+
+        /**
+        * From CCoeControl, handles position changes.
+        */
+        virtual void PositionChanged();
+
+    private:
+
+        /**
+        * Calculates amount of steps to be shown.
+        * @param aFullSteps amount of full steps.
+        * @param aPartialStep partial steps, 0 .. 255.
+        */
+        void DetermineSteps(
+            TInt& aFullSteps,
+            TInt& aPartialStep ) const;
+
+        /**
+        * Generates zoom mask bitmap.
+        * @param aAreaBitmap maximum bitmap, ownership not transferred.
+        * @param aPartial partial amount.
+        * @param aRow area row number.
+        * @param aRowSize size of the row.
+        * @return ETrue if successful, EFalse otherwise.
+        */
+        TBool GenerateZoomMaskBitmap(
+            CFbsBitmap* aMaskBitmap,
+            const TInt aPartial,
+            const TInt aRow,
+            const TSize& aRowSize ) const;
+
+        /**
+        * Generates zoom mask bitmap.
+        * @param aAreaBitmap maximum bitmap, ownership not transferred.
+        * @param aPartial partial amount.
+        * @param aRow area row number.
+        * @param aRowSize size of the row.
+        */
+        void DoGenerateZoomMaskBitmap(
+            CFbsBitmap* aMaskBitmap,
+            const TInt aPartial,
+            const TInt aRow,
+            const TSize& aRowSize ) const;
+
+        /**
+        * Creates bitmaps.
+        * @return error code.
+        */
+        TInt CreateBitmaps();
+
+        /**
+        * Creates bitmaps.
+        */
+        void CreateBitmapsL();
+
+        /**
+        * Returns size of the temporary bitmaps.
+        * @return size of the temporary bitmaps.
+        */
+        TSize SizeOfBitmap() const;
+
+        /**
+        * Gets position and source rect.
+        * @param aPosition it will contain position.
+        * @param aSourceRect it will contain source rectangle.
+        * @param aZoomStep zoom step.
+        */
+        void GetPositionAndRect(
+            TPoint& aPosition,
+            TRect& aSourceRect,
+            const TInt aZoomStep ) const;
+
+    private:
+
+        // Inner class.
+        class CBitmap;
+
+        // Reference to bitmap manager.
+        CVtUiBitmapManager& iBitmapManager;
+
+        // Zoom direction bitmap identifier.
+        TVtUiBitmapPoolId iZoomDirId;
+
+        // Zoom area bitmap identifier.
+        TVtUiBitmapPoolId iZoomAreaId;
+
+        // Zoom min bitmap identifier.
+        TVtUiBitmapPoolId iZoomMinId;
+
+        // Zoom max bitmap identifier.
+        TVtUiBitmapPoolId iZoomMaxId;
+
+        // Zoom pane rectangle.
+        TRect iZoomPaneRect;
+
+        // Zoom direction layout.
+        TAknLayoutRect iZoomDirLayout;
+
+        // Zoom area layout.
+        TAknLayoutRect iZoomAreaLayout;
+
+        // Current step, 0 .. iMaxZoomStep.
+        TInt iCurrentZoomStep;
+        
+        // Maximum step.
+        TInt iMaxZoomStep;
+
+        // Used partial value used in iZoomMaskBitmap
+        // generation.
+        mutable TInt iZoomMaskPartial;
+
+        // Used row value used in iZoomMaskBitmap
+        // generation.
+        mutable TInt iZoomMaskRow;
+
+        // Owned partial soft mask.
+        CBitmap* iZoomPartialMask;
+        
+        // Owned partial shade (soft mask).
+        CBitmap* iZoomPartialShade;
+
+        // Owned partial shade mask.
+        CBitmap* iZoomPartialShadeMask;
+
+        // Zoom direction +1 or -1. 0 if no
+        // zoom ongoing.
+        TInt iZoomDirection;
+
+        // Zoom step at the start of zooming.
+        TInt iZoomStepStart;
+
+        // Start time of zooming.
+        TTime iZoomStartTime;
+
+    };
+
+#endif      // CVTUIZOOMCONTROL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/MVtUiEngineCommandManager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* 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:  Command manager class for Video Telephone application.
+*
+*/
+
+
+
+#ifndef MVTUICOMMANDMANAGER_H
+#define MVTUICOMMANDMANAGER_H
+
+//  INCLUDES
+#include    <e32base.h>
+
+// FORWARD DECLARATIONS
+class MVtEngCommandObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Command manager class for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class MVtUiEngineCommandManager
+    {
+    public: // New functions
+
+        /**
+        * Adds observer.
+        * @param aObserver observer to be added.
+        */
+        virtual void AddObserverL( MVtEngCommandObserver& aObserver ) = 0;
+
+        /**
+        * Removes observer.
+        * @param aObserver observer to be removed.
+        */
+        virtual void RemoveObserver( MVtEngCommandObserver& aObserver ) = 0;
+
+    };
+
+#endif      // MVTUICOMMANDMANAGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/MVtUiVideoWindow.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* 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:  Interface for controlling a video window
+*                for Video Telephone application.
+*
+*/
+
+
+
+#ifndef MVTUIVIDEOWINDOW_H
+#define MVTUIVIDEOWINDOW_H
+
+//  INCLUDES
+#include    <e32base.h>
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+/**
+*  Interface for controlling a video window (uplink / downlink) for Video
+*  Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class MVtUiVideoWindow
+    {
+    public: // New functions
+
+        /**
+        * Resets blind, stream bitmap and waiting image statuses.
+        */
+        virtual void Reset() = 0;
+
+        /**
+        * Changes blind status.
+        * @param aStatus new status, ETrue - on, EFalse - off.
+        */
+        virtual void SetBlind( TBool aStatus ) = 0;
+
+        /**
+        * Sets stream bitmap.
+        * @param aStreamBitmap bitmap. Ownership not transferred.
+        */
+        virtual void SetStreamBitmap( CFbsBitmap* aStreamBitmap ) = 0;
+
+        /**
+        * Sets stream bitmap for reserve, when Draw() routine is called.
+        * (e.g. when opening and closing menu)
+        * @param aStreamBitmap bitmap. Ownership not transferred.
+        */
+        virtual void SetStreamBitmapReserve( CFbsBitmap* aStreamBitmap ) = 0;
+
+        /**
+        * Sets waiting image status.
+        * @param aShowWaitingText ETrue if waiting text should be shown.
+        */
+        virtual void SetWaiting( TBool aShowWaitingText ) = 0;
+
+        /**
+        * Redraws image.
+        */
+        virtual void Redraw() = 0;
+        
+        /**
+         * Set remote video control 
+         */
+        virtual void SetRemoteVideoControl( CCoeControl* aRemoteControl ) = 0;
+        
+        /**
+         * Layout the postion and the size of the remote video control
+          */
+        virtual void LayoutRemoteVideo() = 0;    
+        
+        /**
+         * Returns pointer to remote video control  or NULL if no remote video control  is present.
+         */
+        virtual CCoeControl * RemoteVideoControl() = 0;
+                       
+    };
+
+#endif      // CVTUICONTEXTCONTROL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/TVtUiCallParameters.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* 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:  Call parameters class for Video Telephone application.
+*
+*/
+
+
+
+#ifndef TVTUICALLPARAMETERS_H
+#define TVTUICALLPARAMETERS_H
+
+//  INCLUDES
+#include    <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+*  Call parameters for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class TVtUiCallParameters
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        TVtUiCallParameters();
+
+    public: // New functions
+
+        /**
+        * Resets parameters.
+        */
+        void Reset();
+
+        /**
+        * Sets audio status.
+        * @param aEnabled ETrue if audio enabled, EFalse if disabled.
+        */
+        void SetAudioStatus( const TBool aEnabled );
+
+        /**
+        * Gets audio status.
+        * @param aEnabled It will equal to ETrue if audio enabled, 
+        *        EFalse if disabled.
+        * @return error code, 
+        *         KErrNone if audio status has been set,
+        *         KErrNotFound if not.
+        */
+        TInt GetAudioStatus( TBool& aEnabled ) const;
+
+        /**
+        * Sets video status.
+        * @param aEnabled enabled status.
+        */
+        void SetVideoStatus( const TBool aEnabled );
+
+        /**
+        * Gets video status.
+        * @param aEnabled It will equal to ETrue if video enabled, 
+        *        EFalse if disabled.
+        * @return error code, 
+        *         KErrNone if video status has been set,
+        *         KErrNotFound if not.
+        */
+        TInt GetVideoStatus( TBool& aEnabled );
+
+        /**
+        * Sets selected camera.
+        * @param aPrimary ETrue if primary, EFalse if secondary.
+        */
+        void SetSelectedCamera( const TBool aPrimary );
+
+        /**
+        * Gets selected camera.
+        * @param aPrimary It will equal to ETrue if primary has been selected,
+        *        EFalse if secondary.
+        * @return error code,
+        *         KErrNone if selected camera has been set,
+        *         KErrNotFound if not.
+        */
+        TInt GetSelectedCamera( TBool& aPrimary );
+
+    private:
+
+        // Current flags.
+        TInt iFlags;
+
+    };
+
+#endif      // TVTUICALLPARAMETERS_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/VideoTelephonyInternalCRKeys.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2005-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:  Video Telephony internal Central Repository keys
+*
+*/
+
+
+#ifndef VIDEOTELEPHONYINTERNALCRKEYS_H
+#define VIDEOTELEPHONYINTERNALCRKEYS_H
+
+#include <e32std.h>
+
+/**
+* Video Telephony Variation API
+* Keys under this category are used in defining video telephony variation.
+*/
+const TUid KCRUidVTVariation = {0x102072D0};
+
+/**
+* Video Telephony Local Variation Flags. Values are defined in 
+* VideoTelephonyVariant.hrh.
+*/
+const TUint32 KVTLocalVariationFlags = 0x00000001;
+
+/**
+* Video Telephony Configuration API
+* Keys under this category are used for configuring video call behaviour.
+* @since S60 3.1
+*/
+const TUid KCRUidVTConfiguration = {0x10281872};
+
+/**
+* This key controls minimum, normal and maximum frame rate for video encoder.
+* Integer values in the string are between 0 and 31 separated by space.
+* Example for key value is "5 10 5".
+*/
+const TUint32 KVTVideoFrameRates = 0x00000001;
+
+/**
+* Defines layout (screen orientation) used by Video Telephone application 
+* per active camera. Each camera has one of the following configurations:
+* 1) "LS" = Landscape
+* 2) "PR" = Portrait
+* 3) "OL" = Obey device layout (normal operation)
+* Camera values are:
+* 1) "C1" = VT primary camera (inwards)
+* 2) "C2" = VT secondary camera (outwards)
+*  Example value (portrait for cam1, landscape for cam2): C1:PR C2:LS
+*/
+const TUint32 KVTCameraLayout = 0x00000002;
+
+/**
+* Lists implementation UIDs for MPEG4, H.263 and H.264 encoders for video 
+* telephony in hexadecimal separated by space
+*/
+const TUint32 KVTVideoEncoderUIDs = 0x00000003;
+
+/**
+* Lists implementation UIDs for MPEG4, H.263 and H.264 decoders for video 
+* telephony in hexadecimal separated by space
+*/
+const TUint32 KVTVideoDecoderUIDs = 0x00000004;
+
+/**
+* Lists implementation UIDs for AMR-NB and future audio encoders for video
+* telephony (in hex, separated by space)
+*/
+const TUint32 KVTAudioEncoderUIDs = 0x00000005;
+
+/**
+* Lists implementation UIDs for AMR-NB and future audio decoders for video 
+* telephony (in hex, separated by space)
+*/
+const TUint32 KVTAudioDecoderUIDs = 0x00000006;
+                                               
+/**
+* Lists processing delay for MPEG4, H.263 and H.264 encoders for video 
+* telephony in unsigned 32-bit integers separated by space
+*/
+const TUint32 KVTVideoEncoderDelay = 0x00000007;
+
+/**
+* Lists processing delay for MPEG4, H.263 and H.264 decoders for video 
+* telephony in unsigned 32-bit integers separated by space
+*/
+const TUint32 KVTVideoDecoderDelay = 0x00000008;
+
+/**
+* Lists processing delay for AMR-NB and future audio encoders for video
+* telephony (in unsigned 32-bit integers, separated by space)
+*/
+const TUint32 KVTAudioEncoderDelay = 0x00000009;
+
+/**
+* Lists processing delay for AMR-NB and future audio decoders for video 
+* telephony (in unsigned 32-bit integers, separated by space)
+*/
+const TUint32 KVTAudioDecoderDelay = 0x0000000A;
+
+/*
+* Defines number of toolbar buttons. Three buttons is minimum
+* and seven is maximum.
+*/
+const TUint32 KVTToolbarCommands  = 0x0000000B;
+
+#endif      // VIDEOTELEPHONYINTERNALCRKEYS_H
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/VideoTelephonyVariant.hrh	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2005 - 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:  Bit flag definitions for VT local variation.
+*
+*/
+
+
+#ifndef VIDEOTELEPHONYVARIANT_HRH
+#define VIDEOTELEPHONYVARIANT_HRH
+
+
+/**
+* KVTLVFlagScalingMethodENearest defines whether the video image is
+* scaled using Nearest algorithm, which is fast, but quality is low.
+* When the flag is set ENearest is used.
+* @since S60 v2.8
+*/
+#define KVTLVFlagScalingMethodENearest 0x00000001
+
+/**
+* KVTLVFlagScalingMethodEBilinear defines whether the video image is
+* scaled using Bilinear algorithm, which offers the best quality, but in a
+* slow way. When the flag is set Bilinear is used.
+* @since S60 v2.8
+*/
+#define KVTLVFlagScalingMethodEBilinear 0x00000002
+
+/**
+* KVTLVFlagEnableBitReversal defines if bit order should be
+* reversed in PV.
+* When the flag is set bit order is reversed.
+*/
+#define KVTLVFlagEnableBitReversal 0x00000004
+
+/**
+* KVTLVFlagEnableAMR_WB defines if AMR wideband is supported in video calls.
+* @since S60 v5.0
+*/
+#define KVTLVFlagEnableAMR_WB 0x00000008
+
+/**
+* KVTLVFlagSupportMpeg4 defines whether the PV should support Mepg4.
+* @since S60 v5.0
+*/
+#define KVTLVFlagDisableMpeg4 0x00000010
+
+#endif // VIDEOTELEPHONYVARIANT_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/VtUiLayout.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2004, 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:  Layout related accessory methods for Video Telephone
+*                application.
+*
+*/
+
+
+
+#ifndef VTUILAYOUT_H
+#define VTUILAYOUT_H
+
+//  INCLUDES
+#include    "videotelui.hrh"
+#include    <e32base.h>
+#include    <aknutils.h>
+
+// FORWARD DECLARATIONS
+class TAknsItemID;
+
+// CLASS DECLARATION
+
+/**
+*  Layout related accessory methods for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class VtUiLayout
+    {
+    public: // New functions
+
+        /**
+        * Returns application window rectangle.
+        * @param aRect rectangle to be filled.
+        */
+        static void GetApplicationParentRect(
+            TRect& aRect );
+
+        // ELEMENTS RELATIVE TO APPLICATION WINDOW:
+
+        /**
+        * Returns main pane layout.
+        * @param aLayout main pane layout.
+        */
+        static void GetMainPaneLayout(
+            TAknWindowLineLayout& aLayout );
+
+        // ELEMENTS RELATIVE TO APPLICATION WINDOW:
+
+        /**
+        * Returns layout for uplink video stream background.
+        * @param aLayout layout of qgn_graf_call_video_out_bg.
+        */
+        static void GetFirstWindowBackgroundLayout(
+            TAknWindowLineLayout& aLayout );
+
+        /**
+        * Returns layout for uplink video stream.
+        * @param aLayout layout of uplink video stream relative.
+        */
+        static void GetFirstWindowStreamLayout(
+            TAknWindowLineLayout& aLayout );
+
+        /**
+        * Returns layout of uplink video disabled icon.
+        * @param aLayout layout of qgn_indi_call_video_blind_out.
+        */
+        static void GetFirstWindowStreamDisabledIconLayout(
+            TAknWindowLineLayout& aLayout );
+
+        // ELEMENTS RELATIVE TO MAIN PANE:
+
+        /**
+        * Returns layout of background rectangle.
+        * @param aLayout layout of background rectangle.
+        */
+        static void GetSecondWindowBackgroundLayout(
+            TAknWindowLineLayout& aLayout );
+
+        /**
+        * Returns layout of downlink video stream.
+        * @param aLayout layout of downlink video stream.
+        * @param aUseSQCif ETrue if SQCIF layout is to be used.
+        */
+        static void GetSecondWindowStreamLayout(
+            TAknWindowLineLayout& aLayout,
+            TBool aIsToolbar,
+            TBool aIsSubQCIF = EFalse );
+
+        /**
+        * Returns layout of downlink video stream (the whole picture).
+        * @param aLayout layout of downlink video stream.
+        * @param aUseSQCif ETrue if SQCIF layout is to be used.
+        */
+        static void GetSecondWindowStreamWholeLayout(
+            TAknWindowLineLayout& aLayout,
+            TBool aIsToolbaraIsToolbar,
+            TBool aIsSubQCIF = EFalse );
+
+        /**
+        * Returns layout of downlink video disabled icon.
+        * @param aLayout layout of qgn_indi_call_video_blind_in.
+        */
+        static void GetSecondWindowDisabledIconLayout(
+            TAknWindowLineLayout& aLayout );
+
+        /**
+        * Returns layout of waiting text.
+        * @param aLayout layout.
+        * @param aFirstLine ETrue if first line, EFalse if second.
+        */
+        static void GetSecondWindowWaitingTextLayout(
+            TAknTextLineLayout& aLayout,
+            const TBool aFirstLine );
+
+        /**
+        * Returns number entry area layout.
+        * @param aLayout layout.
+        */
+        static void GetNumberEntryAreaLayout(
+            TAknWindowLineLayout& aLayout );
+
+        // ELEMENTS RELATIVE TO NAVI PANE:
+
+        /**
+        * Returns layout of audio routing indicator.
+        * @param aLayoutlayout of qgn_indi_<ref>_[muted].
+        */
+        static void GetAudioRoutingIconLayout(
+            TAknWindowLineLayout& aLayout );
+
+        /**
+        * Returns layout of call duration text.
+        * @param aLayout layout of call duration text.
+        */
+        static void GetCallDurationTextLayout(
+            TAknTextLineLayout& aLayout );
+
+        /**
+        * Returns layout of muted text.
+        * @param aLayout layout of muted text.
+        */
+        static void GetMutedTextLayout(
+            TAknTextLineLayout& aLayout );
+
+        /**
+        * Gets zooming pane layout.
+        * @param aLayout layout of zooming pane.
+        */
+        static void GetZoomPaneLayout(
+            TAknWindowLineLayout& aLayout );
+
+        // ELEMENTS RELATIVE TO ZOOMING PANE:
+
+        /**
+        * Gets zoom direction icon layout.
+        * @param aLayout layout of zoom direction icon.
+        */
+        static void GetZoomDirLayout(
+            TAknWindowLineLayout& aLayout );
+
+        /**
+        * Gets zoom area layout.
+        * @param aLayout layout of zoom area.
+        */
+        static void GetZoomAreaLayout(
+            TAknWindowLineLayout& aLayout );
+
+        /**
+        * Gets zoom step layout.
+        * @param aLayout layout of a zoom step.
+        * @param aZoomStep zoom step, 1 .. 11.
+        */
+        static void GetZoomStepLayout(
+            TAknWindowLineLayout& aLayout,
+            TInt aZoomStep );
+
+        // OTHER UTILITY METHODS
+
+        /**
+        * Returns skin identifier corresponding to the bitmap.
+        *
+        * @param aId identifier of the bitmap.
+        * @return skin identifier or KAknsIIDNone if no skin for this bitmap.
+        */
+        static TAknsItemID MapBitmapToSkinId( TVtUiBitmapId aId );
+
+        /**
+        * Determines color skin identifier corresponding to the bitmap.
+        *
+        * @param aId bitmap identifier.
+        * @param aColorId it will contain color skin id.
+        * @param aColorIndex it will contain color index.
+        * @return ETrue if bitmap has color skin, EFalse otherwise.
+        */
+        static TBool MapBitmapToColorId(
+            TVtUiBitmapId aId,
+            TAknsItemID& aColorId,
+            TInt& aColorIndex );
+
+        /**
+        * Resolves file name and index from bitmap identifier.
+        * @param aId bitmap identifier.
+        * @param aFileName it will contain the name of the file.
+        * @param aIndex it will contain the index.
+        */
+        static void Resolve(
+            TVtUiBitmapId aId,
+            TFileName& aFileName,
+            TInt& aIndex );
+
+        /**
+        * Can be used for checking current orientation.
+        * @return ETrue if current application orientation is landscape,
+        * EFalse otherwise.
+        */
+        static TBool IsLandscapeOrientation();
+
+    };
+
+#endif      // VTUILAYOUT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/VtUiPanic.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* 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:  Panic methods and reasons for Video Telephone application.
+*
+*/
+
+
+
+#ifndef VTUIPANIC_H
+#define VTUIPANIC_H
+
+//  INCLUDES
+#include    <e32base.h>
+
+// DATA TYPES
+
+/**
+* Enumerates all panic reasons.
+*/
+enum TVtUiPanicReason
+    {
+    // Invalid index passed to VtUiLayout::Resolve.
+    EVtUiPanicInvalidBitmapId = 10,
+    // Invalid bitmap file in VtUiLayout::Resolve.
+    EVtUiPanicInvalidBitmapFile = 11,
+    // Reset must not fail.
+    EVtUiPanicResetFailed = 12,
+    // Communication not supported.
+    EVtUiPanicCommsNotSupported = 13,
+    // EIKON server handle not found.
+    EVtUiPanicEikonServerNotFound = 14,
+    // Prepare view finder not supported.
+    EVtUiPanicPrepareViewFinderNotSupported = 15,
+    // Prepare remote render not supported.
+    EVtUiPanicPrepareRemoteRenderNotSupported = 16,
+    // Mismatch in bitmap file names.
+    EVtUiPanicMismatchInBitmapFileNames = 17,
+    // Default color requirement mismatch.
+    EVtUiPanicDefaultColorRequireMismatch = 18,
+    // Application shutdown has timeouted.
+    EVtUiPanicApplicationShutdownTimeout = 100,
+    // Engine functionality does not match with required.
+    EVtUiPanicEngineFunctionalityAssert = 101,
+    // Renderer instance is not available
+    EVtUiPanicRendererNotFound = 200,
+    // Values out of range
+    EVtUiPanicOutOfRange = 300
+    };
+
+// CLASS DECLARATION
+
+/**
+*  Panic methods and reasons for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class VtUiPanic
+    {
+    public: // New functions
+
+        /**
+        * Panics this process.
+        * @param aReason reason of panic.
+        */
+        static void Panic(
+            TVtUiPanicReason aReason );
+
+    };
+
+#endif      // VTUIPANIC_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/VtUiUtility.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* 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:  Utility methods for Video Telephone application.
+*
+*/
+
+
+
+#ifndef VTUIUTILITY_H
+#define VTUIUTILITY_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <mvtengaudio.h>
+#include    <mvtengmedia.h>
+#include    <w32std.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Utility methods for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class VtUiUtility
+    {
+    public: // New functions
+
+        /**
+        * Enumerates audio routing masks.
+        */
+        enum TAudioRoutingMask
+            {
+            // Deactivate loudspeaker.
+            EDeactivateLoudspeaker = (1<<0),
+            // Activate loudspeaker.
+            EActivateLoudspeaker = (1<<1),
+            // Deactivate BT handsfree.
+            EDeactivateBtHandsfree = (1<<2),
+            // Activate BT handsfree.
+            EActivateBtHandsfree = (1<<3)
+            };
+
+        /**
+        * Gets audio routing availabilities.
+        * @param aAudio audio instance.
+        * @param aAvailable availability bitmap.
+        */
+        static void GetAudioRoutingAvailability( 
+            MVtEngAudio& aAudio,
+            TInt& aAvailable );
+
+        /**
+        * Gets outgoing media state.
+        * @param aMedia media instance.
+        * @param aAvailable availability bitmap.
+        */
+        static void GetOutgoingMediaState(
+            MVtEngMedia& aMedia,
+            TInt& aAvailable );
+
+        /**
+        * Gets incoming media state.
+        * @param aMedia media instance.
+        * @param aAvailable availability bitmap.
+        */
+        static void GetIncomingMediaState(
+            MVtEngMedia& aMedia,
+            TInt& aAvailable );
+
+        /**
+        * Checks if media has still image.
+        * @param aMedia media instance.
+        * @return ETrue if media has still image.
+        */
+        static TBool HasStillImage(
+            MVtEngMedia& aMedia );
+
+        /**
+        * Gets freeze's current status.
+        * @param aMedia media instance.
+        * @return  ETrue if active provider is frozen, EFalse otherwise.
+        */
+        static TBool GetFreezeState( 
+            MVtEngMedia& aMedia );	
+				
+        /**
+        * Checks if freeze is supported.
+        * @param aMedia media instance.
+        * @return ETrue if freeze is supported.
+        */
+        static TBool IsFreezeSupported(
+            MVtEngMedia& aMedia );
+	
+        /**
+        * Gets current local video quality setting.
+        * @param aMedia media instance. 
+        * @param aVideoQuality Current local video quality settings.
+        */
+        static void GetVideoQuality( 
+            MVtEngMedia& aMedia,
+            MVtEngMedia::TVideoQuality& aVideoQuality );
+        /**
+        * Gets current object sharing state.
+        * @param aMedia media instance.
+        * @param aShareObjectState contains current object sharing state on
+        * return.
+        */
+        static void GetObjectSharingState( MVtEngMedia& aMedia,
+            MVtEngMedia::TShareObjectState& aShareObjectState );
+        
+        /**
+        * Checks if zooming is allowed.
+        * @param aMedia media instance.
+        * @return ETrue if allowed, EFalse otherwise.
+        */
+        static TBool IsZoomAllowed(
+            MVtEngMedia& aMedia );
+
+        /**
+        * Checks if the device has cameras currently attached.
+        * @param aMedia media instance.
+        * @return ETrue if there are cameras available.
+        */
+        static TBool HasCameras( MVtEngMedia& aMedia );
+
+        /**
+        * Checks if the key event is DTMF enabled.
+        * @param aKeyEvent The key event.
+        * @param aDtmfTone DTMF tone character.
+        * @return ETrue if this event is DTMF event.
+        */
+        static TBool IsDTMFEvent( const TKeyEvent& aKeyEvent,
+            TChar& aDtmfTone );
+
+        /**
+        * Checks if the character is DTMF enabled.
+        * @param aChar The character.
+        * @return ETrue if this character is DTMF character.
+        */
+        static TBool IsDTMFCharacter( const TChar aChar );
+
+    private:
+
+        /**
+        * Checks if audio routing is available.
+        * @param aAudio audio instance.
+        * @param aCurrent current speaker.
+        * @param aSource source speaker.
+        * @param aTarget target speaker.
+        */
+        static TBool IsAudioRoutingAvailable(
+            MVtEngAudio& aAudio,
+            const MVtEngAudio::TAudioRoutingState aCurrent,
+            const MVtEngAudio::TAudioRoutingState aSource,
+            const MVtEngAudio::TAudioRoutingState aTarget );
+
+    };
+
+#endif      // VTUIUTILITY_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicmdbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* 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:  UI command bases class definition.
+*
+*/
+
+
+#ifndef C_VTUICMDBASE_H
+#define C_VTUICMDBASE_H
+
+#include <e32base.h>
+
+/**
+ *  CVtUiCmdBase
+ *
+ *  Base class for UI commands.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiCmdBase ) : public CBase
+    {
+
+public: // public methods
+
+    /**
+     * Returns command id.
+     *
+     * @return This command's id.
+     */
+    TInt CommandId() const;
+
+public: // public abstract methods
+
+    /**
+     * Execute command
+     *
+     */
+    virtual void HandleL() = 0;
+
+    /**
+     * Returns ETrue if command is enabled.
+     *
+     * @return ETrue if this command is enabled (can be executed), EFalse
+     * otherwise.
+     */
+    virtual TBool IsEnabled() const = 0;
+
+public: // public static methods
+
+    /**
+     * Key comparing function type definition.
+     */
+    typedef TInt ( *TKeyOrder ) ( const TInt*, const CVtUiCmdBase& );
+
+    /**
+     * Returns linear order object for ordered array inserting.
+     *
+     * @return TLinearOrder instance for searching and inserting CVtUiCmdBase
+     * based objects into RArray.
+     */
+    static TLinearOrder< CVtUiCmdBase > LinearOrder();
+
+    /**
+     * Returns linear order object for ordered array inserting.
+     *
+     * @return Pointer to key comparaing function, that can be used in
+     * FindInOrder() method call.
+     */
+    static TKeyOrder KeyOrder();
+
+protected:
+
+    /**
+     * C++ constructor.
+     *
+     * @aCommandId Id of this command.
+     *
+     */
+    CVtUiCmdBase( TInt aCommandId );
+
+protected:
+
+    // Command id
+    const TInt iCommandId;
+
+    };
+
+#endif // C_VTUICMDBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicmdcontext.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* 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:  Command context base class definition.
+*
+*/
+
+
+#ifndef C_VTUICMDCONTEXT_H
+#define C_VTUICMDCONTEXT_H
+
+#include <e32base.h>
+
+#include "tvtuicmdcontexttype.h"
+
+class CVtUiCmdValidatorBase;
+class CVtUiCmdValidationActionBase;
+class MVtUiCommandManager;
+class CVtUiCmdCustomValidationActionBase;
+
+/**
+ *  CVtUiCmdContext
+ *
+ *  Command context base class. This class defines context in which commands
+ *  will be validated.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiCmdContext ) : public CBase
+    {
+
+public: // public methods
+
+    /**
+     * C++ destructor.
+     */
+    ~CVtUiCmdContext();
+
+    /**
+     * Returns reference priority.
+     *
+     * @return Validator priority.
+     */
+     TInt ReferencePriority() const;
+
+    /**
+     * Returns context type.
+     *
+     * @return Context type.
+     */
+     TVtUiCmdContextType ContextType() const;
+
+    /**
+     * Adds validator to context.
+     *
+     * @param aValidator Validator reference to be added into this context.
+     * @return KErrNone if validator supports this context and adding succeeded.
+     * KErrNotSupported if validator does not support this context.
+     * Other system wide error code that may happen during add.
+     */
+    TInt AddValidator( CVtUiCmdValidatorBase& aValidator );
+
+    /**
+     * Removes validator to context.
+     *
+     * @param aValidator Constant validator reference to be removed from this
+     * context.
+     * @return Validator priority.
+     */
+    void RemoveValidator( const CVtUiCmdValidatorBase& aValidator );
+
+public: // pure virtual methods
+
+    /**
+     * Do validation.
+     *
+     * @param aAction Action to be validated.
+     */
+    virtual void ValidateL( CVtUiCmdValidationActionBase& aAction ) = 0;
+
+protected:
+
+    /**
+     * C++ constructor
+     */
+    CVtUiCmdContext( MVtUiCommandManager& aCommandManager,
+        TVtUiCmdContextType aCtxType, TInt aReferencePriority );
+
+    /**
+     * Validates menu items.
+    */
+    void ValidateMenuItemsL( CVtUiCmdValidationActionBase& aAction );
+
+    /**
+     * Validates softkey items.
+    */
+    void ValidateSoftkeyItemsL( CVtUiCmdValidationActionBase& aAction );
+
+    /**
+     * Validates toolbar items.
+    */
+    void ValidateToolbarItemsL( CVtUiCmdValidationActionBase& aAction );
+
+    /**
+     * Custom action validation.
+    */
+    void CustomValidationL( CVtUiCmdCustomValidationActionBase& aAction );
+
+    /**
+     * Registers command context to command policy manager.
+     */
+    void RegisterCommandContextL();
+
+    /**
+     * Unregisters command context from command policy manager.
+     */
+    void UnregisterCommandContext();
+
+protected: // data
+
+    // Reference to policy manager (for cleanup)
+    MVtUiCommandManager& iCommandManager;
+
+private: // data
+
+    // Validator list (ordered by priority)
+    RPointerArray< CVtUiCmdValidatorBase > iValidators;
+
+    // Validator priority
+    const TInt iReferencePriority;
+
+    // Context type.
+    const TVtUiCmdContextType iContextType;
+
+    };
+
+#endif // C_VTUICMDCONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicmdcustomvalidationactionbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* 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:  Custom command validation action class definition.
+*
+*/
+
+
+#ifndef C_VTUICMDCUSTOMVALIDATIONACTIONBASE_H
+#define C_VTUICMDCUSTOMVALIDATIONACTIONBASE_H
+
+#include <e32base.h>
+
+#include "cvtuicmdvalidationactionbase.h"
+
+/**
+ *  CVtUiCmdCustomValidationActionBase
+ *
+ *  Custom command validation action base class. This class is an extension to
+ *  command validation action and defines new attribute Type ID that is used
+ *  for defining type of the custom validation action.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiCmdCustomValidationActionBase )
+    : public CVtUiCmdValidationActionBase
+    {
+
+public: // typedefs
+
+    // Custom type id type definition.
+    typedef TInt TCustomTypeId;
+
+public:
+
+    /**
+     * Returns custom type id.
+     * @return Custom type id.
+     */
+    TCustomTypeId CustomTypeId() const;
+
+protected: // new protected methods
+
+    /**
+     * C++ constructor.
+     */
+    CVtUiCmdCustomValidationActionBase( TCustomTypeId aCustomTypeId );
+
+private: // data
+
+    // Custom type id.
+    const TCustomTypeId iCustomTypeId;
+
+    };
+
+#endif // C_VTUICMDCUSTOMVALIDATIONACTIONBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicmdstatecheckaction.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* 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:  Command state check action.
+*
+*/
+
+
+#ifndef C_VTUICMDSTATECHECKACTION_H
+#define C_VTUICMDSTATECHECKACTION_H
+
+#include "cvtuicmdcustomvalidationactionbase.h"
+
+/**
+ *  CVtUiCmdStateCheckAction
+ *
+ *  Custom validation action that concludes whether or not a command is allowed.
+ *  Command validness is checked from its current state.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiCmdStateCheckAction )
+: public CVtUiCmdCustomValidationActionBase
+    {
+
+public:
+
+    /**
+     * Static constructor.
+     *
+     * @return Pointer to newly created instance of CVtUiCmdStateCheckAction.
+     */
+    static CVtUiCmdStateCheckAction* NewL();
+
+    /**
+     * Sets command to be checked.
+     *
+     * @param aCommandId Id of command to be checked.
+     */
+    void SetCommand( TInt aCommandId );
+
+    /**
+     * Sets command to be checked.
+     *
+     * @return ETrue is command set with SetCommand() is allowed to be
+     * executed.
+     */
+    TBool IsCommandAllowed() const;
+
+public: // from CVtUiCmdValidationActionBase
+
+    /**
+     * @see CVtUiCmdValidationActionBase::ProcessL
+     */
+    void ProcessL( const MVtUiCmdValidatorCallBack& aCallBack );
+
+private:
+
+    /**
+     * C++ constructor.
+     */
+    CVtUiCmdStateCheckAction();
+
+private: // data
+
+    // Id of command to be checked
+    TInt iCommandId;
+
+    // ETrue if command defined by iCommandId is allowed
+    TBool iIsCommandAllowed;
+
+    };
+
+#endif // C_VTUICMDSTATECHECKACTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicmdvalidationactionbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* 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:  Command validation action base class definition.
+*
+*/
+
+
+#ifndef C_VTUICMDVALIDATIONACTIONBASE_H
+#define C_VTUICMDVALIDATIONACTIONBASE_H
+
+#include <e32base.h>
+
+class CVtUiCmdValidatorBase;
+class MVtUiCmdValidatorCallBack;
+
+/**
+ *  CVtUiCmdValidationActionBase
+ *
+ *  Command validation action base class.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiCmdValidationActionBase ) : public CBase
+    {
+
+public: // public methods
+
+    /**
+     * C++ destructor.
+     */
+    ~CVtUiCmdValidationActionBase();
+
+    /**
+     * Called when validation process is about to begin. Resets internal
+     * variables.
+     */
+    virtual void BeginProcess();
+
+    /**
+     * Called when validation process has finished.
+     */
+    virtual void EndProcess();
+
+public: // pure virtual methods
+
+    /**
+     * Execute validation process.
+     *
+     * @param aCallBack Action validation callback routine that will be called
+     * for every item to be validated.
+     */
+    virtual void ProcessL( const MVtUiCmdValidatorCallBack& aCallBack ) = 0;
+
+protected:
+
+    /**
+     * Mark command handled.
+     *
+     * @param aCommandId Id of command that was handled.
+     */
+    void CommandHandledL( TInt aCommandId );
+
+    /**
+     * Check whether command is already handled or not.
+     *
+     * @param aCommandId Id of command to be checked.
+     * @return ETrue if command was already handler, EFalse otherwise.
+     */
+    TBool IsCommandHandled( TInt aCommandId ) const;
+
+private: // data
+
+    // Array of handled commands.
+    RArray< TInt > iHandledCommands;
+
+    };
+
+#endif // C_VTUICMDVALIDATIONACTIONBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicmdvalidatorbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* 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:  Base class for command validators.
+*
+*/
+
+
+#ifndef C_VTUICMDVALIDATORBASE_H
+#define C_VTUICMDVALIDATORBASE_H
+
+#include <e32base.h>
+
+#include "tvtuicmdcontexttype.h"
+
+class CVtUiCmdValidationActionBase;
+class CVtUiCmdCustomValidationActionBase;
+
+/**
+ *  CVtUiCmdValidatorBase
+ *
+ *  Base class for all validators. Validator implementations validate commands
+ *  and other properties (like softkey resource IDs) on context basis. E.g.
+ *  primary validator will validate commands in all contexts, while toolbar
+ *  validator will do fine tuning for commands only in menu context, so that
+ *  commands that are visible in toolbar are not shown in menu.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiCmdValidatorBase ) : public CBase
+    {
+
+public: // public methods
+
+    /**
+     * Returns validator priority.
+     *
+     * @return Validator priority.
+     */
+    TInt Priority() const;
+
+public: // pure virtual methods
+
+    /**
+     * Validates menu items.
+     *
+     * @param aAction Reference to validation action.
+     * @param aReferencePriority Context reference priority.
+     */
+    virtual void ValidateMenuItemsL( CVtUiCmdValidationActionBase& aAction,
+        TInt aReferencePriority ) = 0;
+
+    /**
+     * Validates softkey items.
+     *
+     * @param aAction Reference to validation action.
+     * @param aReferencePriority Context reference priority.
+     */
+    virtual void ValidateSoftkeyItemsL( CVtUiCmdValidationActionBase& aAction,
+        TInt aReferencePriority ) = 0;
+
+    /**
+     * Validates toolbar items.
+     *
+     * @param aAction Reference to validation action.
+     * @param aReferencePriority Context reference priority.
+     */
+    virtual void ValidateToolbarItemsL( CVtUiCmdValidationActionBase& aAction,
+        TInt aReferencePriority ) = 0;
+
+    /**
+     * Custom validation.
+     *
+     * @param aAction Reference to custom validation action.
+     * @param aReferencePriority Context reference priority.
+     */
+    virtual void CustomValidationL( CVtUiCmdCustomValidationActionBase& aAction,
+        TInt aReferencePriority ) = 0;
+
+    /**
+     * Query for context validation.
+     *
+     * @param aCtxType Command context type.
+     * @return ETrue if this instance validates given context type, EFalse
+     * otherwise.
+     */
+    virtual TBool ValidatesContext( const TVtUiCmdContextType& aCtxType )
+        const = 0;
+
+protected:
+
+    /**
+     * C++ constructor
+     *
+     * @param aPriority Validator priority.
+     */
+    CVtUiCmdValidatorBase( TInt aPriority );
+
+private: // data
+
+    // Validator priority
+    const TInt iPriority;
+
+    };
+
+#endif // C_VTUICMDVALIDATORBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicommandmanager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* 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:  Command manager class definition.
+*
+*/
+
+
+#ifndef C_VTUICOMMANDMANAGER_H
+#define C_VTUICOMMANDMANAGER_H
+
+#include "mvtuicommandmanager.h"
+#include "mvtuicommandui.h"
+#include "tvtuilocalvariation.h"
+#include "CVtUiAppUi.h"
+
+class TVtUiStates;
+class CVtUiCommandPolicyManager;
+class CVtUiPrimaryCmdPolicy;
+class CVtUiCmdStateCheckAction;
+class CVtUiExecutionContext;
+
+/**
+ * CVtUiCommandManager
+ *
+ * Acts as a proxy for Command UIs and Validators.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiCommandManager ) : public CBase,
+    public MVtUiCommandManager, public MVtUiCommandUi
+    {
+
+public:
+
+    /**
+    * Static constructor.
+    *
+    * @param aUiStates Constant reference to UI states object.
+    */
+    static CVtUiCommandManager* NewL( const TVtUiStates& aUiStates,
+        CVtUiAppUi& aAppUi );
+
+    /**
+    * Destructor.
+    */
+    ~CVtUiCommandManager();
+
+public:
+
+    /**
+     * Constant reference to UI states.
+     *
+     * @return Constant reference to UI states object.
+     */
+    const TVtUiStates& UiStates() const;
+
+    /**
+     * Constant reference to VT local variation.
+     *
+     * @return Constant reference to VT local variation object.
+     */
+    const TVtUiVideoTelephonyVariation& VideoTelephonyVariation() const;
+
+    /**
+     * Handles command.
+     *
+     * @param aCommandId Id of command to be handled. If given command is not
+     * found, command will be silently ignored.
+     */
+    void HandleCommandL( TInt aCommandId );
+
+    /**
+     * Constant reference to CVtUiAppUi states.
+     *
+     * @return Constant reference to UI states object.
+     */
+    const CVtUiAppUi& AppUi() const;
+    
+
+public: // from MVtUiCommandManager
+
+    /**
+     * @see MVtUiCommandManager::AddCommandUi
+     */
+    TInt AddCommandUi( MVtUiCommandUi& aCommandUi );
+
+    /**
+     * @see MVtUiCommandManager::RemoveCommandUi
+     */
+    void RemoveCommandUi( MVtUiCommandUi& aCommandUi );
+
+    /**
+     * @see MVtUiCommandManager::ValidateMenuItemsL
+     */
+    void ValidateMenuItemsL( CVtUiCmdValidationActionBase& aAction );
+
+    /**
+     * @see MVtUiCommandManager::ValidateSoftkeyItemsL
+     */
+    void ValidateSoftkeyItemsL( CVtUiCmdValidationActionBase& aAction );
+
+    /**
+     * @see MVtUiCommandManager::ValidateToolbarItemsL
+     */
+    void ValidateToolbarItemsL( CVtUiCmdValidationActionBase& aAction );
+
+    /**
+     * @see MVtUiCommandManager::IsCommandAllowedL
+     */
+    TBool IsCommandAllowedL( TInt aCommandId );
+
+    /**
+     * @see MVtUiCommandManager::RegisterCommandContext
+     */
+    TInt RegisterCommandContext( CVtUiCmdContext& aContext );
+
+    /**
+     * @see MVtUiCommandManager::UnregisterCommandContext
+     */
+    void UnregisterCommandContext( CVtUiCmdContext& aContext );
+
+    /**
+     * @see MVtUiCommandManager::AddValidator
+     */
+    TInt AddValidator( CVtUiCmdValidatorBase& aValidator );
+
+    /**
+     * @see MVtUiCommandManager::RemoveValidator
+     */
+    void RemoveValidator( CVtUiCmdValidatorBase& aValidator );
+
+    /**
+     * @see MVtUiCommandManager::RefreshL
+     */
+    void RefreshL();
+
+    /**
+     * @see MVtUiCommandManager::AddCommandModifier
+     */
+    TInt AddCommandModifier( CVtUiCommandModifyBase& aModifier );
+
+    /**
+     * @see MVtUiCommandManager::RemoveCommandModifier
+     */
+    void RemoveCommandModifier( CVtUiCommandModifyBase& aModifier );
+
+    /**
+     * @see MVtUiCommandManager::RegisterCommandL
+     */
+    void RegisterCommandL( CVtUiCmdBase& aCommand );
+
+    /**
+     * @see MVtUiCommandManager::UnregisterCommand
+     */
+    void UnregisterCommand( const CVtUiCmdBase& aCommand );
+
+private:
+
+    /**
+    * Constructor.
+    */
+    CVtUiCommandManager( const TVtUiStates& aUiStates, CVtUiAppUi& aAppUi );
+
+    /**
+    * Symbian OS constructor.
+    * @param aModel Engine model.
+    */
+    void ConstructL();
+
+    /**
+     * Called when a new command modifier is added
+     */
+    TInt CommandModifierAdded( CVtUiCommandModifyBase& aModifier );
+
+    /**
+     * Called when a command modifier is removed
+     */
+    void CommandModifierRemoved( CVtUiCommandModifyBase& aModifier );
+
+    /**
+     * Called when a new command ui is added
+     */
+    TInt CommandUiAdded( MVtUiCommandUi& aCommandUi );
+
+    /**
+     * Called when a command ui is removed
+     */
+    void CommandUiRemoved( MVtUiCommandUi& aCommandUi );
+
+private:
+
+    // Commands Uis
+    RPointerArray< MVtUiCommandUi > iCommandUis;
+
+    // Command modifiers
+    RPointerArray< CVtUiCommandModifyBase > iCommandModifiers;
+
+    // Registered commands
+    RPointerArray< CVtUiCmdBase > iCommands;
+
+    // Command policy manager instance
+    CVtUiCommandPolicyManager* iCmdPolicyMgr;
+
+    // Reference to UI states instance
+    const TVtUiStates& iUiStates;
+
+    // Reference to VT local variation
+    TVtUiVideoTelephonyVariation iVtVariation;
+
+    // Command state validation action
+    CVtUiCmdStateCheckAction* iCmdStateCheckAction;
+
+    // Execution context (for command state validation)
+    CVtUiExecutionContext* iExecutionContext;
+
+    // Reference to appui
+    const CVtUiAppUi& iAppUi;
+    };
+
+#endif // C_VTUICOMMANDMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicommandmodifybase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* 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:  Command modifier base class definition.
+*
+*/
+
+
+#ifndef C_VTUICOMMANDMODIFYBASE_H
+#define C_VTUICOMMANDMODIFYBASE_H
+
+#include <e32base.h>
+
+#include "mvtuicommandsetting.h"
+
+/**
+ *  CVtUiCommandModifyBase
+ *
+ *  Command modifier base class. Command modifiers can be used for modifying
+ *  different command sets. E.g. in toolbar and number entry a command modifiers
+ *  are being used for modifying softkeys.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiCommandModifyBase ) : public CBase
+    {
+
+public: // static methods
+
+    /**
+     * Returns TLinearOrder<> for priority ordering.
+     */
+    static TLinearOrder< CVtUiCommandModifyBase > PriorityOrder();
+
+private: // static methods
+
+    /**
+     * Priority ordering function.
+     */
+    static TInt PriorityOrderFunc( const CVtUiCommandModifyBase& aM1,
+        const CVtUiCommandModifyBase& aM2 );
+
+public: // pure virtual methods
+
+    /**
+     * Modifies command set.
+     */
+    virtual void ModifyCommandsL( MVtUiCommandSetting& aCommandSettings ) = 0;
+
+    /**
+     * Returns ETrue if this modifier supports given command set type.
+     */
+    virtual TBool Supports( MVtUiCommandSetting::Type aType ) const = 0;
+
+protected:
+
+    /**
+     * Constructor
+     */
+    CVtUiCommandModifyBase( TInt aPriority );
+
+private:
+
+    // Modifier priority
+    const TInt iPriority;
+
+    };
+
+#endif // C_VTUICOMMANDMODIFYBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicommandpolicymanager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* 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:  Command policy manager class definition.
+*
+*/
+
+
+#ifndef C_VTUICOMMANDPOLICYMANAGER_H
+#define C_VTUICOMMANDPOLICYMANAGER_H
+
+#include <e32base.h>
+
+#include "tvtuicmdcontexttype.h"
+
+class CVtUiCmdContext;
+class CVtUiCmdValidatorBase;
+class CVtUiCmdValidationActionBase;
+class CVtUiCmdCustomValidationActionBase;
+class CVtUiCommandManager;
+class CVtUiPrimaryCmdPolicy;
+
+/**
+ * CVtUiCommandPolicyManager
+ *
+ * Contains pointers to all registered command contexts and commnd policy
+ * instances. When validation is required, calls proper methods in proper
+ * context for registered validators in validator priority order.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiCommandPolicyManager ) : public CBase
+    {
+
+public: // public methods
+
+    /**
+     * Static constructor.
+     *
+     * @param aCmdManager Constant reference to command manager instance.
+     * @return Newly created instance of CVtUiCommandPolicyManager class.
+     */
+    static CVtUiCommandPolicyManager*
+        NewL( const CVtUiCommandManager& aCmdManager );
+
+    /**
+     * C++ destructor.
+     */
+    ~CVtUiCommandPolicyManager();
+
+    /**
+     * Registers command context.
+     *
+     * @param aContext Reference to command context to be registered.
+     * @return KErrNone if registration succeeded.
+     */
+    TInt RegisterCommandContext( CVtUiCmdContext& aContext );
+
+    /**
+     * Unregisters command context.
+     *
+     * @param aContext Constant reference to command context to be unregistered.
+     */
+    void UnregisterCommandContext( CVtUiCmdContext& aContext );
+
+    /**
+     * Adds validator to policy manager and registered contexts.
+     *
+     * @param aValidator Reference to validator to be added.
+     * @return KErrNone if add succeeded.
+     */
+    TInt AddValidator( CVtUiCmdValidatorBase& aValidator );
+
+    /**
+     * Removes validator from policy manager and registered contexts.
+     *
+     * @param aValidator Constant reference to validator to be removed.
+     */
+    void RemoveValidator( CVtUiCmdValidatorBase& aValidator );
+
+    /**
+     * Validates menu items for given action.
+     *
+     * @param aAction Reference to validation action to be carried on menu
+     * commmands.
+     */
+    void ValidateMenuItemsL( CVtUiCmdValidationActionBase& aAction );
+
+    /**
+     * Validates softkey items for given action.
+     *
+     * @param aAction Reference to validation action to be carried on softkeys.
+     */
+    void ValidateSoftkeyItemsL( CVtUiCmdValidationActionBase& aAction );
+
+    /**
+     * Validates toolbar items for given action.
+     *
+     * @param aAction Reference to validation action to be carried on toolbar
+     * commands.
+     */
+    void ValidateToolbarItemsL( CVtUiCmdValidationActionBase& aAction );
+
+    /**
+     * Custom validation for given action.
+     *
+     * @param Reference to custom validation action to be carried.
+     */
+    void CustomValidateL( CVtUiCmdCustomValidationActionBase& aAction );
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiCommandPolicyManager( const CVtUiCommandManager& aCmdManager );
+
+    /**
+     * 2nd constructor
+     */
+    void ConstructL();
+
+    /**
+     * Called when RegisterCommandContext() succeeds.
+     */
+    void CommandContextRegistered( CVtUiCmdContext& aContext );
+
+    /**
+     * Called when UnregisterCommandContext() succeeds.
+     */
+    void CommandContextUnregistered( CVtUiCmdContext& aContext );
+
+    /**
+     * Called when AddValidator() succeeds.
+     */
+    void ValidatorAdded( CVtUiCmdValidatorBase& aValidator );
+
+    /**
+     * Called when RemoveValidator() succeeds.
+     */
+    void ValidatorRemoved( CVtUiCmdValidatorBase& aValidator );
+
+    /**
+     * Returns command context by type.
+     */
+    CVtUiCmdContext* FindCommandContextByType(
+        TVtUiCmdContextType aContextType );
+
+    /**
+     * Called from different validation routines.
+     */
+    void ValidateL( TVtUiCmdContextType aContextType,
+        CVtUiCmdValidationActionBase& aAction );
+
+private: // data
+
+    // Context list (ordered by context type)
+    RPointerArray< CVtUiCmdContext > iContexts;
+
+    // Validator list
+    RPointerArray< CVtUiCmdValidatorBase > iValidators;
+
+    // Reference to command manager
+    const CVtUiCommandManager& iCommandManager;
+
+    // Primary command policy, always exists.
+    CVtUiPrimaryCmdPolicy* iPrimaryCommandPolicy;
+
+    };
+
+#endif // C_VTUICOMMANDPOLICYMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicommandsetting.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* 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:  Command settings class definition.
+*
+*/
+
+
+#ifndef C_VTUICOMMANDSETTING_H
+#define C_VTUICOMMANDSETTING_H
+
+#include <e32base.h>
+
+#include "mvtuicommandsetting.h"
+
+class CVtUiCommandModifyBase;
+
+/**
+ *  CVtUiCommandSetting
+ *
+ *  Template commmand setting class that takes command setting action as a
+ *  templated parameter.
+ *
+ *  @since S60 v3.2
+ */
+template < typename ACTION >
+class CVtUiCommandSetting : public CBase, public MVtUiCommandSetting
+    {
+
+public:
+
+    /**
+     * Destructor
+     */
+    ~CVtUiCommandSetting();
+
+    /**
+     * Defines commands.
+     *
+     * @param aAction Action related to commands to be defined.
+     */
+    void DefineCommandsL( const ACTION& aAction );
+
+    /**
+     * Adds new modifer
+     *
+     * @param aModifier Reference to modifier to be added to this setting
+     * instance.
+     * @return KErrNone if modifier could be added, KErrAlreadyExists if same
+     * modifier is already added or KErrArgument if another modifier with
+     * same priority is already added.
+     */
+    TInt AddModifier( CVtUiCommandModifyBase& aModifier );
+
+    /**
+     * Removes modifier
+     *
+     * @param aModifier Constant reference to modifier to be removed.
+     */
+    void RemoveModifier( CVtUiCommandModifyBase& aModifier );
+
+    /**
+     * Return command type
+     *
+     * @return Type of commands this setting class instance is defining.
+     */
+    Type CommandType() const;
+
+    /**
+     * Returns reference to action
+     *
+     * @return Constant reference to action that is related to this command
+     * definition process.
+     */
+    const ACTION& Action();
+
+protected:
+
+    /**
+     * Constructor
+     */
+    CVtUiCommandSetting( Type aCommandType );
+
+private:
+
+    // Modifiers
+    RPointerArray< CVtUiCommandModifyBase > iModifiers;
+
+    // Command type
+    const Type iCommandType;
+
+    // Stored action
+    const ACTION* iAction;
+
+    };
+
+#include "cvtuicommandsetting.inl"
+
+#endif // C_VTUICOMMANDSETTING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuicommandsetting.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,139 @@
+/*
+* 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:  Command setting inline methods.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicommandmodifybase.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+static const TInt KVtUiModifierArrayGranularity = 1;
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandSetting< A >::~CVtUiCommandSetting
+// ---------------------------------------------------------------------------
+//
+template < typename A >
+CVtUiCommandSetting< A >::~CVtUiCommandSetting()
+    {
+    iModifiers.Reset();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandSetting< A >::CVtUiCommandSetting
+// ---------------------------------------------------------------------------
+//
+template < typename A >
+CVtUiCommandSetting< A >::CVtUiCommandSetting( Type aCommandType ) :
+    iModifiers( KVtUiModifierArrayGranularity ), iCommandType( aCommandType )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandSetting< A >::DefineCommandsL
+// ---------------------------------------------------------------------------
+//
+template < typename A >
+void CVtUiCommandSetting< A >::DefineCommandsL( const A& aAction )
+    {
+    __VTPRINTENTER( "CmdSet< A >.DefineCommandsL" )
+    iAction = &aAction;
+    if ( iModifiers.Count() > 0 )
+        {
+        iModifiers[ iModifiers.Count() - 1 ]->ModifyCommandsL( *this );
+        }
+    else
+        {
+        DoDefineCommandsL();
+        }
+    iAction = NULL;
+    __VTPRINTEXIT( "CmdSet< A >.DefineCommandsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandSetting< A >::AddModifier
+// ---------------------------------------------------------------------------
+//
+template < typename A >
+TInt CVtUiCommandSetting< A >::AddModifier(
+    CVtUiCommandModifyBase& aModifier )
+    {
+    __VTPRINTENTER( "CmdSet< A >.AddModifier" )
+    TInt result( KErrNone );
+    if ( aModifier.Supports( iCommandType ) )
+        {
+        TInt idx( iModifiers.FindInOrder( &aModifier,
+            CVtUiCommandModifyBase::PriorityOrder() ) );
+        if ( idx == KErrNotFound )
+            {
+            result = iModifiers.InsertInOrder( &aModifier,
+                CVtUiCommandModifyBase::PriorityOrder() );
+            }
+        else
+            {
+            if ( iModifiers[ idx ] != &aModifier )
+                {
+                // Priorities match, but instance is not same -> argument
+                // is not valid
+                result = KErrArgument;
+                }
+            }
+        }
+    __VTPRINTEXITR( "CmdSet< A >.AddModifier %d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandSetting< A >::RemoveModifier
+// ---------------------------------------------------------------------------
+//
+template < typename A >
+void CVtUiCommandSetting< A >::RemoveModifier(
+    CVtUiCommandModifyBase& aModifier )
+    {
+    __VTPRINTENTER( "CmdSet< A >.RemoveModifier" )
+    TInt idx( iModifiers.FindInOrder( &aModifier,
+        CVtUiCommandModifyBase::PriorityOrder() ) );
+
+    if ( idx != KErrNotFound )
+        {
+        iModifiers.Remove( idx );
+        }
+    __VTPRINTEXIT( "CmdSet< A >.RemoveModifier" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandSetting< A >::CommandType
+// ---------------------------------------------------------------------------
+//
+template < typename A >
+MVtUiCommandSetting::Type CVtUiCommandSetting< A >::CommandType() const
+    {
+    return iCommandType;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandSetting< A >::Action
+// ---------------------------------------------------------------------------
+//
+template < typename A >
+const A& CVtUiCommandSetting< A >::Action()
+    {
+    return *iAction;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuiexecutioncontext.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* 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:  Execution context class definition.
+*
+*/
+
+
+#ifndef C_VTUIEXECUTIONCONTEXT_H
+#define C_VTUIEXECUTIONCONTEXT_H
+
+#include "cvtuicmdcontext.h"
+
+/**
+ *  CVtUiExecutionContext
+ *
+ *  Command execution context. This context is used for checking whether or not
+ *  a command is allowed to be performed.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiExecutionContext ) : public CVtUiCmdContext
+    {
+
+public: // public methods
+
+    /**
+     * C++ destructor.
+     */
+    ~CVtUiExecutionContext();
+
+    /**
+     * Static constructor.
+     *
+     * @param aCommandManager Reference to command manager.
+     * @return Newly created instance of CVtUiExecutionContext class.
+     */
+    static CVtUiExecutionContext* NewL( MVtUiCommandManager& aCommandManager );
+
+public: // from CVtUiCmdContext
+
+    /**
+     * @see CVtUiCmdContext::ValidateL
+     */
+    void ValidateL( CVtUiCmdValidationActionBase& aAction );
+
+private:
+
+    /**
+     * C++ constructor
+     */
+    CVtUiExecutionContext( MVtUiCommandManager& aCommandManager );
+
+    /**
+     * 2nd constructor, may leave.
+     */
+    void ConstructL();
+
+private: // data
+
+    };
+
+#endif // C_VTUIEXECUTIONCONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuifeaturecmdbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* 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:  Feature based UI command base class definition.
+*
+*/
+
+
+#ifndef C_VTUIFEATURECMDBASE_H
+#define C_VTUIFEATURECMDBASE_H
+
+#include "cvtuicmdbase.h"
+
+class MVtUiFeature;
+
+/**
+ *  CVtUiCmdBase
+ *
+ *  Base class for all UI commands that are feature based.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiFeatureCmdBase ) : public CVtUiCmdBase
+    {
+
+public: // from CVtUiCmdBase
+
+    /**
+     * @see CVtUiCmdBase::HandleL
+     */
+    void HandleL();
+
+    /**
+     * @see CVtUiCmdBase::IsEnabled
+     */
+    TBool IsEnabled() const;
+
+protected:
+
+    /**
+     * C++ constructor.
+     *
+     * @aFeature Reference to a feature this command refers to.
+     * @aCommandId Id of this command.
+     *
+     */
+    CVtUiFeatureCmdBase( MVtUiFeature& aFeature, TInt aCommandId );
+
+protected:
+
+    // Reference to command feature
+    MVtUiFeature& iFeature;
+
+    };
+
+#endif // C_VTUIFEATURECMDBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/cvtuiprimarycmdpolicy.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* 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:  Primary command policy class definition.
+*
+*/
+
+
+#ifndef C_VTUIPRIMARYCMDPOLICY_H
+#define C_VTUIPRIMARYCMDPOLICY_H
+
+#include <e32base.h>
+
+#include "tvtuicmdpolicypriority.h"
+#include "cvtuicmdvalidatorbase.h"
+#include "tvtuilocalvariation.h"
+
+class CVtUiCmdValidationActionBase;
+class TVtUiStates;
+class CVtUiAppUi;
+/**
+ * CVtUiPrimaryCmdPolicy
+ *
+ * Primary policy is the highest priority policy. It does the basic validation,
+ * results of which can be modified by the lower priority validators.
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiPrimaryCmdPolicy ) : public CVtUiCmdValidatorBase
+    {
+
+public: // public methods
+
+    /**
+     * Static constructor.
+     *
+     * @param aUiStates Constant reference to UI states object.
+     * @return Newly created instace of CVtUiPrimaryCmdPolicy class.
+     */
+    static CVtUiPrimaryCmdPolicy* NewL( const TVtUiStates& aUiStates, 
+        const CVtUiAppUi& aAppUi );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiPrimaryCmdPolicy();
+
+public: // from CVtUiCmdValidatorBase
+
+    /**
+     * @see CVtUiCmdValidatorBase::ValidateMenuItemsL
+     */
+    void ValidateMenuItemsL( CVtUiCmdValidationActionBase& aAction,
+        TInt aReferencePriority );
+
+    /**
+     * @see CVtUiCmdValidatorBase::ValidateSoftkeyItemsL
+     */
+    void ValidateSoftkeyItemsL( CVtUiCmdValidationActionBase& aAction,
+        TInt aReferencePriority );
+
+    /**
+     * @see CVtUiCmdValidatorBase::ValidateToolbarItemsL
+     */
+    void ValidateToolbarItemsL( CVtUiCmdValidationActionBase& aAction,
+        TInt aReferencePriority );
+
+    /**
+     * @see CVtUiCmdValidatorBase::CustomValidationL
+     */
+    void CustomValidationL( CVtUiCmdCustomValidationActionBase& aAction,
+        TInt aReferencePriority );
+
+    /**
+     * @see CVtUiCmdValidatorBase::ValidatesContext
+     */
+    TBool ValidatesContext( const TVtUiCmdContextType& aCtxType )
+        const;
+
+private:
+
+    /**
+     * C++ constructor
+     */
+    CVtUiPrimaryCmdPolicy( const TVtUiStates& aUiStates, 
+        const CVtUiAppUi& aAppUi );
+
+    /**
+     * 2nd constructor
+     */
+    void ConstructL();
+
+    /**
+     * Callback for menu validation.
+     */
+    TBool ValidateMenuCommand( TInt aCommandId ) const;
+
+    /**
+     * Callback for softkey resource id validation.
+     */
+    TBool ValidateSoftkey( TInt aResourceId ) const;
+
+    /**
+     * Callback for toolbar command validation.
+     */
+    TBool ValidateToolbarCommand( TInt aCommandId ) const;
+
+    /**
+     * Callback for command state validation.
+     */
+    TBool ValidateCommandState( TInt aCommandId ) const;
+
+    /**
+     * Callback for command validation.
+     */
+    TBool ValidateCommand( TInt aCommandId, TBool& aHandled ) const;
+
+private: // data
+
+    // UI states
+    const TVtUiStates& iUiStates;
+
+    // Active idle local variation    
+    TBool iAIEnabled;
+    
+    // Reference to appui
+    const CVtUiAppUi& iAppUi;
+
+    };
+
+#endif // C_VTUIPRIMARYCMDPOLICY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/mvtuicommanditerator.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* 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:  Command iterator API definition.
+*
+*/
+
+
+#ifndef M_VTUICOMMANDITERATOR_H
+#define M_VTUICOMMANDITERATOR_H
+
+#include <e32base.h>
+
+/**
+ *  MVtUiCommandIterator
+ *
+ *  API for iterating through set of commands.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiCommandIterator
+    {
+
+public:
+
+    /**
+     * Returns ETrue if the iteration has more elements
+     *
+     * @return ETrue if iteration contains more commands (i.e. call to Next()
+     * will return a valid command), EFalse otherwise.
+     */
+    virtual TBool HasNext() const = 0;
+
+    /**
+     * Returns the next command in the iteration.
+     *
+     * @return Next command in the iteration.
+     */
+    virtual TInt Next() = 0;
+
+    };
+
+#endif // M_VTUICOMMANDITERATOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/mvtuicommandmanager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,162 @@
+/*
+* 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:  Command manager API definition.
+*
+*/
+
+
+#ifndef M_VTUICOMMANDMANAGER_H
+#define M_VTUICOMMANDMANAGER_H
+
+#include <e32base.h>
+
+class CEikMenuPane;
+class CVtUiCmdContext;
+class CVtUiCmdValidatorBase;
+class CVtUiCmdValidationActionBase;
+class MVtUiCommandUi;
+class CVtUiCommandModifyBase;
+class CVtUiCmdCustomValidationActionBase;
+class CVtUiCmdBase;
+
+/**
+ *  MVtUiCommandManager
+ *
+ *  Command manager API for other components. Command manager holds command UI
+ *  instances and does command validation for all registered commands.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiCommandManager
+    {
+
+public:
+
+    /**
+     * Adds new command ui to command manager.
+     * @param aCommandUi Reference to command ui to be added.
+     * @return KErrNone if command ui was added successfully.
+     */
+    virtual TInt AddCommandUi( MVtUiCommandUi& aCommandUi ) = 0;
+
+    /**
+     * Removes command ui from command manager.
+     * @param aCommandUi Constant reference to command ui to be removed.
+     *
+     */
+    virtual void RemoveCommandUi( MVtUiCommandUi& aCommandUi ) = 0;
+
+    /**
+     * Validate menu items in given manu pane.
+     *
+     * @param aAction Reference to action to be carried on all menu commands.
+     */
+    virtual void ValidateMenuItemsL(
+        CVtUiCmdValidationActionBase& aAction ) = 0;
+
+    /**
+     * Validate softkeys.
+     *
+     * @param aAction Reference to action to be carried on all softkeys.
+     */
+    virtual void ValidateSoftkeyItemsL(
+        CVtUiCmdValidationActionBase& aAction ) = 0;
+
+    /**
+     * Validate toolbar buttons.
+     *
+     * @param aAction Reference to action to be carried on all toolbar commands.
+     */
+    virtual void ValidateToolbarItemsL(
+        CVtUiCmdValidationActionBase& aAction ) = 0;
+
+    /**
+     * Validate command.
+     *
+     * @param aCommandId Id of command that is being checked.
+     * @return ETrue if command can be executed, EFalse otherwise.
+     */
+    virtual TBool IsCommandAllowedL( TInt aCommandId ) = 0;
+
+    /**
+     * Registers command context.
+     *
+     * @param aContext Reference to command context to be registered.
+     * @return KErrNone if registration succeeded.
+     */
+    virtual TInt RegisterCommandContext( CVtUiCmdContext& aContext ) = 0;
+
+    /**
+     * Unregisters command context.
+     *
+     * @param aContext Reference to command context to be unregistered.
+     */
+    virtual void UnregisterCommandContext( CVtUiCmdContext& aContext ) = 0;
+
+    /**
+     * Adds validator to policy manager and registered contexts.
+     *
+     * @param aValidator Reference to validator to be added.
+     * @return KErrNone if registration succeeded.
+     */
+    virtual TInt AddValidator( CVtUiCmdValidatorBase& aValidator ) = 0;
+
+    /**
+     * Removes validator from policy manager and registered contexts.
+     *
+     * @param aValidator Constant reference to validator to be removed.
+     */
+    virtual void RemoveValidator( CVtUiCmdValidatorBase& aValidator ) = 0;
+
+    /**
+     * Refresh command uis.
+     */
+    virtual void RefreshL() = 0;
+
+    /**
+     * Add new command modifier.
+     *
+     * @param aModifier Reference to command modifier to be added to every
+     * registered command setting.
+     * @return KErrNone if modifier could be added, KErrAlreadyExists if same
+     * modifier is already added or KErrArgument if another modifier with
+     * same priority is already added.
+     */
+    virtual TInt AddCommandModifier( CVtUiCommandModifyBase& aModifier ) = 0;
+
+    /**
+     * Remove command modifier.
+     *
+     * @param aModifier Reference to command modifier to be removed from every
+     * registered command setting.
+     */
+    virtual void RemoveCommandModifier( CVtUiCommandModifyBase& aModifier ) = 0;
+
+    /**
+     * Registers new command to command manager.
+     *
+     * @param aCommand Reference to command to be registered.
+     */
+    virtual void RegisterCommandL( CVtUiCmdBase& aCommand ) = 0;
+
+    /**
+     * Unregisters command from command manager.
+     *
+     * @param aCommand Constant reference to command to be unregistered.
+     */
+    virtual void UnregisterCommand( const CVtUiCmdBase& aCommand ) = 0;
+
+    };
+
+#endif // M_VTUICOMMANDMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/mvtuicommandsetting.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* 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:  Command iterator API definition.
+*
+*/
+
+
+#ifndef M_VTUICOMMANDSETTING_H
+#define M_VTUICOMMANDSETTING_H
+
+#include <e32base.h>
+
+/**
+ *  MVtUiCommandSetting
+ *
+ *  Command Setting API.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiCommandSetting
+    {
+
+public:
+
+    /**
+     * Command types.
+     */
+    enum Type
+        {
+        /** Softkeys */
+        ECommandTypeSoftkeys
+        };
+
+public: // pure virtual methods
+
+    /**
+     * Does the base command definition. If no modifiers are registered, then
+     * this method is called from DefineCommandsL(), otherwise this method may
+     * be called by the modifier, but it is not required to do so.
+     */
+    virtual void DoDefineCommandsL() = 0;
+
+    };
+
+
+#endif // M_VTUICOMMANDSETTING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/mvtuicommandui.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* 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:  Command UI API definition.
+*
+*/
+
+
+#ifndef M_VTUICOMMANDUI_H
+#define M_VTUICOMMANDUI_H
+
+#include <e32base.h>
+
+class CVtUiCommandModifyBase;
+
+/**
+ *  MVtUiCommandUi
+ *
+ *  Command UI API. Defines methods for adding/removing command modifiers and
+ *  method to refresh related command UI.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiCommandUi
+    {
+
+public:
+
+    /**
+     * Refresh command ui.
+     */
+    virtual void RefreshL() = 0;
+
+    /**
+     * Add new command modifier.
+     *
+     * @param aModifier Reference to modifier to be added to this command ui.
+     * @return KErrNone if modifier could be added, KErrAlreadyExists if same
+     * modifier is already added or KErrArgument if another modifier with
+     * same priority is already added.
+     */
+    virtual TInt AddCommandModifier( CVtUiCommandModifyBase& aModifier ) = 0;
+
+    /**
+     * Remove command modifier.
+     *
+     * @param aModifier Reference to modifier to be removed from this command
+     * ui.
+     */
+    virtual void RemoveCommandModifier( CVtUiCommandModifyBase& aModifier ) = 0;
+
+    };
+
+#endif // M_VTUICOMMANDUI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tVtuifeaturevariation.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,182 @@
+/*
+* 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:  Video Telephone feature variation class definition.
+*
+*/
+
+
+#ifndef T_VTUIFEATUREVARIATION_H
+#define T_VTUIFEATUREVARIATION_H
+
+#include <e32base.h>
+#include <featmgr.h>
+
+/**
+ *  TVtUiVariationBase
+ *
+ *  Base class for feature variation classes.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiFeatureVariationBase )
+    {
+
+public:
+
+    /**
+     * Returns variation feature ID.
+     */
+    virtual TUint32 FeatureId() const = 0;
+
+protected:
+
+    /**
+     * Return whether or not feature is supported by Featuremanager.
+     * @return ETrue if feature is supported by Featuremanager.
+     */
+    virtual TBool IsFeatureSupported( const TUint32 aId) const;
+
+    };
+
+/**
+ *  TVtUiHelpVariation
+ *
+ *  Help variation class. Uses Featuremanager to verify if feture is
+ *  supported. This class should be instanced only once and same instance
+ *  should be passesd as reference to modules that need this feature variation
+ *  information.
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiHelpVariation ) : public TVtUiFeatureVariationBase
+    {
+
+public:
+
+    /**
+     * Return whether or help variation is supported.
+     *
+     * @return ETrue if help supported.
+     */
+    TBool IsHelpSupported() const;
+
+private: // from TVtUiFeatureVariationBase
+
+		TUint32 FeatureId() const;
+
+    };
+/**
+ *  TVtUiDPVariation
+ *
+ *  Display Post (DP) variation class. Uses Featuremanager to verify if feture is
+ *  supported. This class should be instanced only once and same instance
+ *  should be passesd as reference to modules that need this feature variation
+ *  information.
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiDPVariation ) : public TVtUiFeatureVariationBase
+    {
+
+public:
+
+    /**
+     * Return whether or DP variation is supported.
+     *
+     * @return ETrue if DP supported.
+     */
+    TBool IsDPSupported() const;
+
+private: // from TVtUiFeatureVariationBase
+
+		TUint32 FeatureId() const;
+
+    };
+/**
+ *  TVtUiBTVariation
+ *
+ *  BlueTooth (BT) variation class. Uses Featuremanager to verify if feture is
+ *  supported. This class should be instanced only once and same instance
+ *  should be passesd as reference to modules that need this feature variation
+ *  information.
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiBTVariation ) : public TVtUiFeatureVariationBase
+    {
+
+public:
+
+    /**
+     * Return whether or BT variation is supported.
+     *
+     * @return ETrue if BT supported.
+     */
+    TBool IsBTSupported() const;
+
+private: // from TVtUiFeatureVariationBase
+
+		TUint32 FeatureId() const;
+
+    };
+/**
+ *  TVtUiSideVolumeKeysVariation
+ *
+ *  Side volume keys variation class. Uses Featuremanager to verify if feture is
+ *  supported. This class should be instanced only once and same instance
+ *  should be passesd as reference to modules that need this feature variation
+ *  information.
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiSideVolumeKeysVariation ) : public TVtUiFeatureVariationBase
+    {
+
+public:
+
+    /**
+     * Return whether or Side volume keys variation is supported.
+     *
+     * @return ETrue if Side volume keys supported.
+     */
+    TBool IsSideVolumeKeysSupported() const;
+
+private: // from TVtUiFeatureVariationBase
+
+		TUint32 FeatureId() const;
+
+    };
+/**
+ *  TVtUiActiveIdleFetManVariation
+ *
+ *  Active Idle feature manager variation class. Uses Featuremanager to verify if feture is
+ *  supported. This class should be instanced only once and same instance
+ *  should be passesd as reference to modules that need this feature variation
+ *  information.
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiActiveIdleFetManVariation ) : public TVtUiFeatureVariationBase
+    {
+
+public:
+
+    /**
+     * Return whether or Acvtive Idle variation is supported.
+     *
+     * @return ETrue if Acvtive Idle  supported.
+     */
+    TBool IsActiveIdleFetManSupported() const;
+
+private: // from TVtUiFeatureVariationBase
+
+		TUint32 FeatureId() const;
+
+    };         
+#endif // T_VTUIFEATUREVARIATION_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtflagcontainer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,108 @@
+/*
+* 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:  Flag container class definition.
+*
+*/
+
+
+#ifndef T_VTFLAGCONTAINER_H
+#define T_VTFLAGCONTAINER_H
+
+#include <e32base.h>
+
+/**
+ *  TVtFlagContainer
+ *
+ *  Flag container is a class that holds maximum of 32 different flags. Also
+ *  contains methods for setting, clearing and getting the flag state.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtFlagContainer )
+    {
+public:
+
+    /**
+     * Constructor.
+     */
+    inline TVtFlagContainer();
+
+protected:
+
+    /**
+     * Clears all flags.
+     */
+    inline void Clear();
+
+    /**
+     * Tests flag.
+     */
+    inline TBool IsFlag( TUint32 aFlags ) const;
+
+    /**
+     * Sets flag(s).
+     */
+    inline void SetFlag( TUint32 aFlags );
+
+    /**
+     * Clears flag(s).
+     */
+    inline void ClearFlag( TUint32 aFlags );
+
+    /**
+    * Gets flag value.
+    */
+    inline TUint32 Value() const;
+
+    /**
+    * Sets flag value.
+    */
+    inline void SetValue( TUint32 aValue );
+
+private:
+
+    // Current flags
+    TUint32 iFlags;
+
+    };
+
+/**
+ *  TVtUpdateableFlagContainer
+ *
+ *  A flag container with Update() method that can be called to get
+ *  flags updated in one pass.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUpdateableFlagContainer ) : public TVtFlagContainer
+    {
+public:
+
+    /**
+    * Issues flag updation.
+    */
+    inline void Update();
+
+private:
+
+    /**
+    * Called when flags needs to be updated (as a result to call Update()).
+    */
+    virtual void UpdateFlags() = 0;
+
+    };
+
+#include "tvtflagcontainer.inl"
+
+#endif // T_VTFLAGCONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtflagcontainer.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* 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:  Flag container class inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TVtFlagContainer::TVtFlagContainer
+// -----------------------------------------------------------------------------
+//
+TVtFlagContainer::TVtFlagContainer()
+    {
+    Clear();
+    }
+
+// -----------------------------------------------------------------------------
+// TVtFlagContainer::Clear
+// -----------------------------------------------------------------------------
+//
+void TVtFlagContainer::Clear()
+    {
+    iFlags = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtFlagContainer::IsFlag
+// -----------------------------------------------------------------------------
+//
+TBool TVtFlagContainer::IsFlag( TUint32 aFlags ) const
+    {
+    return ( iFlags & aFlags );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtFlagContainer::SetFlag
+// -----------------------------------------------------------------------------
+//
+void TVtFlagContainer::SetFlag( TUint32 aFlags )
+    {
+    iFlags |= aFlags;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtFlagContainer::ClearFlag
+// -----------------------------------------------------------------------------
+//
+void TVtFlagContainer::ClearFlag( TUint32 aFlags )
+    {
+    iFlags &= ~aFlags;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtFlagContainer::Value
+// -----------------------------------------------------------------------------
+//
+TUint32 TVtFlagContainer::Value() const
+    {
+    return iFlags;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtFlagContainer::SetValue
+// -----------------------------------------------------------------------------
+//
+void TVtFlagContainer::SetValue( TUint32 aValue )
+    {
+    iFlags = aValue;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUpdateableFlagContainer::Update
+// -----------------------------------------------------------------------------
+//
+void TVtUpdateableFlagContainer::Update()
+    {
+    Clear();
+    UpdateFlags();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuiaudiostate.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* 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:  Audio state class definition.
+*
+*/
+
+
+#ifndef T_VTUIAUDIOSTATE_H
+#define T_VTUIAUDIOSTATE_H
+
+#include <e32base.h>
+
+#include "tvtflagcontainer.h"
+
+class CVtEngModel;
+
+/**
+ *  TVtUiAudioState
+ *
+ *  Contains status information about video telephony audio.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiAudioState ) : public TVtUpdateableFlagContainer
+    {
+public:
+
+    /**
+     * Constructor
+     *
+     * @param aModel Reference to VT engine model.
+     */
+    inline TVtUiAudioState( CVtEngModel& aModel );
+
+    /**
+     * Return whether audio is enabled or not.
+     *
+     * @return ETrue if audio is enabled EFalse otherwise.
+     */
+    inline TBool IsAudio() const;
+
+    /**
+     * Return whether BT handsfree can be activated or not.
+     *
+     * @return ETrue if BT handsfree can be activated EFalse otherwise.
+     */
+    inline TBool CanActivateBtHf() const;
+
+    /**
+     * Return whether BT handsfree can be deactivated or not.
+     *
+     * @return ETrue if BT handsfree can be deactivated EFalse otherwise.
+     */
+    inline TBool CanDeactivateBtHf() const;
+
+    /**
+     * Return whether loudspeaker can be activated or not.
+     *
+     * @return ETrue if loudpseaker can be activated EFalse otherwise.
+     */
+    inline TBool CanActivateLoudspeaker() const;
+
+    /**
+     * Return whether loudspeaker can be deactivated or not.
+     *
+     * @return ETrue if loudspeaker can be deactivated EFalse otherwise.
+     */
+    inline TBool CanDeactivateLoudspeaker() const;
+
+    /**
+     * Return whether or not audio is permanently stopped.
+     *
+     * @return ETrue if audio is permanently stopped.
+     */
+    inline TBool IsAudioPermanentlyStopped() const;
+
+private: // from TVtUpdateableFlagContainer
+
+    /**
+     * @see TVtUpdateableFlagContainer::UpdateFlags
+     */
+    void UpdateFlags();
+
+private:
+
+    // Enumeration for audio state flags.
+    enum TFlags
+        {
+        /** Is set if audio is currently enabled. */
+        EIsAudio = ( 1<<0 ),
+        /** Is set if BT handsfree can be activated. */
+        ECanActivateBtHf = ( 1<<1 ),
+        /** Is set if BT handsfree can be deactivated. */
+        ECanDeactivateBtHf = ( 1<<2 ),
+        /** Is set if loudspeaker can be activated. */
+        ECanActivateLoudspeaker = ( 1<<3 ),
+        /** Is set if loudspeaker can be deactivated. */
+        ECanDeactivateLoudspeaker = ( 1<<4 ),
+        /** Set if audio is permanently stopped */
+        EIsAudioPermanentlyStopped = ( 1<<5 )
+        };
+
+    // Reference to engine model instance
+    CVtEngModel& iModel;
+
+    };
+
+#include "tvtuiaudiostate.inl"
+
+#endif // T_VTUIAUDIOSTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuiaudiostate.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* 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:  Audio state class inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TVtUiAudioState::TVtUiAudioState
+// -----------------------------------------------------------------------------
+//
+TVtUiAudioState::TVtUiAudioState( CVtEngModel& aModel )
+: iModel( aModel )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAudioState::IsAudio
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiAudioState::IsAudio() const
+    {
+    return IsFlag( EIsAudio );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAudioState::CanActivateBtHf
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiAudioState::CanActivateBtHf() const
+    {
+    return IsFlag( ECanActivateBtHf );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAudioState::CanDeactivateBtHf
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiAudioState::CanDeactivateBtHf() const
+    {
+    return IsFlag( ECanDeactivateBtHf );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAudioState::CanActivateLoudspeaker
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiAudioState::CanActivateLoudspeaker() const
+    {
+    return IsFlag( ECanActivateLoudspeaker );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAudioState::CanDeactivateLoudspeaker
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiAudioState::CanDeactivateLoudspeaker() const
+    {
+    return IsFlag( ECanDeactivateLoudspeaker );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsAudioPermanentlyStopped
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiAudioState::IsAudioPermanentlyStopped() const
+	{
+	return IsFlag( EIsAudioPermanentlyStopped );
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuicmdcontexttype.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* 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:  Command context types.
+*
+*/
+
+
+#ifndef T_VTUICMDCONTEXTTYPE_H
+#define T_VTUICMDCONTEXTTYPE_H
+
+/**
+ * Command context types
+ *
+ * @since S60 3.2
+ */
+enum TVtUiCmdContextType
+    {
+    /** Context type not defined yet */
+    EVtUiCmdContextTypeUndefined = 0,
+
+    /** Context type menu */
+    EVtUiCmdContextTypeMenu,
+
+    /** Context type softkey */
+    EVtUiCmdContextTypeSoftkey,
+
+    /** Context type toolbar */
+    EVtUiCmdContextTypeToolbar,
+
+    /** Context type execution */
+    EVtUiCmdContextTypeExecution,
+
+    /** Context type number entry */
+    EVtUiCmdContextTypeNumberEntry
+
+    };
+
+#endif // T_VTUICMDCONTEXTTYPE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuicmdpolicypriority.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* 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:  Command policy priorities.
+*
+*/
+
+
+#ifndef T_VTUICMDPOLICYPRIORITY_H
+#define T_VTUICMDPOLICYPRIORITY_H
+
+/**
+ * Command priority enumeration
+ *
+ * @since S60 3.2
+ */
+enum TVtUiCmdPolicyPriority
+    {
+    /** Undefined priority value */
+    EVtUiCmdPolicyPriorityUndefined = 0,
+
+    /** Lowest possible priority */
+    EVtUiCmdPolicyPriorityLowest = 1,
+
+    /** Number entry policy priority */
+    EVtUiCmdPolicyPriorityNumberEntry,
+
+    /** Menu policy priority */
+    EVtUiCmdPolicyPriorityMenu = 100,
+
+    /** Softkey policy priority */
+    EVtUiCmdPolicyPrioritySoftkey = 200,
+
+    /** Toolbar policy priority */
+    EVtUiCmdPolicyPriorityToolbar = 300,
+
+    /** Primary policy priority, must be highest */
+    EVtUiCmdPolicyPriorityPrimary,
+
+    /** Highest possible priority */
+    EVtUiCmdPolicyPriorityHighest = EVtUiCmdPolicyPriorityPrimary
+
+    };
+
+#endif // T_VTUICMDPOLICYPRIORITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuicmdvalidatorcallback.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* 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:  Command validator callback class definition.
+*
+*/
+
+
+#ifndef T_VTUICMDVALIDATORCALLBACK_H
+#define T_VTUICMDVALIDATORCALLBACK_H
+
+#include <e32base.h>
+
+/**
+ *  MVtUiCmdValidatorCallBack
+ *
+ *  Command validator callback API.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiCmdValidatorCallBack
+    {
+
+public:
+
+    /**
+     * Invokes callback call.
+     */
+    virtual TBool Call( TInt ) const = 0;
+
+    };
+
+/**
+ *  TVtUiCmdValidatorCallBack
+ *
+ *  Validator callback wrapper to maintain type safety. Also allows use of
+ *  different types of instances for invocation of callback.
+ *
+ *  @since S60 v3.2
+ */
+template < class T >
+NONSHARABLE_CLASS( TVtUiCmdValidatorCallBack )
+: public MVtUiCmdValidatorCallBack
+    {
+
+    // Callback method type definition
+    typedef TBool ( T::*TCallBackMethod )( TInt ) const;
+
+public:
+
+    /**
+     * Constructor
+     *
+     * @param aInstance Instance on which callback method will be called.
+     * @param aMethod Callback method to be called.
+     */
+    TVtUiCmdValidatorCallBack( const T& aInstance, TCallBackMethod aMethod );
+
+    /**
+     * Executes callback.
+     *
+     * @param aParameter Callback parameter, e.g. command Id or resource Id.
+     * @return Callback result.
+     */
+    TBool Call( TInt aParameter ) const;
+
+private:
+
+    // Instance from which callback method will be invoke
+    const T* iInstance;
+
+    // Callback method pointer
+    TCallBackMethod iMethod;
+
+    };
+
+#include "tvtuicmdvalidatorcallback.inl"
+
+#endif // T_VTUICMDVALIDATORCALLBACK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuicmdvalidatorcallback.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* 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:  Command validator callback class inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TVtUiCmdValidatorCallBack< T >::TVtUiCmdValidatorCallBack
+// -----------------------------------------------------------------------------
+//
+template < class T >
+TVtUiCmdValidatorCallBack< T >::TVtUiCmdValidatorCallBack(
+    const T& aInstance, TCallBackMethod aMethod )
+    : iInstance( &aInstance ), iMethod( aMethod )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiCmdValidatorCallBack< T >::Call
+// -----------------------------------------------------------------------------
+//
+template < class T >
+TBool TVtUiCmdValidatorCallBack< T >::Call( TInt aCommandId ) const
+    {
+    return ( iInstance->*iMethod )( aCommandId );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuicommandmodifierpriority.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* 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:  Command modifier priorities.
+*
+*/
+
+
+#ifndef VTUICOMMANDMODIFIERPRIORITIES_H
+#define VTUICOMMANDMODIFIERPRIORITIES_H
+
+/**
+ * Enumerates Modifier priorities
+ *
+ * @since S60 3.2
+ */
+enum TVtUiCmdModifierPriority
+    {
+    /** Undefined priority value */
+    EVtUiCmdModifierPriorityUndefined = 0,
+
+    /** Lowest possible priority */
+    EVtUiCmdModifierPriorityLowest = 1,
+
+    /** Menu Modifier priority */
+    EVtUiCmdModifierPriorityToolbar = 100,
+
+    /** Menu Modifier priority */
+    EVtUiCmdModifierPriorityNumberEntry = 101,
+
+    /** Highest possible priority */
+    EVtUiCmdModifierPriorityHighest = 500,
+    };
+
+#endif      // VTUICOMMANDMODIFIERPRIORITIES_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuilocalvariation.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* 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:  Video Telephone local variation class definition.
+*
+*/
+
+
+#ifndef T_VTUILOCALVARIATION_H
+#define T_VTUILOCALVARIATION_H
+
+#include <e32base.h>
+
+#include "tvtflagcontainer.h"
+
+// User selectable Call answer status values
+const TInt KAllwaysQuery = 0;
+const TInt KAllwaysAllow = 2;
+const TInt KNumberOfTbButtons = 6;
+
+/**
+ *  TVtUiVariationBase
+ *
+ *  Base class for local variation classes.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiVariationBase ) : public TVtFlagContainer
+    {
+public:
+
+     /**
+     * Reads variations from central reposityory.
+     * and set default value in case error
+     */
+    virtual void ReadL( const TInt adefault = -1 );
+
+protected:
+
+    /**
+     * Returns UID of the repository to be read.
+     */
+    virtual const TUid& Uid() const = 0;
+
+    /**
+     * ID of the key inside repository to be read.
+     */
+    virtual TUint32 Key() const = 0;
+
+    /**
+     * Gets key value.
+     */
+    virtual TUint32 ReceiveValue() const;
+
+    };
+
+/**
+ *  TVtUiVideoTelephonyVariation
+ *
+ *  Video Telephony variation class. Reads VT local variation flags from the
+ *  CenRep and contains methods to query flag states. This class should be
+ *  instanced only once and same instance should be passesd as reference to
+ *  modules that need this local variation information.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiVideoTelephonyVariation ) : public TVtUiVariationBase
+    {
+
+public:
+
+    /**
+     * Return whether or not ScalingMethodENearest is set in local variation.
+     *
+     * @return ETrue if ScalingMethodENearest local variation flag is set,
+     * EFalse otherwise.
+     */
+    inline TBool IsScalingMethodENearest() const;
+
+    /**
+     * Return whether or not ScalingMethodEBilinear is set in local variation.
+     *
+     * @return ETrue if ScalingMethodEBilinear local variation flag is set,
+     * EFalse otherwise.
+     */
+    inline TBool IsScalingMethodEBilinear() const;
+
+    /**
+     * Return whether or not EnableBitReversal is set in local variation.
+     *
+     * @return ETrue if EnableBitReversal local variation flag is set, EFalse
+     * otherwise.
+     */
+    inline TBool IsEnableBitReversal() const;
+
+private: // from TVtUiVariationBase
+
+    /**
+     * @see TVtUiVariationBase::Uid
+     */
+    const TUid& Uid() const;
+
+    /**
+     * @see TVtUiVariationBase::Key
+     */
+    TUint32 Key() const;
+    };
+
+/**
+ *  TVtUiActiveIdleVariation
+ *
+ *  Active Idle variation class. Reads AI local variation flags from the
+ *  CenRep and contains methods to query flag states. This class should be
+ *  instanced only once and same instance should be passesd as reference to
+ *  modules that need this local variation information.
+  *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiActiveIdleVariation ) : public TVtUiVariationBase
+    {
+
+public:
+    /**
+     * Return whether or not active idle is enabled in local variation.
+     *
+     * @return ETrue if active idle is enabled in local variation.
+     */
+    TBool IsActiveIdleEnabled();
+
+private: // from TVtUiVariationBase
+
+    /**
+     * @see TVtUiVariationBase::Uid
+     */
+    const TUid& Uid() const;
+
+    /**
+     * @see TVtUiVariationBase::Key
+     */
+    TUint32 Key() const;
+
+private:
+    };
+
+/**
+ *  TVtUiGsMuteVariation
+ *
+ *  General settings (Gs) variation class. Reads GS local variation flags from the
+ *  CenRep and contains methods to query flag states and values. This class should be
+ *  instanced only once and same instance should be passesd as reference to
+ *  modules that need this local variation information.
+  *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiGsMuteVariation ) : public TVtUiVariationBase
+    {
+
+public:
+
+    /**
+     * Returns Gs mute state value from CanRep.
+     *
+     * @return Gs mute state value.
+     */
+    TUint32 GsMuteState();
+
+private: // from TVtUiVariationBase
+
+    /**
+     * @see TVtUiVariationBase::Uid
+     */
+    const TUid& Uid() const;
+
+    /**
+     * @see TVtUiVariationBase::Key
+     */
+    TUint32 Key() const;
+
+private:
+    };
+
+/**
+ *  TVtUiToolbarVariation
+ *
+ *  Toolbar variation class. Reads TB local variation flags from the
+ *  CenRep and contains methods to query flag states and values. This class should be
+ *  instanced only once and same instance should be passesd as reference to
+ *  modules that need this local variation information.
+  *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiToolbarVariation ) : public TVtUiVariationBase
+    {
+
+public:
+    /**
+     * Returns number of toolbar buttons from CanRep.
+     *
+     * @return number of toolbar buttons.
+     */
+    TUint32 NumberOfButtons();
+
+private: // from TVtUiVariationBase
+
+    /**
+     * @see TVtUiVariationBase::Uid
+     */
+    const TUid& Uid() const;
+
+    /**
+     * @see TVtUiVariationBase::Key
+     */
+    TUint32 Key() const;
+
+private:
+    };
+
+
+#include "tvtuilocalvariation.inl"
+
+#endif // T_VTUILOCALVARIATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuilocalvariation.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* 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:  Video Telephone local variation class inline methods.
+*
+*/
+
+
+#include "VideoTelephonyVariant.hrh"
+
+// TVtUiVideoTelephonyVariation
+
+// -----------------------------------------------------------------------------
+// TVtUiVideoTelephonyVariation::IsScalingMethodENearest
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiVideoTelephonyVariation::IsScalingMethodENearest() const
+    {
+    return IsFlag( KVTLVFlagScalingMethodENearest );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiVideoTelephonyVariation::IsScalingMethodEBilinear
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiVideoTelephonyVariation::IsScalingMethodEBilinear() const
+    {
+    return IsFlag( KVTLVFlagScalingMethodEBilinear );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiVideoTelephonyVariation::IsEnableBitReversal
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiVideoTelephonyVariation::IsEnableBitReversal() const
+    {
+    return IsFlag( KVTLVFlagEnableBitReversal );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuimediastate.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,216 @@
+/*
+* 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:  Media state class definition.
+*
+*/
+
+
+#ifndef T_VTUIMEDIASTATE_H
+#define T_VTUIMEDIASTATE_H
+
+#include <e32base.h>
+
+#include "tvtflagcontainer.h"
+
+class MVtEngMedia;
+class MVtEngCommandHandler;
+
+/**
+ *  TVtUiMediaState
+ *
+ *  Contains information about media's (video) current status.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiMediaState ) : public TVtUpdateableFlagContainer
+    {
+public:
+
+    /**
+     * Constructor.
+     *
+     * @param aMedia Reference to VT engine media object.
+     * @param aCommandHandler Reference to command handler object.
+     */
+    inline TVtUiMediaState( MVtEngMedia& aMedia,
+        MVtEngCommandHandler& aCommandHandler );
+
+    /**
+     * Return whether or not video is being sent.
+     *
+     * @return ETrue if video is being sent.
+     */
+    inline TBool IsVideo() const;
+
+    /**
+     * Return whether or not any camera is available in device.
+     *
+     * @return ETrue if any camera is available in device.
+     */
+    inline TBool HasCamera() const;
+
+    /**
+     * Return whether or not freeze is supported for active video source.
+     *
+     * @return ETrue if freeze is supported for active video source.
+     */
+    inline TBool IsFreezeSupported() const;
+
+    /**
+     * Return whether or not active video source is frozen.
+     *
+     * @return ETrue if video is frozen.
+     */
+    inline TBool IsFrozen() const;
+
+    /**
+     * Return whether or not share is active.
+     *
+     * @return ETrue if still image is being shared.
+     */
+    inline TBool IsSharing() const;
+
+    /**
+     * Return whether or not sharing is being initialized.
+     *
+     * @return ETrue if still image sharing is being initialized.
+     */
+    inline TBool IsInitializingShare() const;
+
+    /**
+     * Return whether or not primary camera is being used by VT.
+     *
+     * @return ETrue if primary camera is being used.
+     */
+    inline TBool IsPrimaryCameraInUse() const;
+
+    /**
+     * Return whether or not secondary camera is being used by VT.
+     *
+     * @return ETrue if secondary camera is being used.
+     */
+    inline TBool IsSecondaryCameraInUse() const;
+
+    /**
+     * Return whether or not it is possible to share.
+     *
+     * @return ETrue if sharing is not allowed.
+     */
+    inline TBool IsNotAbleToShare() const;
+
+    /**
+     * Return whether or not device has primary camera.
+     *
+     * @return ETrue if primary camera is available.
+     */
+    inline TBool HasPrimaryCamera() const;
+
+    /**
+     * Return whether or not device has secondary camera.
+     *
+     * @return ETrue if secondary camera is available.
+     */
+    inline TBool HasSecondaryCamera() const;
+
+    /**
+     * Return whether or not active video source supports contrast setting.
+     *
+     * @return ETrue if contrast settingis allowed.
+     */
+    inline TBool IsContrastSupported() const;
+
+    /**
+     * Return whether or not active video source supports white balance setting.
+     *
+     * @return ETrue if white balance setting is allowed.
+     */
+    inline TBool IsWhiteBalanceSupported() const;
+
+    /**
+     * Return whether or not active video source supports color tone setting.
+     *
+     * @return ETrue if colour tone setting is allowed.
+     */
+    inline TBool IsColorToneSupported() const;
+
+    /**
+     * Return whether or not active video source supports brightness setting.
+     *
+     * @return ETrue if brightness setting is allowed.
+     */
+    inline TBool IsBrightnessSupported() const;
+    
+    /**
+     * Return whether or not video is permanently stopped.
+     *
+     * @return ETrue if video is permanently stopped.
+     */
+    inline TBool IsVideoPermanentlyStopped() const;
+
+private: // from TVtUpdateableFlagContainer
+
+    /**
+     * @see TVtUpdateableFlagContainer::UpdateFlags
+     */
+    void UpdateFlags();
+
+private:
+
+    // Enumeration for media state flags.
+    enum TFlags
+        {
+        /** Set if video is currently enabled. */
+        EIsVideo = ( 1<<0 ),
+        /** Set if device has any cameras */
+        EHasCamera = ( 1<<1 ),
+        /** Set if current active video source supports freezing */
+        EIsFreezeSupported = ( 1<<2 ),
+        /** Set if current active video source is frozen */
+        EIsFrozen = ( 1<<3 ),
+        /** Set if sharing is active */
+        EIsSharing = ( 1<<4 ),
+        /** Set if sharing is being initialized */
+        EIsInitializingShare = ( 1<<5 ),
+        /** Set if device's primary camera is being used by VT application */
+        EIsPrimaryCameraInUse = ( 1<<6 ),
+        /** Set if device's secondary camera is being used by VT application */
+        EIsSecondaryCameraInUse = ( 1<<7 ),
+        /** Set if it is not possible to share */
+        EIsNotAbleToShare = ( 1<<8 ),
+        /** Set if device has primary camera */
+        EHasPrimaryCamera = ( 1<<9 ),
+        /** Set if device has secondary camera */
+        EHasSecondaryCamera = ( 1<<10 ),
+        /** Set if current video source supports contrast setting */
+        EIsContrastSupported = ( 1<<11 ),
+        /** Set if current video source supports white balance setting */
+        EIsWhiteBalanceSupported = ( 1<<12 ),
+        /** Set if current video source supports color tone setting */
+        EIsColorToneSupported = ( 1<<13 ),
+        /** Set if current video source supports brightness setting */
+        EIsBrightnessSupported = ( 1<<14 ),
+        /** Set if video is permanently stopped*/
+        EIsVideoPermanentlyStopped = ( 1<<15 )
+        };
+
+    // Reference to engine media instance.
+    MVtEngMedia& iMedia;
+
+    // Reference to engine command handler instance.
+    MVtEngCommandHandler& iCommandHandler;
+    };
+
+#include "tvtuimediastate.inl"
+
+#endif // T_VTUIMEDIASTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuimediastate.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,171 @@
+/*
+* 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:  Media state class inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::TVtUiMediaState
+// -----------------------------------------------------------------------------
+//
+TVtUiMediaState::TVtUiMediaState( MVtEngMedia& aMedia,
+    MVtEngCommandHandler& aCommandHandler  )
+    : iMedia( aMedia ), iCommandHandler( aCommandHandler )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsVideo
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsVideo() const
+    {
+    return IsFlag( EIsVideo );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::HasCamera
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::HasCamera() const
+    {
+    return IsFlag( EHasCamera );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsFreezeSupported
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsFreezeSupported() const
+    {
+    return IsFlag( EIsFreezeSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsFrozen
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsFrozen() const
+    {
+    return IsFlag( EIsFrozen );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsSharing
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsSharing() const
+    {
+    return IsFlag( EIsSharing );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsInitializingShare
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsInitializingShare() const
+    {
+    return IsFlag( EIsInitializingShare );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsPrimaryCameraInUse
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsPrimaryCameraInUse() const
+    {
+    return IsFlag( EIsPrimaryCameraInUse );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsSecondaryCameraInUse
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsSecondaryCameraInUse() const
+    {
+    return IsFlag( EIsSecondaryCameraInUse );
+    }
+    
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsNotAbleToShare
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsNotAbleToShare() const
+    {
+    return IsFlag( EIsNotAbleToShare );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::HasPrimaryCamera
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::HasPrimaryCamera() const
+    {
+    return IsFlag( EHasPrimaryCamera );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::HasSecondaryCamera
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::HasSecondaryCamera() const
+    {
+    return IsFlag( EHasSecondaryCamera );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsContrastSupported
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsContrastSupported() const
+    {
+    return IsFlag( EIsContrastSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsWhiteBalanceSupported
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsWhiteBalanceSupported() const
+    {
+    return IsFlag( EIsWhiteBalanceSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsColorToneSupported
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsColorToneSupported() const
+    {
+    return IsFlag( EIsColorToneSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsBrightnessSupported
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsBrightnessSupported() const
+    {
+    return IsFlag( EIsBrightnessSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::IsVideoPermanentlyStopped
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiMediaState::IsVideoPermanentlyStopped() const
+	{
+	return IsFlag( EIsVideoPermanentlyStopped );
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuistates.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,679 @@
+/*
+* Copyright (c) 2007 - 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:  UI states class definition.
+*
+*/
+
+
+#ifndef T_VTUISTATES_H
+#define T_VTUISTATES_H
+
+#include <e32base.h>
+
+#include "tvtuimediastate.h"
+#include "tvtuiaudiostate.h"
+
+class CVtEngModel;
+class MVtEngCameraPreferences;
+
+/**
+ *  TVtUiStates
+ *
+ *  Contains information about Application UI's current status.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiStates ) : public TVtFlagContainer
+    {
+
+public: // enumerations
+
+    /**
+    * Application execution state (will be set by the app state classes)
+    */
+    enum TVtUiExecState
+        {
+        EExecStateStarting,
+        EExecStateRunning,
+        EExecStateResetting,
+        EExecStateFinalized
+        };
+
+public:
+
+    /**
+     * Constructor.
+     */
+    TVtUiStates( CVtEngModel& aModel );
+
+    /**
+     * Updates UI states.
+     */
+    void Update();
+
+    /**
+     * Return whether or not ColorToneSetting
+     * is supported by current camera.
+     *
+     * @return ETrue if at least one color tone setting is available,
+     * EFalse otherwise.
+     */
+    TBool IsColorToneSettingAvailable() const;
+
+    /**
+     * Return whether or not WhiteBalanceSetting
+     * is supported by current camera.
+     *
+     * @return ETrue if at least one white balance setting is available,
+     * EFalse otherwise.
+     */
+    TBool IsWhiteBalanceSettingAvailable() const;
+
+    /**
+     * Return whether or not ontrast setting
+     * is supported by current camera.
+     *
+     * @return ETrue if at contrast setting is available,
+     * EFalse otherwise.
+     */
+    TBool IsContrastSettingAvailable() const;
+
+    /**
+     * Return whether or not brightness setting
+     * is supported by current camera.
+     *
+     * @return ETrue if brightness setting is available,
+     * EFalse otherwise.
+     */
+    TBool IsBrightnessSettingAvailable() const;
+
+    /**
+     * Returns reference to media state object
+     *
+     * @return Reference to media state object.
+     */
+    inline const TVtUiMediaState& MediaState() const;
+
+    /**
+     * Returns reference to audio state object
+     *
+     * @return Reference to audio state object.
+     */
+    inline const TVtUiAudioState& AudioState() const;
+
+    /**
+     * Sets or clears EIsCLIReceived
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetCLIReceived( TBool aSet );
+
+    /**
+     * Check if EIsCLIReceived is set
+     *
+     * @return ETrue if EIsCLIReceived is set EFalse otherwise
+     */
+    inline TBool IsCLIReceived() const;
+
+    /**
+     * Sets or clears EIsLayoutChangeNeeded
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetLayoutChangeNeeded( TBool aSet );
+
+    /**
+     * Check if EIsLayoutChangeNeeded is set
+     *
+     * @return ETrue if EIsLayoutChangeNeeded is set EFalse otherwise
+     */
+    inline TBool IsLayoutChangeNeeded() const;
+
+    /**
+     * Sets or clears EIsBlankControlAdded
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetBlankControlAdded( TBool aSet );
+
+    /**
+     * Check if EIsBlankControlAdded is set
+     *
+     * @return ETrue if EIsBlankControlAdded is set EFalse otherwise
+     */
+    inline TBool IsBlankControlAdded() const;
+
+    /**
+     * Sets or clears EIsLaunchOkOptionsMenu
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetLaunchOkOptionsMenu( TBool aSet );
+
+    /**
+     * Check if EIsLaunchOkOptionsMenu is set
+     *
+     * @return ETrue if EIsLaunchOkOptionsMenu is set EFalse otherwise
+     */
+    inline TBool IsLaunchOkOptionsMenu() const;
+
+    /**
+     * Sets or clears EIsDeviceLockOn
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetDeviceLockOn( TBool aSet );
+
+    /**
+     * Check if EIsDeviceLockOn is set
+     *
+     * @return ETrue if EIsDeviceLockOn is set EFalse otherwise
+     */
+    inline TBool IsDeviceLockOn() const;
+
+    /**
+     * Sets or clears EDetailsReceived
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetDetailsReceived( TBool aSet );
+
+    /**
+     * Check if EDetailsReceived is set
+     *
+     * @return ETrue if EDetailsReceived is set EFalse otherwise
+     */
+    inline TBool IsDetailsReceived() const;
+
+    /**
+     * Sets or clears EWaitingForFirstFrame
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetWaitingForFirstFrame( TBool aSet );
+
+    /**
+     * Check if EWaitingForFirstFrame is set
+     *
+     * @return ETrue if EWaitingForFirstFrame is set EFalse otherwise
+     */
+    inline TBool IsWaitingForFirstFrame() const;
+
+    /**
+     * Sets or clears EUseSQCif
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetUseSQCif( TBool aSet );
+
+    /**
+     * Check if EUseSQCif is set
+     *
+     * @return ETrue if EUseSQCif is set EFalse otherwise
+     */
+    inline TBool IsUseSQCif() const;
+
+    /**
+     * Sets or clears EIsViewFindersInitialPlaceContextPane
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetViewFindersInitialPlaceContextPane( TBool aSet );
+
+    /**
+     * Check if EIsViewFindersInitialPlaceContextPane is set
+     *
+     * @return ETrue if EIsViewFindersInitialPlaceContextPane is set EFalse
+     * otherwise
+     */
+    inline TBool IsViewFindersInitialPlaceContextPane() const;
+
+    /**
+     * Sets or clears EViewFinderToMainPane
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetViewFinderToMainPane( TBool aSet );
+
+    /**
+     * Check if EViewFinderToMainPane is set
+     *
+     * @return ETrue if EViewFinderToMainPane is set EFalse otherwise
+     */
+    inline TBool IsViewFinderToMainPane() const;
+
+    /**
+     * Sets or clears EIsCaptureModeOn
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetCaptureModeOn( TBool aSet );
+
+    /**
+     * Check if EIsCaptureModeOn is set
+     *
+     * @return ETrue if EIsCaptureModeOn is set EFalse otherwise
+     */
+    inline TBool IsCaptureModeOn() const;
+
+    /**
+     * Sets or clears EIsThisApplicationForeground
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetThisApplicationForeground( TBool aSet );
+
+    /**
+     * Check if EIsThisApplicationForeground is set
+     *
+     * @return ETrue if EIsThisApplicationForeground is set EFalse otherwise
+     */
+    inline TBool IsThisApplicationForeground() const;
+
+    /**
+     * Sets or clears EIsDisableBlindSetting
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetDisableBlindSetting( TBool aSet );
+
+    /**
+     * Check if EIsDisableBlindSetting is set
+     *
+     * @return ETrue if EIsDisableBlindSetting is set EFalse otherwise
+     */
+    inline TBool IsDisableBlindSetting() const;
+
+    /**
+     * Sets or clears EExecShowCameraInUse
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetExecShowCameraInUse( TBool aSet );
+
+    /**
+     * Check if EExecShowCameraInUse is set
+     *
+     * @return ETrue if EExecShowCameraInUse is set EFalse otherwise
+     */
+    inline TBool IsExecShowCameraInUse() const;
+
+     /**
+     * Check if EIsZoomModeOn is set
+     *
+     * @return ETrue if EIsZoomModeOn is set EFalse otherwise
+     */
+    inline TBool IsZoomModeOn() const;
+
+    /**
+     * Sets or clears EIsZoomModeOn
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetZoomModeOn( TBool aSet );
+
+    /**
+    * Check if EIsWhiteBalanceModeOn is set
+    *
+    * @return ETrue if EIsWhiteBalanceModeOn is set EFalse otherwise
+    */
+    inline TBool IsWhiteBalanceModeOn() const;
+
+    /**
+     * Sets or clears EIsWhiteBalanceModeOn
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetWhiteBalanceModeOn( TBool aSet );
+
+    /**
+    * Check if EIsColorToneModeOn is set
+    *
+    * @return ETrue if EIsColorToneModeOn is set EFalse otherwise
+    */
+    inline TBool IsColorToneModeOn() const;
+
+    /**
+     * Sets or clears EIsColorToneModeOn
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetColorToneModeOn( TBool aSet );
+
+    /**
+    * Check if EBrightnessModeOn is set
+    *
+    * @return ETrue if EBrightnessModeOn is set EFalse otherwise
+    */
+    inline TBool IsBrightnessModeOn() const;
+
+    /**
+     * Sets or clears EBrightnessModeOn
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetBrightnessModeOn( TBool aSet );
+
+    /**
+     *  Check if EContrastModeOn is set
+     *
+     *  @return ETrue if EContrastModeOn is set EFalse otherwise
+     */
+    inline TBool IsContrastModeOn() const;
+
+    /**
+     * Sets or clears EContrastModeOn
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetContrastModeOn( TBool aSet );
+
+    /**
+     * Sets or clears EIsNumberEntryOpen
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetIsNumberEntryOpen( TBool aSet );
+
+    /**
+     * Check if EIsNumberEntryOpen is set
+     *
+     * @return ETrue if EIsNumberEntryOpen is set EFalse otherwise
+     */
+    inline TBool IsNumberEntryOpen() const;
+
+    /**
+     * Sets or clears EIsToolbarAvailable
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetIsToolbarAvailable( TBool aSet );
+
+    /**
+     * Check if IsToolbarAvailable is set
+     *
+     * @return ETrue if IsToolbarAvailable is set EFalse otherwise
+     */
+    inline TBool IsToolbarAvailable() const;
+
+    /**
+     * Sets or clears EIsWaitingCall
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetWaitingCall( TBool aSet );
+
+	/**
+     * Check if there is waiting video/voice call.
+     *
+     * @return ETrue if waiting call is ongoing, EFalse otherwise
+     */
+    inline TBool IsWaitingCall() const;
+
+     /**
+     * Sets or clears EIsSelectingShare
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+     inline void SetSelectingShare( TBool aSet );
+
+	/**
+     * Check if user is selecting file to be shared.
+     *
+     * @return ETrue if user is selecting file, EFalse otherwise
+     */
+    inline TBool IsSelectingShare() const;
+
+     /**
+     * Sets or clears EIsDialerOpen
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetIsDialerOpen( TBool aSet );
+
+	/**
+     * Check if video DTMF dialer is open.
+     *
+     * @return ETrue if dialer is open, EFalse otherwise
+     */
+    inline TBool IsDialerOpen() const;
+
+    /**
+     * Sets or clears EIsFixedToolbarVisible
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetIsFixedToolbarVisible( TBool aSet );
+
+	/**
+     * Check if fixed toolbar is visible.
+     *
+     * @return ETrue iftoolbar is visible, EFalse otherwise
+     */
+    inline TBool IsFixedToolbarVisible() const;
+
+    /**
+     * Sets or clears EIsDialerActivating
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetIsDialerActivating( TBool aSet );
+
+	/**
+     * Check if dialer is being activated
+     *
+     * @return ETrue if dialer is being activated, EFalse otherwise
+     */
+    inline TBool IsDialerActivating() const;
+
+    /**
+     * Adjusts command activating reference count
+     *
+     * @param aSet ETrue if setting will be increased, EFalse if
+     * decreased.
+     */
+    void SetIsCommandActivating( TBool aSet );
+
+	/**
+     * Check if command activating ref.count is greater than zero
+     *
+     * @return ETrue if any command is being activated, EFalse otherwise
+     */
+    inline TBool IsCommandActivating() const;
+
+    /**
+     *  Check if EIsVolumeModeOn is set
+     *
+     *  @return ETrue if EIsVolumeModeOn is set EFalse otherwise
+     */
+    inline TBool IsVolumeModeOn() const;
+
+    /**
+     * Sets or clears EIsVolumeModeOn
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetVolumeModeOn( TBool aSet );
+
+    /**
+     *  Check if EIsVideoQualityModeOn is set
+     *
+     *  @return ETrue if EIsVideoQualityModeOn is set EFalse otherwise
+     */
+    inline TBool IsVideoQualityModeOn() const;
+
+    /**
+     * Sets or clears EIsVideoQualityModeOn
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+     
+    inline void SetVideoQualityModeOn( TBool aSet );    
+    /**
+     * Sets or clears EIsFloatingToolbarVisible
+     *
+     * @param aSet ETrue if setting will be set, EFalse otherwise.
+     */
+    inline void SetIsFloatingToolbarVisible( TBool aSet );
+
+    /**
+     * Check if floating toolbar is visible.
+     *
+     * @return ETrue iftoolbar is visible, EFalse otherwise
+     */
+    inline TBool IsFloatingToolbarVisible() const;
+
+    /**
+    * Returns application's execution state.
+    * @return Application's current execution state.
+    */
+    TVtUiExecState ExecState() const;
+
+private: // methods to be accessed only by certain classes (see friends)
+
+    /**
+    * Sets application's execution state.
+    * @param aState Application's new execution state.
+    */
+    void SetExecState( const TVtUiExecState aState );
+
+private:
+
+    // Enumeration for ui state flags.
+    enum TFlags
+        {
+        /** Set if CLI is received */
+        EIsCLIReceived = ( 1<<0 ),
+
+        /** Set if layout change is needed */
+        EIsLayoutChangeNeeded = ( 1<<1 ),
+
+        /** Set if blank control has been added to control stack */
+        EIsBlankControlAdded = ( 1<<2 ),
+
+        /** Set if launch ok in options menu */
+        EIsLaunchOkOptionsMenu = ( 1<<3 ),
+
+        /** Set if device lock is on */
+        EIsDeviceLockOn = ( 1<<4 ),
+
+        /** Set if details have been received */
+        EDetailsReceived = ( 1<<5 ),
+
+        /** Set if waiting for first frame */
+        EWaitingForFirstFrame = ( 1<<6 ),
+
+        /** Set if SQCIF is being used */
+        EUseSQCif = ( 1 << 7 ),
+
+        /** Set if images was in context pane before freeze, unset if not */
+        EViewFindersInitialPlaceContextPane = ( 1<<8 ),
+
+        /** Set if viewfinder has to be moved to mainpane, when imageshare is
+            ready */
+        EViewFinderToMainPane = ( 1<<9 ),
+
+        /** Set if capture mode is on, unset if off */
+        EIsCaptureModeOn = ( 1<<10 ),
+
+        /** Set if application on foreground */
+        EIsThisApplicationForeground = ( 1<<11 ),
+
+        /** Set if blind setting should be temporarily disabled.
+            This is used in preventing blind bitmap from flashing
+            while operations involving multiple engine commands/events
+            take place (e.g. 'Swap image places' and layout switch). */
+        EIsDisableBlindSetting = ( 1<<12 ),
+
+        /** Set if camera in use note should be shown. */
+        EExecShowCameraInUse = ( 1<<13 ),
+
+        /** Set if zooming slider indicators is shown in navi pane.
+            Toolbar also dims other toolbar controls except zoom
+            mode control.*/
+        EIsZoomModeOn = ( 1<<14 ),
+
+        /** Set if contrast mode is on, unset if off */
+        EIsContrastModeOn = ( 1<<15 ),
+
+        /** Set if brightness mode is on, unset if off */
+        EIsBrightnessModeOn = ( 1<<16 ),
+
+        /** Set if number entry is open in UI (do not use this flag in new code)
+         */
+        EIsNumberEntryOpen = ( 1<<17 ),
+
+        /** Set if toolbar is available in UI */
+        EIsToolbarAvailable = ( 1<<18 ),
+
+		/** Set if waiting call exists */
+        EIsWaitingCall = ( 1<<19 ),
+
+        /** Set if initializing share */
+        EIsSelectingShare = ( 1<<20 ),
+
+        /** Set if initializing share */
+        EIsDialerOpen = ( 1<<21 ),
+
+        /** Set if white balance mode is on, unset if off */
+        EIsWhiteBalanceModeOn = ( 1<<22 ),
+
+        /** Set if color tone mode is on, unset if off */
+        EIsColorToneModeOn = ( 1 << 23 ),
+
+        /** Set if fixed toolar is visible, unset if not */
+        EIsFixedToolbarVisible = ( 1 << 24 ),
+
+        /** Set if dialer is being activated, unset if not */
+        EIsDialerActivating = ( 1 << 25 ),
+
+        /** Set if volume mode is on, unset if off */
+        EIsVolumeModeOn = ( 1 << 26 ),
+
+        /** Set if floating toolar is visible, unset if not */
+        EIsFloatingToolbarVisible = ( 1 << 27 ),
+        
+        /** Set if video quality mode is on, unset if not */
+        EIsVideoQualityModeOn = ( 1 << 28 )
+        };
+
+    // Engine media state
+    TVtUiMediaState iMediaState;
+
+    // Engine audio state
+    TVtUiAudioState iAudioState;
+
+    // Refrence to engine
+    CVtEngModel& iModel;
+
+    // Refrence to camera prefrences
+    MVtEngCameraPreferences* iCameraPref;
+
+    // Application execution state
+    TVtUiExecState iExecState;
+    
+    // Reference count of command activating. Enables command to be set
+    // active several times and action to take only when count is reset
+    // back to zer0.
+    TUint iCommandActivatingRefCount;
+
+private: // friends
+
+    friend class TVtUiAppStateBase;
+
+    };
+
+#include "tvtuistates.inl"
+
+#endif // T_VTUISTATES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/commands/tvtuistates.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,596 @@
+/*
+* Copyright (c) 2007 - 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:  UI states class inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::MediaState
+// -----------------------------------------------------------------------------
+//
+const TVtUiMediaState& TVtUiStates::MediaState() const
+    {
+    return iMediaState;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::AudioState
+// -----------------------------------------------------------------------------
+//
+const TVtUiAudioState& TVtUiStates::AudioState() const
+    {
+    return iAudioState;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetCLIReceived
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetCLIReceived( TBool aSet )
+    {
+    aSet ? SetFlag( EIsCLIReceived ) : ClearFlag( EIsCLIReceived );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsCLIReceived
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsCLIReceived() const
+    {
+    return IsFlag( EIsCLIReceived );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetLayoutChangeNeeded
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetLayoutChangeNeeded( TBool aSet )
+    {
+    aSet ? SetFlag( EIsLayoutChangeNeeded ) :
+        ClearFlag( EIsLayoutChangeNeeded );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsLayoutChangeNeeded
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsLayoutChangeNeeded() const
+    {
+    return IsFlag( EIsLayoutChangeNeeded );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetBlankControlAdded
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetBlankControlAdded( TBool aSet )
+    {
+    aSet ? SetFlag( EIsBlankControlAdded ) :
+        ClearFlag( EIsBlankControlAdded );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsBlankControlAdded
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsBlankControlAdded() const
+    {
+    return IsFlag( EIsBlankControlAdded );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetLaunchOkOptionsMenu
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetLaunchOkOptionsMenu( TBool aSet )
+    {
+    aSet ? SetFlag( EIsLaunchOkOptionsMenu ) :
+        ClearFlag( EIsLaunchOkOptionsMenu );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsLaunchOkOptionsMenu
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsLaunchOkOptionsMenu() const
+    {
+    return IsFlag( EIsLaunchOkOptionsMenu );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetDeviceLockOn
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetDeviceLockOn( TBool aSet )
+    {
+    aSet ? SetFlag( EIsDeviceLockOn ) :
+        ClearFlag( EIsDeviceLockOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsDeviceLockOn
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsDeviceLockOn() const
+    {
+    return IsFlag( EIsDeviceLockOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetDetailsReceived
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetDetailsReceived( TBool aSet )
+    {
+    aSet ? SetFlag( EDetailsReceived ) :
+        ClearFlag( EDetailsReceived );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsDetailsReceived
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsDetailsReceived() const
+    {
+    return IsFlag( EDetailsReceived );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetWaitingForFirstFrame
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetWaitingForFirstFrame( TBool aSet )
+    {
+    aSet ? SetFlag( EWaitingForFirstFrame ) :
+        ClearFlag( EWaitingForFirstFrame );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsWaitingForFirstFrame
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsWaitingForFirstFrame() const
+    {
+    return IsFlag( EWaitingForFirstFrame );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetUseSQCif
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetUseSQCif( TBool aSet )
+    {
+    aSet ? SetFlag( EUseSQCif ) :
+        ClearFlag( EUseSQCif );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsUseSQCif
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsUseSQCif() const
+    {
+    return IsFlag( EUseSQCif );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetViewFindersInitialPlaceContextPane
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetViewFindersInitialPlaceContextPane( TBool aSet )
+    {
+    aSet ? SetFlag( EViewFindersInitialPlaceContextPane ) :
+        ClearFlag( EViewFindersInitialPlaceContextPane );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsViewFindersInitialPlaceContextPane
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsViewFindersInitialPlaceContextPane() const
+    {
+    return IsFlag( EViewFindersInitialPlaceContextPane );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetViewFinderToMainPane
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetViewFinderToMainPane( TBool aSet )
+    {
+    aSet ? SetFlag( EViewFinderToMainPane ) :
+        ClearFlag( EViewFinderToMainPane );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsViewFinderToMainPane
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsViewFinderToMainPane() const
+    {
+    return IsFlag( EViewFinderToMainPane );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetCaptureModeOn
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetCaptureModeOn( TBool aSet )
+    {
+    aSet ? SetFlag( EIsCaptureModeOn ) :
+        ClearFlag( EIsCaptureModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsCaptureModeOn
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsCaptureModeOn() const
+    {
+    return IsFlag( EIsCaptureModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetThisApplicationForeground
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetThisApplicationForeground( TBool aSet )
+    {
+    aSet ? SetFlag( EIsThisApplicationForeground ) :
+        ClearFlag( EIsThisApplicationForeground );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsThisApplicationForeground
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsThisApplicationForeground() const
+    {
+    return IsFlag( EIsThisApplicationForeground );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetDisableBlindSetting
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetDisableBlindSetting( TBool aSet )
+    {
+    aSet ? SetFlag( EIsDisableBlindSetting ) :
+        ClearFlag( EIsDisableBlindSetting );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsDisableBlindSetting
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsDisableBlindSetting() const
+    {
+    return IsFlag( EIsDisableBlindSetting );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetExecShowCameraInUse
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetExecShowCameraInUse( TBool aSet )
+    {
+    aSet ? SetFlag( EExecShowCameraInUse ) :
+        ClearFlag( EExecShowCameraInUse );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsExecShowCameraInUse
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsExecShowCameraInUse() const
+    {
+    return IsFlag( EExecShowCameraInUse );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsZoomModeOn
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsZoomModeOn() const
+    {
+    return IsFlag( EIsZoomModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetZoomModeOn
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetZoomModeOn( TBool aSet )
+    {
+    aSet ? SetFlag( EIsZoomModeOn ) :
+        ClearFlag( EIsZoomModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsWhiteBalanceModeOn
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsWhiteBalanceModeOn() const
+    {
+    return IsFlag( EIsWhiteBalanceModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetWhiteBalanceModeOn
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetWhiteBalanceModeOn( TBool aSet )
+    {
+    aSet ? SetFlag( EIsWhiteBalanceModeOn ) :
+        ClearFlag( EIsWhiteBalanceModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsColorToneModeOn
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsColorToneModeOn() const
+    {
+    return IsFlag( EIsColorToneModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetColorToneModeOn
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetColorToneModeOn( TBool aSet )
+    {
+    aSet ? SetFlag( EIsColorToneModeOn ) :
+        ClearFlag( EIsColorToneModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsBrightnessModeOn
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsBrightnessModeOn() const
+    {
+    return IsFlag( EIsBrightnessModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetBrightnessModeOn
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetBrightnessModeOn( TBool aSet )
+    {
+    aSet ? SetFlag( EIsBrightnessModeOn ) :
+        ClearFlag( EIsBrightnessModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsContrastModeOn
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsContrastModeOn() const
+    {
+    return IsFlag( EIsContrastModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetContrastModeOn
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetContrastModeOn( TBool aSet )
+    {
+    aSet ? SetFlag( EIsContrastModeOn ) :
+        ClearFlag( EIsContrastModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetIsNumberEntryOpen
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetIsNumberEntryOpen( TBool aSet )
+    {
+    aSet ? SetFlag( EIsNumberEntryOpen ) :
+        ClearFlag( EIsNumberEntryOpen );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsNumberEntryOpen
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsNumberEntryOpen() const
+    {
+    return IsFlag( EIsNumberEntryOpen );
+    }
+
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetIsToolbarAvailable
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetIsToolbarAvailable( TBool aSet )
+    {
+    aSet ? SetFlag( EIsToolbarAvailable ) :
+        ClearFlag( EIsToolbarAvailable );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsToolbarAvailable
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsToolbarAvailable() const
+    {
+    return IsFlag( EIsToolbarAvailable );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates:::SetWaitingCall
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetWaitingCall( TBool aSet )
+    {
+    aSet ? SetFlag( EIsWaitingCall ) :
+        ClearFlag( EIsWaitingCall );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsWaitingCall
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsWaitingCall() const
+    {
+    return IsFlag( EIsWaitingCall );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates:::SetSelectingShare
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetSelectingShare( TBool aSet )
+    {
+    aSet ? SetFlag( EIsSelectingShare ) :
+        ClearFlag( EIsSelectingShare );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsSelectingShare
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsSelectingShare() const
+    {
+    return IsFlag( EIsSelectingShare );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetIsDialerOpen
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetIsDialerOpen( TBool aSet )
+    {
+    aSet ? SetFlag( EIsDialerOpen ) :
+        ClearFlag( EIsDialerOpen );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsDialerOpen
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsDialerOpen() const
+    {
+    return IsFlag( EIsDialerOpen );
+    }
+
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetIsFixedToolbarVisible
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetIsFixedToolbarVisible( TBool aSet )
+    {
+    aSet ? SetFlag( EIsFixedToolbarVisible ) :
+        ClearFlag( EIsFixedToolbarVisible );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsFixedToolbarVisible
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsFixedToolbarVisible() const
+    {
+    return IsFlag( EIsFixedToolbarVisible );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetIsDialerActivating
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetIsDialerActivating( TBool aSet )
+    {
+    aSet ? SetFlag( EIsDialerActivating ) :
+        ClearFlag( EIsDialerActivating );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsDialerActivating
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsDialerActivating() const
+    {
+    return IsFlag( EIsDialerActivating );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsCommandActivating
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsCommandActivating() const
+    {
+    return iCommandActivatingRefCount > 0;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsVolumeModeOn
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsVolumeModeOn() const
+    {
+    return IsFlag( EIsVolumeModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetVolumeModeOn
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetVolumeModeOn( TBool aSet )
+    {
+    aSet ? SetFlag( EIsVolumeModeOn ) :
+        ClearFlag( EIsVolumeModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetIsFloatingToolbarVisible
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetIsFloatingToolbarVisible( TBool aSet )
+    {
+    aSet ? SetFlag( EIsFloatingToolbarVisible ) :
+        ClearFlag( EIsFloatingToolbarVisible );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsFloatingToolbarVisible
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsFloatingToolbarVisible() const
+    {
+    return IsFlag( EIsFloatingToolbarVisible );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsVideoQualityModeOn
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsVideoQualityModeOn() const
+    {
+    return IsFlag( EIsVideoQualityModeOn );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetVideoQualityModeOn
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetVideoQualityModeOn( TBool aSet )
+    {
+    aSet ? SetFlag( EIsVideoQualityModeOn ) :
+        ClearFlag( EIsVideoQualityModeOn );
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/compman/cvtuicomponentmanager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,435 @@
+/*
+* 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:  Component manager implementation.
+*
+*/
+
+
+#ifndef C_VTUICOMPONENTMANAGER_H
+#define C_VTUICOMPONENTMANAGER_H
+
+#include <coeaui.h>
+
+#include "mvtuicomponentmanager.h"
+#include "mvtuicomponent.h"
+#include "tvtuicomponentstate.h"
+
+/**
+ *  CVtUiComponentManager
+ *
+ *  Component manager implementation.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiComponentManager )
+    : public CBase, public MVtUiComponentManager
+    {
+
+public: // public methods
+
+    /**
+     * Static constructor.
+     *
+     * @return Newly created instance of CVtUiComponentManager class.
+     */
+    static CVtUiComponentManager* NewL();
+
+    /**
+     * Destructor.
+     */
+    ~CVtUiComponentManager();
+
+    /**
+     * Called when a Ws event is delivered.
+     *
+     * @param aEvent Window server event.
+     * @param aDestination Event destination control.
+     */
+    void HandleWsEventL( const TWsEvent& aEvent, CCoeControl *aDestination );
+
+    /**
+     * Called when a resource change is informed.
+     *
+     * @param aType Type of change.
+     */
+    void HandleResourceChangeL( TInt aType );
+
+    /**
+     * Called when a keyevent needs handling.
+     *
+     * @param aKeyEvent Key event structure.
+     * @param aCode Event code.
+     */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
+
+    /**
+     * Called when a layout change is informed.
+     *
+     */
+    void HandleLayoutChangeL();
+
+public: // from MVtUiComponentManager
+
+    /**
+     * @see MVtUiComponentManager::ChangeWsEventRegistration
+     */
+    TInt ChangeWsEventRegistration( MVtUiWindowServerEventObserver& aObserver,
+        TAction aAction );
+
+    /**
+     * @see MVtUiComponentManager::ChangeResourceChangeRegistration
+     */
+    TInt ChangeResourceChangeRegistration(
+        MVtUiResourceChangeObserver& aObserver,
+        TAction aAction );
+
+    /**
+     * @see MVtUiComponentManager::ChangeKeyEventRegistration
+     */
+    TInt ChangeKeyEventRegistration( MVtUiKeyEventObserver& aComponent,
+        TAction aAction );
+
+    /**
+     * @see MVtUiComponentManager::ChangeLayoutChangeRegistration
+     */
+    TInt ChangeLayoutChangeRegistration( MVtUiLayoutChangeObserver& aComponent,
+        TAction aAction );
+
+    /**
+     * @see MVtUiComponentManager::ChangeComponentRegistration
+     */
+    TInt ChangeComponentRegistration( TVtUiComponentState& aComponentState,
+        TAction aAction );
+
+    /**
+     * @see MVtUiComponentManager::RequestActivation
+     */
+    void RequestActivationL( MVtUiComponent::TComponentId aId );
+
+    /**
+     * @see MVtUiComponentManager::DeActivateComponentL
+     */
+    void DeActivateComponentL( MVtUiComponent::TComponentId aId );
+
+private: // private classes
+
+    /**
+     * TStateListItem
+     *
+     * Contains one component's state in state list.
+     */
+    class TStateListItem
+        {
+
+    public: // public type definitions
+
+		/**
+		 * Compare by key type definition.
+		 */
+        typedef TInt (*TKeyCmpFunc)
+            ( const MVtUiComponent::TComponentId*, const TStateListItem& );
+
+    public: // public methods
+
+		/**
+		 * Constructor
+		 *
+		 * @param aState Constant reference to component state.
+		 */
+        TStateListItem( const TVtUiComponentState& aState );
+
+		/**
+		 * Returns component id.
+		 *
+		 * @return Component's id.
+		 */
+        MVtUiComponent::TComponentId ComponentId() const;
+
+		/**
+		 * Returns component's state.
+		 *
+		 * @return Component's state.
+		 */
+        TVtUiComponentState::TState State() const;
+
+		/**
+		 * Sets component's state.
+		 *
+		 * @param aState Component's new state.
+		 */
+        void SetState( TVtUiComponentState::TState aState );
+
+		/**
+		 * Returns const reference to block list.
+		 *
+		 * @return Constant reference to block list.
+		 */
+        const TVtUiBlockList& BlockList() const;
+
+		/**
+		 * Sets this object as root.
+		 */
+        void SetRoot();
+
+		/**
+		 * Returns ETrue if this object is root.
+		 *
+		 * @return ETrue if this item is root, EFalse otherwise.
+		 */
+        TBool IsRoot() const;
+
+		/**
+		 * Sets this object as visited.
+		 */
+        void SetVisited();
+
+		/**
+		 * Returns ETrue if this object is visited.
+		 *
+		 * @return ETrue if this item has been visited, EFalse otherwise.
+		 */
+        TBool IsVisited() const;
+
+    public: // static public methods
+
+		/**
+		 * Returns TLinearOrder for RArray operations. Ordered by component id.
+		 *
+		 * @return TLinearOrder insntace for RArray operations. Ordering will
+		 * be done based on component Id.
+		 */
+        static TLinearOrder< TStateListItem > LinearOrder();
+
+		/**
+		 * Returns key order function for RArray operations.
+		 *
+		 * @return Key compare method pointer for RArray operations.
+		 */
+        static TKeyCmpFunc KeyOrder();
+
+		/**
+		 * Returns TLinearOrder for RArray operations. Ordered by component
+		 * state.
+		 *
+		 * @return TLinearOrder instance for RArray operations. Ordering will
+		 * be done based on component state.
+		 */
+        static TLinearOrder< TStateListItem > StateOrder();
+
+    private: // static private methods
+
+		/**
+		 * StateListItem compare method.
+		 */
+        static TInt ItemCmpFunc( const TStateListItem& aItem1,
+            const TStateListItem& aItem2 );
+
+		/**
+		 * StateListItem vs key compare method.
+		 */
+        static TInt KeyCmpFunc( const MVtUiComponent::TComponentId* aKey,
+            const TStateListItem& aItem );
+
+		/**
+		 * StateListItem by state compare method.
+		 */
+        static TInt StateCmpFunc( const TStateListItem& aItem1,
+            const TStateListItem& aItem2 );
+
+    private: // data
+
+        // Component's ID
+        MVtUiComponent::TComponentId iComponentId;
+
+        // Component's state
+        TVtUiComponentState::TState iState;
+
+        // Block mask (IDs which will be blocked by this component)
+        TVtUiBlockListBitField iBlockList;
+
+        // ETrue if this component is the root compoent, EFalse otherwise
+        TBool iIsRoot;
+
+        // ETrue if this component has been already visited (i.e. evaluated)
+        TBool iIsVisited;
+
+        };
+
+    /**
+     * TStateList
+     *
+     * Contains list of component states. This list can be modified and when all
+     * modifications are ready, the whole list can be commited at once.
+     *
+     */
+    class TStateList
+        {
+
+    public: // public methods
+
+		/**
+		 * Constructor.
+		 */
+        TStateList();
+
+		/**
+		 * Destructor.
+		 */
+        ~TStateList();
+
+		/**
+		 * Add new item to state list.
+		 *
+		 * @param aItem Reference to item to be added to the list.
+		 */
+        void AddItemL( TStateListItem& aItem );
+
+		/**
+		 * Returns number of items in state list.
+		 *
+		 * @return Number of items on list.
+		 */
+        TInt ItemCount() const;
+
+		/**
+		 * Find state list item by component id.
+		 *
+		 * @param aComponentId Id of component that will be searched.
+		 * @return Index of the component or KErrNotFound if component with
+		 * given Id could not be found.
+		 */
+        TInt FindItem( MVtUiComponent::TComponentId aComponentId ) const;
+
+		/**
+		 * Returns reference to state list item at given index.
+		 *
+		 * @param aIndex Index of the item to be fetched.
+		 * @return Reference to item at given index.
+		 */
+        TStateListItem& At( TInt aIndex );
+
+		/**
+		 * Returns const reference to state list item at given index.
+		 *
+		 * @param aIndex Index of the item to be fetched.
+		 * @return Constant reference to item at given index.
+		 */
+        const TStateListItem& At( TInt aIndex ) const;
+
+		/**
+		 * Sorts list using given linear order.
+		 *
+		 * @param aOrder TLinearObject that will be used in sorting.
+		 */
+        void Sort(
+            TLinearOrder< CVtUiComponentManager::TStateListItem > aOrder );
+
+    private: // data
+
+        // List items
+        RArray< TStateListItem > iItems;
+
+        };
+
+private: // enumerations
+
+    /**
+     * Activation actions
+     */
+    enum TActivationAction
+        {
+        /** Hide component */
+        EHide,
+        /** Show component */
+        EShow
+        };
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiComponentManager();
+
+    /**
+     * 2nd constructor, may leave
+     */
+    void ConstructL();
+
+    /**
+     * Adds or removes component from given array.
+     */
+    template < class T >
+    TInt AddOrRemoveComponent( RPointerArray< T >& aArray, T* aComponent,
+        TAction aAction );
+
+    /**
+     * Returns linear order object for array operations.
+     */
+    static TLinearOrder< MVtUiComponent > ComponentOrder();
+
+    /**
+     * Returns linear order object for array operations.
+     */
+    static TLinearOrder< TVtUiComponentState > ComponentStateOrder();
+
+    /**
+     * Starts activation process.
+     */
+    void DoActivationL( TVtUiComponentState& aComponentState,
+        TVtUiComponentState::TState aNewState );
+
+    /**
+     * Starts deactivation process.
+     */
+    void DoDeactivationL( TVtUiComponentState& aComponentState,
+        TVtUiComponentState::TState aNewState );
+
+    /**
+     * Calculates activation.
+     */
+    void CalculateActivationL( const TVtUiBlockList& aBlockList,
+        const TVtUiBlockList& aExclList, TStateList& aStateList,
+        TActivationAction aAction );
+
+    /**
+     * Commits activation calculation results.
+     */
+    void CommitStateListL( TStateList& aList );
+
+    /**
+     * Constructs component state list before the calculations.
+     */
+    void ConstructStateListL( TStateList& aList );
+
+private: // data
+
+    // Window server event listeners
+    RPointerArray< MVtUiWindowServerEventObserver > iWsEventObservers;
+
+    // Resource change event listeners
+    RPointerArray< MVtUiResourceChangeObserver > iResourceChangeObservers;
+
+    // Key event listeners
+    RPointerArray< MVtUiKeyEventObserver > iKeyEventObservers;
+    
+    // Layout change listeners
+    RPointerArray< MVtUiLayoutChangeObserver > iLayoutChangeObservers;
+
+    // Registered components
+    RPointerArray< TVtUiComponentState > iComponents;
+
+    };
+
+#endif // C_VTUICOMPONENTMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/compman/mvtuicomponent.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* 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:  VT UI Component API definition.
+*
+*/
+
+
+#ifndef M_VTUICOMPONENT_H
+#define M_VTUICOMPONENT_H
+
+#include <e32base.h>
+
+class CCoeControl;
+
+/**
+ *  MVtUiComponent
+ *
+ *  UI component API definition.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiComponent
+    {
+
+public: // enumerations
+
+    /**
+     * Component Ids.
+     */
+    enum TComponentId
+        {
+        /** NULL component Id */
+        EComponentIdNull =                  0,
+        /** Toobar component Id */
+        EComponentIdToolbar =               ( 1 << 0 ),
+        /** Number entry component Id */
+        EComponentIdNumberEntry =           ( 1 << 1 ),
+        /** Video quality component id */
+        EComponentIdVideoQuality  =         ( 1 << 2 ),
+        /** White balance feature id */
+        EComponentIdWhiteBalance =          ( 1 << 3 ),
+        /** Color tone component id */
+        EComponentIdColorTone =             ( 1 << 4 ),
+        /** Brightness component id */
+        EVComponentIdBrightness =           ( 1 << 5 ),
+        /** Contrast component id */
+        EVComponentIdContrast =             ( 1 << 6 ),
+        /** Dialer component id  */
+        EComponentIdDialer =                ( 1 << 7 ),
+        /** Volume component id  */
+        EComponentIdVolume =                ( 1 << 8 ),
+        /** Zoom component id  */
+        EComponentIdZoom =                  ( 1 << 9 )
+        };
+
+public: // public methods
+
+    /**
+     * Returns component id.
+     *
+     * @return Component's id.
+     */
+    virtual TComponentId ComponentId() const = 0;
+
+    /**
+     * Returns this component as a CCoeControl.
+     *
+     * @return Component as a pointer to CCoeControl or NULL if this component
+     * is not inherited from CCoeControl.
+     */
+    virtual CCoeControl* ComponentAsControl() = 0;
+
+    /**
+     * Activates component.
+     */
+    virtual void DoActivateL() = 0;
+
+    /**
+     * Deactivates component.
+     */
+    virtual void DoDeactivateL() = 0;
+
+    };
+
+#endif // M_VTUICOMPONENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/compman/mvtuicomponentmanager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,131 @@
+/*
+* 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:  VT UI Component manager API definition.
+*
+*/
+
+
+#ifndef M_VTUICOMPONENTMANAGER_H
+#define M_VTUICOMPONENTMANAGER_H
+
+#include <e32base.h>
+
+#include "mvtuicomponent.h"
+
+class TVtUiComponentState;
+class MVtUiWindowServerEventObserver;
+class MVtUiResourceChangeObserver;
+class MVtUiKeyEventObserver;
+class MVtUiLayoutChangeObserver;
+
+/**
+ *  MVtUiComponentManager
+ *
+ *  Component manager API definition.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiComponentManager
+    {
+
+public: // enumerations
+
+    /**
+     * Registration action.
+     */
+    enum TAction
+        {
+        /** Register action */
+        ERegister,
+
+        /** Unregister action */
+        EUnregister
+        };
+
+public: // public methods
+
+    /**
+     * Register or unregister Ws event listening.
+     *
+     * @param aComponent Observer whose registration will be changed.
+     * @param aAction Registration action
+     * @see MVtUiComponentManager::TAction
+     * @return KErrNone if registration action succeeded.
+     */
+    virtual TInt ChangeWsEventRegistration(
+        MVtUiWindowServerEventObserver& aComponent,
+        TAction aAction ) = 0;
+
+    /**
+     * Register or unregister resource change event listening.
+     *
+     * @param aComponent Observer whose registration will be changed.
+     * @param aAction Registration action
+     * @see MVtUiComponentManager::TAction
+     * @return KErrNone if registration action succeeded.
+     */
+    virtual TInt ChangeResourceChangeRegistration(
+        MVtUiResourceChangeObserver& aComponent,
+        TAction aAction ) = 0;
+
+    /**
+     * Register or unregister key event listening.
+     *
+     * @param aComponent Observer whose registration will be changed.
+     * @param aAction Registration action
+     * @see MVtUiComponentManager::TAction
+     * @return KErrNone if registration action succeeded.
+     */
+    virtual TInt ChangeKeyEventRegistration( MVtUiKeyEventObserver& aComponent,
+        TAction aAction ) = 0;
+
+    /**
+     * Register or unregister layout change listening.
+     *
+     * @param aComponent Observer whose registration will be changed.
+     * @param aAction Registration action
+     * @see MVtUiComponentManager::TAction
+     * @return KErrNone if registration action succeeded.
+     */
+    virtual TInt ChangeLayoutChangeRegistration( MVtUiLayoutChangeObserver& aComponent,
+        TAction aAction ) = 0;
+
+    /**
+     * Register or unregister component.
+     *
+     * @param aComponent Observer whose registration will be changed.
+     * @param aAction Registration action
+     * @see MVtUiComponentManager::TAction
+     * @return KErrNone if registration action succeeded.
+     */
+    virtual TInt ChangeComponentRegistration( TVtUiComponentState& aComponent,
+        TAction aAction ) = 0;
+
+    /**
+     * Request component activation.
+     *
+     * @param aId Id of component to be activated.
+     */
+    virtual void RequestActivationL( MVtUiComponent::TComponentId aId ) = 0;
+
+    /**
+     * Deactivate component.
+     *
+     * @param aId Id of component to be deactivated.
+     */
+    virtual void DeActivateComponentL( MVtUiComponent::TComponentId aId ) = 0;
+
+    };
+
+#endif // M_VTUICOMPONENTMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/compman/mvtuikeyeventobserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* 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:  Key event observer API for components.
+*
+*/
+
+
+#ifndef M_VTUIKEYEVENTOBSERVER_H
+#define M_VTUIKEYEVENTOBSERVER_H
+
+#include <w32std.h>
+#include <coedef.h>
+
+/**
+ *  MVtUiKeyEventObserver
+ *
+ *  Keyevent observer API definition.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiKeyEventObserver
+    {
+
+public:
+
+    /**
+     * Called when key event handling is required.
+     *
+     * @param aEvent The key event.
+     * @param aCode The type of key event: EEventKey, EEventKeyUp or
+     * EEventKeyDown.
+     * @return Indicates whether or not the key event was used.
+     */
+    virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent,
+        TEventCode aCode ) = 0;
+
+    };
+
+#endif // M_VTUIKEYEVENTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/compman/mvtuilayoutchangeobserver.h	Mon Nov 23 14:47:47 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:  Layout change observer API definition.
+*
+*/
+
+
+#ifndef M_VTUILAYOUTCHANGEOBSERVER_H
+#define M_VTUILAYOUTCHANGEOBSERVER_H
+
+#include <e32def.h>
+
+/**
+ *  MVtUiLayoutChangeObserver
+ *
+ *  Layout change observer API definition.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiLayoutChangeObserver
+    {
+
+public:
+
+    /**
+     * Called when layout have been changed.
+     *
+     */
+    virtual void HandleLayoutChangeL() = 0;
+
+    };
+
+#endif // M_VTUIRESOURCECHANGEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/compman/mvtuiresourcechangeobserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* 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:  Resource change observer API definition.
+*
+*/
+
+
+#ifndef M_VTUIRESOURCECHANGEOBSERVER_H
+#define M_VTUIRESOURCECHANGEOBSERVER_H
+
+#include <e32def.h>
+
+/**
+ *  MVtUiResourceChangeObserver
+ *
+ *  Resource change observer API definition.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiResourceChangeObserver
+    {
+
+public:
+
+    /**
+     * Called when resources have been changed.
+     *
+     * @param aType The type of resources that have changed.
+     */
+    virtual void HandleResourceChangeL( TInt aType ) = 0;
+
+    };
+
+#endif // M_VTUIRESOURCECHANGEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/compman/mvtuiwindowservereventobserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* 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:  Window Server event observer API definition.
+*
+*/
+
+
+#ifndef M_VTUIWINDOWSERVEREVENTOBSERVER_H
+#define M_VTUIWINDOWSERVEREVENTOBSERVER_H
+
+class TWsEvent;
+class CCoeControl;
+
+/**
+ *  MVtUiWindowServerEventObserver
+ *
+ *  Window Server event observer API definition.
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiWindowServerEventObserver
+    {
+
+public:
+
+    /**
+     * Called when window server event handling is required.
+     *
+     * @param aEvent A window server event.
+     * @param aDestination The control associated with the event.
+     * This is only relevant for pointer events.
+     */
+    virtual void HandleWsEventL( const TWsEvent& aEvent,
+        CCoeControl* aDestination ) = 0;
+
+    };
+
+#endif // M_VTUIWINDOWSERVEREVENTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/compman/tvtuiblocklists.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,217 @@
+/*
+* 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:  VT UI component state definition.
+*
+*/
+
+
+#ifndef T_VTUIBLOCKLISTS_H
+#define T_VTUIBLOCKLISTS_H
+
+#include <e32base.h>
+
+#include "mvtuicomponent.h"
+
+/**
+ *  CVtUiBlockListIterator
+ *
+ *  Class for iterating through component's block list.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiBlockListIterator ) : public CBase
+    {
+
+public: // public abstract methods
+
+    /**
+     * Returns ETrue if there is more component Ids left in the iterator.
+     *
+     * @return ETrue if there is more Ids left, EFalse otherwise.
+     */
+    virtual TBool HasNext() const = 0;
+
+    /**
+     * Returns next component id.
+     *
+     * @return Next component Id.
+     */
+    virtual MVtUiComponent::TComponentId Next() = 0;
+
+    };
+
+/**
+ *  TVtUiBlockList
+ *
+ *  Base class for component block lists.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiBlockList )
+    {
+
+public: // public methods
+
+    /**
+     * Destructor.
+     */
+    virtual ~TVtUiBlockList();
+
+public: // public abstract methods
+
+    /**
+     * Returns ETrue if block list is empty.
+     *
+     * @return ETrue if this block list is empty, EFalse otherwise.
+     */
+    virtual TBool IsEmpty() const = 0;
+
+    /**
+     * Returns ETrue if block list contains given component id.
+     *
+     * @param aId Component Id to check.
+     * @return ETrue if this block list contains given component Id, EFalse
+     * otherwise.
+     */
+    virtual TBool Contains( MVtUiComponent::TComponentId aId ) const = 0;
+
+    /**
+     * Merges this block list with given block list.
+     *
+     * @param aBlockList List to merge into this block list.
+     */
+    virtual void Union( const TVtUiBlockList& aBlockList ) = 0;
+
+    /**
+     * Returns new instance of block list iterator. Instance is owned by the
+     * caller, but it is also pushed to cleanupstack.
+     *
+     * @return Instance to block list iterator. Iterator is for this block
+     * list instance.
+     */
+    virtual CVtUiBlockListIterator* IteratorLC() const = 0;
+
+protected: // protected methods
+
+    /**
+     * Constructor.
+     */
+    TVtUiBlockList();
+
+    };
+
+/**
+ *  TVtUiBlockListBitField
+ *
+ *  Component block list in which component IDs are defined as bits (i.e.
+ *  only single bit is set per ID).
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiBlockListBitField ) : public TVtUiBlockList
+    {
+
+public: // public methods
+
+    /**
+     * Default construct, initialized block list as empty.
+     */
+    TVtUiBlockListBitField();
+
+    /**
+     * Constructor that initializes block list.
+     *
+     * @param aBlockMask Component Ids that will be added to block list.
+     */
+    TVtUiBlockListBitField( TUint aBlockMask );
+
+public: // from
+
+    /**
+     * @see TVtUiBlockList::IsEmpty
+     */
+    TBool IsEmpty() const;
+
+    /**
+     * @see TVtUiBlockList::Contains
+     */
+    TBool Contains( MVtUiComponent::TComponentId aId ) const;
+
+    /**
+     * @see TVtUiBlockList::Union
+     */
+    void Union( const TVtUiBlockList& aBlockList );
+
+    /**
+     * @see TVtUiBlockList::IteratorLC
+     */
+    CVtUiBlockListIterator* IteratorLC() const;
+
+private: // inner classes
+
+    /**
+     * CVtUiBListIteratorBF
+     *
+     * @since S60 v3.2
+     */
+    class CVtUiBListIteratorBF : public CVtUiBlockListIterator
+        {
+
+    public: // public methods
+
+        /**
+         * Static constructor
+         *
+         * @param aBlockMask Components Ids.
+         */
+        static CVtUiBListIteratorBF* NewLC( const TUint& aBlockMask );
+
+    private: // private methods
+
+        /**
+         * Constructor
+         */
+        CVtUiBListIteratorBF( const TUint& aBlockMask );
+
+    private: // from CVtUiBlockListIterator
+
+        /**
+         * @see CVtUiBlockListIterator::HasNext
+         */
+        TBool HasNext() const;
+
+        /**
+         * @see CVtUiBlockListIterator::Next
+         */
+        MVtUiComponent::TComponentId Next();
+
+    private:  // data
+
+        // Blockmask from TVtUiBlockListBitField
+        const TUint iBlockMask;
+
+        // Current id
+        TUint iCurrent;
+
+        };
+
+private: // data
+
+    // Block list as bit field, this requires that component ids are defined
+    // as bitfields.
+    TUint iBlockMask;
+
+    };
+
+#endif // T_VTUIBLOCKLISTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/compman/tvtuicomponentstate.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* 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:  VT UI component state definition.
+*
+*/
+
+
+#ifndef T_VTUICOMPONENTSTATE_H
+#define T_VTUICOMPONENTSTATE_H
+
+#include <e32base.h>
+
+#include "tvtuiblocklists.h"
+
+/**
+ *  TVtUiComponentState
+ *
+ *  Component state definition.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TVtUiComponentState )
+    {
+
+public: // enumerations
+
+    enum TState
+        {
+        /** Component is inactive */
+        EInactive,
+
+        /** Component is activated but some other component is blocking it */
+        EWaiting,
+
+        /** Component is active */
+        EActive
+        };
+
+public: // public methods
+
+    /**
+     * Activate component.
+     */
+    void ActivateComponentL();
+
+    /**
+     * Blocks component.
+     */
+    void BlockComponentL();
+
+    /**
+     * Deactivates component.
+     */
+    void DeActivateComponentL();
+
+    /**
+     * Returns component's state.
+     *
+     * @return Component's current state.
+     */
+    TState State() const;
+
+    /**
+     * Returns component.
+     *
+     * @return Constant reference to component.
+     */
+    const MVtUiComponent& Component() const;
+
+    /**
+     * Returns const reference to the block list.
+     *
+     * @return Constant reference to component's block list.
+     */
+    const TVtUiBlockList& BlockList() const;
+
+    /**
+     * Returns reference to the block list.
+     *
+     * @return Reference to component's block list.
+     */
+    TVtUiBlockList& BlockList();
+
+protected: // protected methods
+
+    /**
+     * Constructor
+     *
+     * @param aComponent Component for this state instance.
+     * @param aBlockList Block list for this state intance.
+     */
+    TVtUiComponentState( MVtUiComponent& aComponent,
+        const TVtUiBlockList& aBlockList );
+
+protected:
+
+    // Reference to component
+    MVtUiComponent& iComponent;
+
+    // Blocklist
+    TVtUiBlockListBitField iBlockList;
+
+    // Component's state
+    TState iState;
+
+    };
+
+#endif // T_VTUICOMPONENTSTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/cvtuiappshutter.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* 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:  Class responsible for application exit.
+*
+*/
+
+
+#ifndef C_VTUIAPPSHUTTER_H
+#define C_VTUIAPPSHUTTER_H
+
+#include <babitflags.h>
+
+#include 	<mphcltemergencycallobserver.h>
+#include    <cphcltemergencycall.h>
+#include    <rphcltserver.h>
+
+class CAsyncCallBack;
+class MVtUiShutterObserver;
+class MVtUiStateContext;
+
+/**
+* Shutdown service for the application. This is singleton
+* which deletes itself when shutdown is complete.
+*
+* @since S60 v3.2
+*/                       
+class CVtUiAppShutter : public CBase
+    {
+public:          
+
+    /**
+    * Returns the instance of application shutter.
+    *
+    * @param aComms for sending call ending related commands to Phone.
+    * @param aObserver observer informed when shutdown is completed.
+    * @return the application shutter
+    */
+    static CVtUiAppShutter* InstanceL( 
+        MVtUiShutterObserver& aObserver );
+
+    /**
+    *  Starts shutdown.
+    */
+    void StartShutdown();
+
+    /**
+    * Starts shutdown because emergency call was requested by the user.
+    * If supplied number is detected other than emergency number this method
+    * leaves KErrArgument.
+    * @param aStateContext for accessing emergency number and local
+    * variation.
+    */
+    void ShutdownWithEmergencyCallL( MVtUiStateContext& aStateContext );
+                               
+    /**
+    * Callback from emergency caller.
+    */
+    void EmergencyCallDoneL();
+                                   
+private:
+
+    /**
+    * Exits the application if no pending shutdown preparation
+    * is ongoing. Deletes itself as last action.
+    */
+    void ShutdownIfReadyAndDestroy();
+
+    
+    /**
+    * Enques async callback.
+    */
+    void EnqueCallbackL( TCallBack& aCallback );
+
+    /**
+    * Asynch callback handling response to emergency call creation.
+    */
+    static TInt EmergencyResponseCallback( TAny* aAny );
+
+    /** C++ constructor */
+    CVtUiAppShutter( MVtUiShutterObserver& aObserver );
+
+    /** destructor */
+    ~CVtUiAppShutter();
+
+private: // for making shutdown with emergency call
+    class CEmergencyCaller : public CBase, private MPhCltEmergencyCallObserver
+        {
+        public:         
+            /**
+            * Dials emergency call. Object destroys itself when
+            * response is received.
+            */
+            static CEmergencyCaller* DialEmergencyL(
+                CVtUiAppShutter& aObserver,
+                MVtUiStateContext& aStateContext );
+            
+            // Destructor
+            ~CEmergencyCaller();
+            
+        private: // C++ constructor
+            
+            CEmergencyCaller( 
+                CVtUiAppShutter& aObserver, 
+                MVtUiStateContext& aStateContext );
+            
+            /**
+            * 2nd phase constructor
+            */
+            void ConstructL();
+            
+        private: // from MPhCltEmergencyCallObserver       
+            /**
+            * @see  MPhCltEmergencyCallObserver::HandleEmergencyDialL
+            */
+            virtual void HandleEmergencyDialL( const TInt aStatus );
+
+        private: // Data
+
+            // Emergency number
+            TPhCltTelephoneNumber iNumber;             
+            
+            // Phone Server session
+            RPhCltServer          iServer;
+            
+            // Emergency call handler
+            CPhCltEmergencyCall*  iEmergency;
+            
+            // Observer for callback
+            CVtUiAppShutter&      iObserver;
+
+            // State context for gettin entered numbers and local variation
+            MVtUiStateContext&    iStateContext;
+        };
+private: // Data
+
+    /**
+    * Guard flags for completing shutdown.
+    * All must be cleared before shutdown
+    * can be completed.
+    */
+    enum TShutterFlags 
+        {                               
+        /** Waiting for call on StartShutdown() */
+        EShutterWaitingStart,
+        /** Waiting for callback on emegency call request */
+        EShutterWaitingEmergencyCallback,
+        };
+    
+    // Asynch callback
+    CAsyncCallBack* iCallback;
+    
+    // guard flags          
+    TBitFlags8 iPendingStateFlags;
+     
+    // Observer to notify when application exit
+    // is allowed.
+    MVtUiShutterObserver& iObserver;
+
+    // Handles emergency call dialling    
+    CEmergencyCaller* iEmergencyCaller;
+
+    };
+
+#endif // C_VTUIAPPSHUTTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/cvtuidtmfbuffer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,138 @@
+/*
+* 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:  DTMF buffer definition.
+*
+*/
+
+
+#ifndef C_VTUIDTMFBUFFER_H
+#define C_VTUIDTMFBUFFER_H
+
+#include <e32base.h>
+#include "mvtuinumbersource.h"
+
+class CCoeEnv;
+class TKeyEvent;
+
+// Maximum size of the DTMF buffer
+const TInt KVtUiDTMFBufferSize = 64;
+
+/**
+*  TVtUiBaseComponentState
+*
+*  Base componentstate definition.
+*
+*  @since S60 v5.0
+*/
+class CVtUiDTMFBuffer : public CActive, public MVtUiNumberSource
+    {
+
+public:
+
+    /**
+    * Static construction method.
+    * @param aCoeEnv Reference to CoeEnv object.
+    * @return Pointer to newly created instance of CVtUiDTMFBuffer.
+    */
+    static CVtUiDTMFBuffer* NewL( const CCoeEnv& aCoeEnv );
+
+    /**
+    * C++ destructor.
+    */
+    ~CVtUiDTMFBuffer();
+
+    /**
+    * Append one character to DTMF buffer.
+    * @param aChar Character to append.
+    * @return ETrue if the given character was appended (i.e. it is a DTMF)
+    */
+    TBool Append( TChar aChar );
+
+    /**
+    * Clears the contents of the DTMF buffer.
+    */
+    void Reset();
+
+    /**
+    * Promote this instance as current number source.
+    */
+    void Activate();
+
+    /**
+    * Demote this instance from current number source position.
+    */
+    void Deactivate();
+
+public: // from MVtUiNumberSource
+
+    /**
+    * @see MVtUiNumberSource::GetContents
+    */
+    void GetContents( TDes& aContents ) const;
+
+private: // from CActive
+
+    /**
+    * @see CActive::DoCancel
+    */
+    void DoCancel();
+
+    /**
+    * @see CActive::RunL
+    */
+    void RunL();
+
+private:
+
+    /**
+    * C++ constructor
+    */
+    CVtUiDTMFBuffer( const CCoeEnv& aCoeEnv );
+
+    /**
+    * 2nd constructor, may leave.
+    */
+    void ConstructL();
+
+    /**
+    * Starts buffer modification monitoring timer. If this timer expires,
+    * buffer will be reset. Timer is restarted when new character is added to
+    * the buffer.
+    */
+    void StartTimer();
+
+    /**
+    * Called when buffer modification monitoring timer has expired.
+    */
+    void TimerExpired( TInt aError );
+
+    /**
+    * Clears the contents of the DTMF buffer.
+    */
+    void ResetBuffer();
+
+private:
+
+    // Reference to coeenv
+    const CCoeEnv& iCoeEnv;
+
+    // Timer instance
+    RTimer iTimer;
+
+    // DTMF buffer
+    TBuf< KVtUiDTMFBufferSize > iBuffer;
+
+    };
+
+#endif // C_VTUIDTMFBUFFER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/cvtuivideocontrolbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,354 @@
+/*
+* 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:  Base class for video control.
+*
+*/
+
+
+#ifndef C_VTUIVIDEOCONTROLBASE_H
+#define C_VTUIVIDEOCONTROLBASE_H
+
+#include    <coecntrl.h>
+#include    <aknutils.h>
+#include    <babitflags.h>
+
+#include    "MVtUiVideoWindow.h"
+#include    "CVtUiBitmapManager.h"
+
+// FORWARD DECLARATIONS
+class CVtUiBitmapManager;
+class TAknTextLineLayout;
+class CAknsBasicBackgroundControlContext;
+/**
+ *  CVtUiVideoControlBase
+ *
+ *  Video control base class.
+ *
+ *  @since S60 v5.0
+ */
+class CVtUiVideoControlBase : public CCoeControl, public MVtUiVideoWindow
+    {
+
+protected: // enumerations
+
+    // Rendering hints
+    enum TRenderingHint
+        {
+        // If this hint is set, then control's background is filled with color
+        // at index 0. This hint is mutually exclusive with ESkinnedBackground.
+        // If neither EColoredBackground nor ESkinnedBackground is set, then
+        // no background drawing is done.
+        EColoredBackground,
+
+        // If this is set, then control's background is skinned. This hint is
+        // mutually exclusive with EColoredBackground. If neither
+        // EColoredBackground nor ESkinnedBackground is set, then no background
+        // drawing is done.
+        ESkinnedBackground,
+
+        // If this hint is set, then no blind icon is drawn.
+        ENoBlindIcon,
+
+        // If this hint is set, then no waiting text is shown.
+        ENoWaitingText
+        };
+
+public:
+
+    /**
+     * Destructor
+     */
+    ~CVtUiVideoControlBase();
+
+protected:
+
+    /**
+     * Constructor
+     */
+    CVtUiVideoControlBase( CVtUiBitmapManager& aBitmapManager );
+
+    /**
+     * 2nd constructor
+     */
+    void BaseConstructL();
+
+    /**
+    * Sets (enables) rendering hints
+    */
+    void SetRenderingHint( TRenderingHint aHint );
+
+    /**
+    * Clears (disables) rendering hints
+    */
+    void ClearRenderingHint( TRenderingHint aHint );
+
+    /**
+    * Returns reference to bitmap manager.
+    */
+    CVtUiBitmapManager& BitmapManager() const;
+
+    /**
+    * Returns pointer to bitmap with given ID.
+    */
+    CFbsBitmap* Bitmap( TVtUiBitmapPoolId aId ) const;
+
+    /**
+    * Fixes given point suitable for DP (e.g. x coordinates of the point is
+    * even).
+    */
+    TPoint AdjustPointForDP( const TPoint aPoint ) const;
+
+    /**
+    * Fixes given rect suitable for DP (e.g. x coordinates and width of the
+    * rectangle are even).
+    */
+    TRect AdjustRectForDP( const TRect aRect ) const;
+
+protected: // virtual methods
+
+    /**
+    * Gets waiting text layout.
+    */
+    virtual TAknTextLineLayout WaitingTextLayout( TInt aLine );
+
+    /**
+    * The size changed method. If you need to do special handling after the
+    * control's size has changed, overwrite this method.
+    */
+    virtual void HandleSizeChanged();
+
+    /**
+    * Draws control background using current skin. If you need special
+    * background rendering in inherited control, override this method.
+    * There is no need to check ESkinnedBackground hint again in this method
+    * because it has been checked prior to calling.
+    */
+    virtual void DrawSkinnedBackground( CWindowGc& aGc ) const;
+
+    /**
+    * Draws control background using color. If you need special
+    * background rendering in inherited control, override this method.
+    * There is no need to check EColoredBackground hint again in this method
+    * because it has been checked prior to calling.
+    */
+    virtual void DrawColoredBackground( CWindowGc& aGc ) const;
+
+    /**
+    * Draws waiting text. If you need special waiting text rendering in
+    * inherited control, override this method.
+    * There is no need to check ENoWaitingText hint again in this method
+    * because it has been checked prior to calling.
+    */
+    virtual TBool DrawWaitingText( CWindowGc& aGc ) const;
+
+    /**
+    * Draws blind icon. If you need special blind icon rendering in inherited
+    * control, override this method.
+    * There is no need to check ENoBlindIcon hint again in this method
+    * because it has been checked prior to calling.
+    */
+    virtual void DrawBlind( CWindowGc& aGc ) const;
+
+    /**
+    * Draws stream. If you need special stream rendering in inherited control,
+    * override this method. iStreamBitmap cannot be NULL if this method is
+    * called.
+    */
+    virtual void DrawStream( CWindowGc& aGc ) const;
+
+    /**
+    * Returns blitting position (top-left corner) coordinates for the stream.
+    */
+    virtual TPoint StreamBlitPosition() const;
+
+    /**
+    * Returns clipping rectangle for the stream.
+    */
+    virtual TRect StreamClippingRect() const;
+
+    /**
+    * Returns pointer to blind bitmap or NULL if no bitmap is present.
+    */
+    virtual CFbsBitmap* BlindImage() const;
+
+    /**
+    * Returns pointer to blind mask or NULL if no mask is present.
+    */
+    virtual CFbsBitmap* BlindMask() const;
+
+    /**
+    * Returns blit position for blind icon.
+    */
+    virtual TPoint BlindBlitPosition() const;
+
+public: // from MVtUiVideoWindow
+
+    /**
+    * @see MVtUiVideoWindow::Reset
+    */
+    void Reset();
+
+    /**
+    * @see MVtUiVideoWindow::SetBlind
+    */
+    void SetBlind( TBool aStatus );
+
+    /**
+    * @see MVtUiVideoWindow::SetStreamBitmap
+    */
+    void SetStreamBitmap( CFbsBitmap* aStreamBitmap );
+
+    /**
+    * @see MVtUiVideoWindow::SetStreamBitmapReserve
+    */
+    void SetStreamBitmapReserve( CFbsBitmap* aStreamBitmap );
+
+    /**
+    * @see MVtUiVideoWindow::SetWaiting
+    */
+    void SetWaiting( TBool aShowWaitingText );
+
+    /**
+    * @see MVtUiVideoWindow::Redraw
+    */
+    void Redraw();
+
+    /**
+    * @see CCoeControl::MopSupplyObject
+    */
+    TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+    /**
+     * Set remote video control 
+     */
+    virtual void SetRemoteVideoControl( CCoeControl* aRemoteControl );
+    
+    /**
+     * Layout the postion and the size of the remote video control
+      */
+    virtual void LayoutRemoteVideo();    
+    
+    /**
+     * Returns pointer to remote video control  or NULL if no remote video control  is present.
+     */
+    CCoeControl * RemoteVideoControl();
+    
+private: // from CCoeControl
+
+    /**
+    * @see CCoeControl::Draw
+    */
+    void Draw( const TRect& aRect ) const;
+
+    /**
+    * @see CCoeControl::SizeChanged
+    */
+    void SizeChanged();
+
+    /**
+    * @see CCoeControl::PositionChanged
+    */
+    void PositionChanged();
+
+private:
+
+    /**
+    * Redraws stream bitmap.
+    */
+    void RedrawStream();
+
+    /**
+    * Wraps waiting text if needed.
+    */
+    void WrapOnDemand();
+
+    /**
+    * Wraps waiting text.
+    */
+    void WrapWaitingTextL();
+
+    /**
+    * The draw method.
+    */
+    void DoDraw( CWindowGc& aGc ) const;
+
+    /**
+    * Draws control background.
+    */
+    void DoDrawBackground( CWindowGc& aGc ) const;
+
+    /**
+    * Draws waiting text.
+    */
+    TBool DoDrawWaitingText( CWindowGc& aGc ) const;
+
+    /**
+    * Draws blind icon.
+    */
+    void DoDrawBlind( CWindowGc& aGc ) const;
+
+    /**
+    * Draws stream.
+    */
+    void DoDrawStream( CWindowGc& aGc ) const;
+
+    TBool IsAlphaZero() const;
+
+    void SetAlpha( CWindowGc& aGc ) const;
+
+protected:
+
+    // ETrue if blind icon is shown.
+    TBool iBlindStatus;
+
+    // Reference to stream bitmap.
+    CFbsBitmap* iStreamBitmap;
+
+    // ETrue if waiting text should be shown.
+    TBool iWaitingTextShow;
+
+    // Owned wrapped waiting text.
+    HBufC* iWaitingTextWrapped;
+
+    // Owned wrapped waiting text.
+    CArrayFix< TPtrC >* iWaitingTextWrappedArray;
+
+    // First line layout of waiting text.
+    TAknLayoutText iWaitingTextLine1Layout;
+
+    // Second line layout of waiting text.
+    TAknLayoutText iWaitingTextLine2Layout;
+
+    // Owned: background context.
+    CAknsBasicBackgroundControlContext* iBgContext;
+
+    // Reference to remote video control.
+    CCoeControl* iRemoteVideoControl;    
+    
+private:
+
+    // Pointer to bitmap manager.
+    CVtUiBitmapManager* iBitmapManager;
+
+    // Rendering hints
+    TBitFlags32 iHints;
+
+    // FrameUpdate() is called from AO.
+    CAsyncCallBack* iAsyncFrameUpdated;
+
+    mutable TBool iSetAlpha;
+
+    };
+
+#endif // C_VTUIVIDEOCONTROLBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/cvtuifeaturebase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* 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:  CVtUiFeatureBase implementation.
+*
+*/
+
+
+#ifndef C_VTUIFEATUREBASE_H
+#define C_VTUIFEATUREBASE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "mvtuifeature.h"
+
+// CLASS DECLARATION
+class CVtUiAppUi;
+class CVtUiFeatureManager;
+
+/**
+*   Base class for Video Telephone application features.
+*
+*  @since S60 3.2
+*/
+class CVtUiFeatureBase : public CBase, public MVtUiFeature
+    {
+    public: // public methods
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiFeatureBase();
+ 
+    public: // from MVtUiFeature
+
+        /** @see MVtUiFeature */
+        virtual void StartL();
+
+        /** @see MVtUiFeature */
+        virtual void Stop() = 0;
+        
+        /** @see MVtUiFeature */
+        virtual void InitFeatureL() = 0;
+        
+        /** @see MVtUiFeature */
+        TVtUiFeatureState State() const;
+        
+        /** @see MVtUiFeature */
+        TVtUiFeatureId Id() const;
+
+    protected:
+        /**
+        * C++ constructor
+        *
+        */
+        CVtUiFeatureBase( TVtUiFeatureId aId,
+            CVtUiFeatureManager& aFeatureManager );
+
+        /**
+        * BaseConstructL
+        * For child class to use.
+        * Calls constructL. 
+        */
+        void BaseConstructL();
+
+        /**
+        * Callback function that inits the features.
+        * @param aAny pointer to an instance of the class.
+        * @return always KErrNone.
+        */
+        static TInt DoInitFeaturesL( TAny* aAny );
+    
+
+    protected: // data
+        
+        // Feature's unique Id
+        const TVtUiFeatureId iId;
+        
+        // Reference to featuremanager
+        CVtUiFeatureManager& iFeatureManager;
+                
+        // Features current state
+        MVtUiFeature::TVtUiFeatureState iFeatureState;
+    
+        // Owned asynch callback.
+        CAsyncCallBack* iAsyncCallback;
+        
+    };
+
+#endif // C_VTUIFEATUREBASE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/cvtuifeaturemanager.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* 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:  Feature manager for Video Telephone application.
+*
+*/
+
+
+#ifndef C_VTUIFEATUREMANAGER_H
+#define C_VTUIFEATUREMANAGER_H
+
+//  INCLUDES
+#include    <e32std.h>
+#include    <e32base.h>
+
+// CLASS DECLARATION
+class MVtUiFeature;
+class CVtUiAppUi;
+class CVtUiFeatureBase;
+class TVtUiStates;
+class MVtUiCommandManager;
+class MVtUiComponentManager;
+class CVtEngModel;
+/**
+*  Feature manager for Video Telephone application.
+*
+*  @since S60 v3.2
+*/
+class CVtUiFeatureManager : public CBase
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CVtUiFeatureManager* NewL( CVtUiAppUi& aAppUi,
+            TVtUiStates& aUiStates, MVtUiCommandManager& aCommandManager,
+            MVtUiComponentManager& aComponentManager );
+
+        /**
+        * Destructor.
+        */
+        ~CVtUiFeatureManager();
+
+    public:  // New functions
+
+        /**
+        * Return reference to CVtUiAppUi class.
+        */
+        CVtUiAppUi& AppUi();
+
+        /**
+        * GetFeatureById
+        */
+        MVtUiFeature* GetFeatureById( TInt aId );
+
+        /**
+        * TVtUiStates
+        */
+        TVtUiStates& UiStates();
+
+        /**
+        * Command Manager
+        */
+        MVtUiCommandManager& CommandManager();
+
+        /**
+        * Component Manager
+        */
+        MVtUiComponentManager& ComponentManager();
+        
+        /**
+        *  Return reference to CVtEngModel class.
+        */
+        CVtEngModel& Model();
+
+ private:
+
+        /**
+        * Second phase constructor
+        */
+        void ConstructL();
+
+        /**
+        * c++ constructor
+        */
+        CVtUiFeatureManager( CVtUiAppUi& aAppUi, TVtUiStates& aUiStates,
+            MVtUiCommandManager& aCommandManager,
+            MVtUiComponentManager& aComponentManager );
+
+        /**
+        * Creates all features
+        */
+        void CreateFeaturesL();
+
+    private: // data
+
+        // Feature list
+        RPointerArray< CVtUiFeatureBase > iFeatures;
+
+        // Ref to application ui.
+        CVtUiAppUi& iAppUi;
+
+        // Reference to UI states instance
+        TVtUiStates& iUiStates;
+
+         // Reference to command manager API
+        MVtUiCommandManager& iCommandManager;
+
+        // Reference to component manager API
+        MVtUiComponentManager& iComponentManager;
+        
+        // Engine model.
+        CVtEngModel* iModel;
+
+    };
+
+#endif // C_VTUIFEATUREMANAGER_H
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/dialer/cvtuicmdclosedialer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* 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:  Dialer close command.
+*
+*/
+
+
+#ifndef C_VTUICMDCLOSEDIALER_H
+#define C_VTUICMDCLOSEDIALER_H
+
+#include "cvtuifeaturecmdbase.h"
+
+class MVtUiCommandManager;
+
+/**
+ *  CVtUiCmdCloseDialer
+ *
+ *  @since S60 v5.0
+ */
+class CVtUiCmdCloseDialer : public CVtUiFeatureCmdBase
+    {
+
+public:
+
+    /**
+     * Static constructor
+     *
+     * @param aCommandManager Reference to command manager.
+     * @param aFeature Reference to minidialer feature.
+     * @return Newly created instance to CVtUiCmdCloseDialer.
+     */
+    static CVtUiCmdCloseDialer* NewL( MVtUiCommandManager& aCommandManager,
+        MVtUiFeature& aFeature );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiCmdCloseDialer();
+
+private: // from CVtUiFeatureCmdBase
+
+    /**
+     * @see CVtUiFeatureCmdBase::HandleL
+     */
+    void HandleL();
+
+    /**
+    * @see CVtUiFeatureCmdBase::IsEnabled
+    */
+    TBool CVtUiCmdCloseDialer::IsEnabled() const;
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiCmdCloseDialer( MVtUiCommandManager& aCommandManager,
+        MVtUiFeature& aFeature );
+
+    /**
+     * 2nd constructor
+     */
+     void ConstructL();
+
+private:
+
+    // Reference to command manager API.
+    MVtUiCommandManager& iCommandManager;
+
+    };
+
+#endif // C_VTUICMDCLOSEDIALER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/dialer/cvtuicmdopendialer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* 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:  Dialer open command.
+*
+*/
+
+
+#ifndef C_VTUICMDOPENDIALER_H
+#define C_VTUICMDOPENDIALER_H
+
+#include "cvtuifeaturecmdbase.h"
+
+class MVtUiCommandManager;
+
+/**
+ *  CVtUiCmdOpenDialer
+ *
+ *  @since S60 v5.0
+ */
+class CVtUiCmdOpenDialer : public CVtUiFeatureCmdBase
+    {
+
+public:
+
+    /**
+     * Static constructor
+     *
+     * @param aCommandManager Reference to command manager.
+     * @param aFeature Reference to minidialer feature.
+     * @return Newly created instance to CVtUiCmdOpenDialer.
+     */
+    static CVtUiCmdOpenDialer* NewL( MVtUiCommandManager& aCommandManager,
+        MVtUiFeature& aFeature );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiCmdOpenDialer();
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiCmdOpenDialer( MVtUiCommandManager& aCommandManager,
+        MVtUiFeature& aFeature );
+
+    /**
+     * 2nd constructor
+     */
+     void ConstructL();
+
+private:
+
+    // Reference to command manager API.
+    MVtUiCommandManager& iCommandManager;
+
+    };
+
+#endif // C_VTUICMDOPENDIALER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/dialer/cvtuidialer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* 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:  Dialer UI feature.
+*
+*/
+
+
+#ifndef C_VTUIDIALER_H
+#define C_VTUIDIALER_H
+
+#include "cvtuifeaturebase.h"
+#include "mvtuidialer.h"
+
+class CVtUiFeatureCmdBase;
+class CVtUiDialerContainer;
+
+/**
+ *  CVtUiDialer
+ *
+ *  Mini dialer UI feature definition.
+ *
+ *  @since S60 v5.0
+ */
+class CVtUiDialer : public CVtUiFeatureBase, public MVtUiDialer
+    {
+
+public:
+
+    /**
+     * Static constructor
+     * @param aFeatureManager Reference to featuremanager.
+     * @return Newly created instance to CVtUiDialer.
+     */
+    static CVtUiDialer* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiDialer();
+
+public: // from CVtUiFeatureBase
+
+    /**
+    * @see CVtUiFeatureBase::StartL
+    */
+    void StartL();
+
+    /**
+    * @see CVtUiFeatureBase::Stop
+    */
+    void Stop();
+
+    /**
+    * @see CVtUiFeatureBase::InitFeatureL
+    */
+    void InitFeatureL();
+
+private: // from MVtUiDialer
+
+    /**
+    * @see MVtUiDialer::VideoWindow
+    */
+    MVtUiVideoWindow& VideoWindow() const;
+
+    /**
+    * @see MVtUiDialer::VideoControl
+    */
+    CCoeControl& VideoControl() const;
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiDialer( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+     * 2nd constructor
+     */
+    void ConstructL();
+
+    /**
+     * Preapres feature before start.
+     */
+    void PrepareL();
+
+    /**
+     * Unprepares feature after stop.
+     */
+    void Unprepare();
+
+private:
+
+    // Open command
+    CVtUiFeatureCmdBase* iCmdOpen;
+
+    // Open command
+    CVtUiFeatureCmdBase* iCmdClose;
+
+    // Dialer container
+    CVtUiDialerContainer* iDialerContainer;
+
+    };
+
+#endif // C_VTUIDIALER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/dialer/cvtuidialercontainer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,263 @@
+/*
+* 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:  Dialer container class.
+*
+*/
+
+
+#ifndef C_VTUIDIALERCONTAINER_H
+#define C_VTUIDIALERCONTAINER_H
+
+#include    <coecntrl.h>
+#include    "CVtUiAppUi.h"
+#include    "mvtuicomponent.h"
+#include    "mvtuiresourcechangeobserver.h"
+#include    "mvtuikeyeventobserver.h"
+#include    "mvtuinumbersource.h"
+#include    "tvtuicomponentstate.h"
+
+// FORWARD DECLARATIONS
+class MVtUiVideoWindow;
+class MVtUiComponentManager;
+class CVtUiBitmapManager;
+class CVtUiDialerVideoControl;
+class CVideoDTMFDialer;
+class TVtUiStates;
+class CVtUiDialerSKModifier;
+class CVtUiFeatureManager;
+class CVtUiDTMFBuffer;
+class CAknsBasicBackgroundControlContext;
+
+// CONSTANTS
+const TInt KVtUiDigitBufferSize = 128;
+
+/**
+ *  TVtUiMiniDialerComponentState
+ *
+ *  Mini dialer component state definition.
+ *
+ *  @since S60 v5.0
+ */
+class TVtUiDialerComponentState : public TVtUiComponentState
+    {
+
+public:
+
+    /**
+     * Constructor
+     */
+    TVtUiDialerComponentState( MVtUiComponent& aComponent );
+
+    };
+
+/**
+ *  CVtUiDialerContainer
+ *
+ *  Mini dialer UI feature definition.
+ *
+ *  @since S60 v5.0
+ */
+class CVtUiDialerContainer : public CCoeControl,
+    public MVtUiResourceChangeObserver, public MVtUiComponent,
+    public MVtUiNumberSource, public MVtUiKeyEventObserver
+    {
+
+public:
+
+    /**
+     * Static constructor
+     * @param aFeatureManager Reference to feature manager.
+     * @param aComponentManager Reference to component manager.
+     * @param aBitmapManager Reference to bitmap manager.
+     * @return Newly created instance of CVtUiDialerContainer.
+     */
+    static CVtUiDialerContainer*
+        NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiDialerContainer();
+
+    /**
+     * Registers component to component manager's event handling mechanism.
+     * @exception May leave with error KErrAlreadyExists, if the component
+     * has already been registered.
+     */
+    void RegisterComponentL();
+
+    /**
+     * Unregisters component from component manager's event handling mechanism.
+     */
+    void UnregisterComponent();
+
+    /**
+    * Returns video window.
+    * @return Pointer to video window.
+    */
+    MVtUiVideoWindow* ComponentAsVideoWindow();
+    
+    /**
+    * @see CCoeControl::MopSupplyObject
+    */
+    TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+private: // from MVtUiResourceChangeObserver
+
+    /**
+    * @see MVtUiResourceChangeObserver::HandleResourceChangeL
+    */
+    void HandleResourceChangeL( TInt aType );
+
+
+private: // from MVtUiComponent
+
+    /**
+    * @see MVtUiComponent::ComponentId
+    */
+    TComponentId ComponentId() const;
+
+    /**
+    * @see MVtUiComponent::ComponentAsControl
+    */
+    CCoeControl* ComponentAsControl();
+
+    /**
+    * @see MVtUiComponent::DoActivateL
+    */
+    void DoActivateL();
+
+    /**
+    * @see MVtUiComponent::DoDeactivateL
+    */
+    void DoDeactivateL();
+
+private: // from MVtUiNumberSource
+
+    /**
+     * @see MVtUiNumberSource::GetContents
+     */
+    void GetContents( TDes& aContents ) const;
+
+private: // from MVtUiKeyEventObserver
+
+    /**
+     * @see MVtUiNumberSource::OfferKeyEventL
+     */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent,
+        TEventCode aCode );
+
+private: // from CCoeControl
+
+    /**
+    * @see CCoeControl::Draw
+    */
+    void Draw( const TRect& aRect ) const;
+
+    /**
+    * @see CCoeControl::SizeChanged
+    */
+    void SizeChanged();
+
+    /**
+    * @see CCoeControl::PositionChanged
+    */
+    void PositionChanged();
+
+    /**
+    * @see CCoeControl::CountComponentControls
+    */
+    TInt CountComponentControls() const;
+
+    /**
+    * @see CCoeControl::ComponentControl
+    */
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiDialerContainer( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+     * 2nd constructor
+     */
+    void ConstructL( CVtUiBitmapManager& aBitmapManager );
+
+    /**
+    * Layouts this control.
+    */
+    void LayoutDialerContainer();
+
+    /**
+    * Returns dialer's rect (wrapper to VtUiLayout).
+    */
+    TRect DialerRect() const;
+
+    /**
+    * Resets digit buffer.
+    */
+    void Reset();
+
+    /**
+    * Appends new digit to digit buffer. If buffer is full, oldest digit is
+    * deleted.
+    */
+    void AppendDigit( TChar aDigit );
+
+    /**
+    * Static callback method for deactivating dialer asynchronously.
+    */
+    static TInt ASyncDoDeactivate( TAny* aSelf );
+
+private:
+
+    // Component state
+    TVtUiDialerComponentState iComponentState;
+
+    // Feature manager instance
+    CVtUiFeatureManager* iFeatureManager;
+
+    // Component manager
+    MVtUiComponentManager* iComponentManager;
+
+    // UI states
+    TVtUiStates& iUiStates;
+
+    // Video control instance
+    CVtUiDialerVideoControl* iVideoControl;
+
+    // Dialer instance
+    CVideoDTMFDialer* iDialer;
+
+    // Buffer for digits
+    CVtUiDTMFBuffer* iInputBuffer;
+
+    // Rendering mode
+    CVtUiAppUi::TRenderingMode iMode;
+
+    // Softkey modifier for dialer feature
+    CVtUiDialerSKModifier* iSKModifier;
+
+    // Asynccallback instance for handling asynchronous deactivation.
+    CAsyncCallBack* iAsyncDeactivate;
+
+    // Owned: background context.
+    CAknsBasicBackgroundControlContext* iBgContext;
+
+    };
+
+#endif // C_VTUIDIALERCONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/dialer/cvtuidialerskmodifier.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* 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:  Dialer feature softkey modifier class.
+*
+*/
+
+
+#ifndef C_VTUIDIALERSKMODIFIER_H
+#define C_VTUIDIALERSKMODIFIER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "cvtuicommandmodifybase.h"
+
+// FORWARD DECLARATIONS
+class   CVtUiFeatureManager;
+
+/**
+ *  CVtUiDialerSKModifier
+ *
+ *  Modifies softkeys for dialer control.
+ *
+ *  @since S60 v5.0
+ */
+class CVtUiDialerSKModifier : public CVtUiCommandModifyBase
+    {
+
+public: // static methods
+    /**
+     * Static constructor.
+     *
+     */
+    static CVtUiDialerSKModifier* NewL( CVtUiFeatureManager& aFeatureMgr );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiDialerSKModifier();
+
+public: // from base class
+
+    /**
+     * @See CVtUiCommandModifyBase::ModifyCommandsL
+     */
+    virtual void ModifyCommandsL( MVtUiCommandSetting& aCommandSettings );
+
+   /**
+     * @See CVtUiCommandModifyBase::Supports
+     */
+    virtual TBool Supports( MVtUiCommandSetting::Type aType ) const;
+
+private:
+    /**
+     * C++ constructor
+     *
+     */
+    CVtUiDialerSKModifier( CVtUiFeatureManager& aFeatureMgr );
+
+private: // data
+
+    // refrence to appui
+    CVtUiFeatureManager& iFeatureMgr;
+
+    };
+
+#endif // C_VTUIDIALERSKMODIFIER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/dialer/cvtuidialervideocontrol.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* 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:  Video control.
+*
+*/
+
+
+#ifndef C_VTUIDIALERVIDEOCONTROL_H
+#define C_VTUIDIALERVIDEOCONTROL_H
+
+#include    "cvtuivideocontrolbase.h"
+
+/**
+ *  CVtUiDialerVideoControl
+ *
+ *  Mini dialer UI feature definition.
+ *
+ *  @since S60 v5.0
+ */
+class CVtUiDialerVideoControl : public CVtUiVideoControlBase
+    {
+
+public:
+
+    /**
+     * Static constructor
+     * @param aBitmapManager Reference to bitmap manager.
+     * @return Newly created instance of CVtUiDialerVideoControl.
+     */
+    static CVtUiDialerVideoControl* NewL( CVtUiBitmapManager& aBitmapManager );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiDialerVideoControl();
+public:
+    /**
+    * LayoutRemoteVideo
+    */
+    void LayoutRemoteVideo();
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiDialerVideoControl( CVtUiBitmapManager& aBitmapManager );
+
+    /**
+    * 2nd constructor
+    */
+    void ConstructL();
+
+private: // from CVtUiVideoControlBase
+
+    /**
+    * @see CVtUiVideoControlBase::WaitingTextLayout
+    */
+    TAknTextLineLayout WaitingTextLayout( TInt aLine );
+
+    };
+
+#endif // C_VTUIDIALERVIDEOCONTROL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/dialer/mvtuidialer.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* 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:  Dialer API for VT application.
+*
+*/
+
+
+#ifndef M_VTUIDIALER_H
+#define M_VTUIDIALER_H
+
+class MVtUiVideoWindow;
+class CCoeControl;
+
+/**
+ *  MVtUiDialer
+ *
+ *  Mini dialer UI feature API for AppUi.
+ *
+ *  @since S60 v5.0
+ */
+class MVtUiDialer
+    {
+
+public:
+
+    /**
+    * Get reference to video window control
+    * @return Reference to video window.
+    */
+    virtual MVtUiVideoWindow& VideoWindow() const = 0;
+
+    /**
+    * Get reference to video window control
+    * @return Reference to video control.
+    */
+    virtual CCoeControl& VideoControl() const = 0;
+
+    };
+
+#endif //
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/menu/cvtuimenucontext.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,75 @@
+/*
+* 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:  Menu context class definition.
+*
+*/
+
+
+#ifndef C_VTUIMENUCONTEXT_H
+#define C_VTUIMENUCONTEXT_H
+
+#include <e32base.h>
+
+#include "cvtuicmdcontext.h"
+
+/**
+ *  CVtUiMenuContext
+ *
+ *  Menu command context class definition.
+ *
+ *  @since S60 v3.2
+ */
+class CVtUiMenuContext : public CVtUiCmdContext
+    {
+
+public: // public methods
+
+    /**
+     * C++ destructor.
+     *
+     */
+    ~CVtUiMenuContext();
+
+    /**
+     * Leave safe destructor.
+     *
+     */
+    static CVtUiMenuContext* NewL( MVtUiCommandManager& aCommandManager );
+
+public: // from CVtUiCmdContext
+
+    /**
+     *  @see CVtUiCmdContext::ValidateL
+     */
+    void ValidateL( CVtUiCmdValidationActionBase& aAction );
+
+private:
+
+    /**
+     * C++ constructor
+     *
+     * @param aPriority Validator priority.
+     */
+    CVtUiMenuContext( MVtUiCommandManager& aCommandManager );
+
+    /**
+     * 2nd consttuctor, may leave.
+     */
+    void ConstructL();
+
+private: // data
+
+    };
+
+#endif // C_VTUIMENUCONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/menu/cvtuimenuitemdimmeraction.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* 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:  Menu dimmer action class definition.
+*
+*/
+
+
+#ifndef C_VTUIMENUITEMDIMMERACTION_H
+#define C_VTUIMENUITEMDIMMERACTION_H
+
+#include <e32base.h>
+
+#include "cvtuicmdvalidationactionbase.h"
+
+class CEikMenuPane;
+
+/**
+ *  CVtUiCmdValidationActionBase
+ *
+ *  Menu item dimmer action definition.
+ *
+ *  @since S60 v3.2
+ */
+class CVtUiMenuItemDimmerAction : public CVtUiCmdValidationActionBase
+    {
+
+public:
+
+    /**
+     * Leave-safe constructor.
+     *
+     */
+    static CVtUiMenuItemDimmerAction* NewL();
+
+    /**
+     * Sets menu pane instance.
+     *
+     */
+    void SetMenuPane( CEikMenuPane* aMenuPane );
+
+public: // from CVtUiCmdValidationActionBase
+
+    /**
+     * @see CVtUiCmdValidationActionBase::ProcessL
+     */
+    void ProcessL( const MVtUiCmdValidatorCallBack& aCallBack );
+
+    /**
+     * @see CVtUiCmdValidationActionBase::EndProcess
+     */
+    void EndProcess();
+
+private:
+
+    /**
+     * C++ constructor.
+     *
+     */
+    CVtUiMenuItemDimmerAction();
+
+    /**
+     * Sets given menu command dimmed in menu.
+     *
+     */
+    void SetItemDimmed( TInt aCommandId );
+
+private: // data
+
+    // Menu pane instance this action is currently working on
+    CEikMenuPane* iMenuPane;
+
+    };
+
+#endif // C_VTUIMENUITEMDIMMERACTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/menu/cvtuimenus.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* 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:  Menu UI feature.
+*
+*/
+
+
+#ifndef C_VTUIMENUS_H
+#define C_VTUIMENUS_H
+
+#include "cvtuifeaturebase.h"
+#include "mvtuicommandui.h"
+
+class CVtUiMenuContext;
+class CVtUiMenuItemDimmerAction;
+class CEikMenuPane;
+class CVtUiCommandModifyBase;
+
+/**
+ *  CVtUiMenus
+ *
+ *  Menu feature definition.
+ *
+ *  @since S60 v3.2
+ */
+class CVtUiMenus : public CVtUiFeatureBase, public MVtUiCommandUi
+    {
+
+public:
+
+    /**
+     * Static constructor
+     */
+    static CVtUiMenus* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiMenus();
+
+public:
+
+    /**
+     * Sets menu context.
+     */
+    void SetMenuPane( CEikMenuPane* aMenuPane );
+
+public: // from CVtUiFeatureBase
+
+    /**
+    * @see CVtUiFeatureBase::StartL
+    */
+    void StartL();
+
+    /**
+    * @see CVtUiFeatureBase::Stop
+    */
+    void Stop();
+
+    /**
+    * @see CVtUiFeatureBase::InitFeatureL
+    */
+    void InitFeatureL();
+
+public: // from MVtUiCommandUi
+
+    /**
+     * @see MVtUiCommandUi::RefreshL
+     */
+    void RefreshL();
+
+    /**
+     * @see MVtUiCommandUi::AddCommandModifier
+     */
+    TInt AddCommandModifier( CVtUiCommandModifyBase& );
+
+    /**
+     * @see MVtUiCommandUi::RemoveCommandModifier
+     */
+    void RemoveCommandModifier( CVtUiCommandModifyBase& );
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiMenus( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+     * 2nd constructor
+     */
+    void ConstructL();
+
+private:
+
+    // Menu context instance
+    CVtUiMenuContext* iMenuCommandContext;
+
+    // Menu dimmer action instance
+    CVtUiMenuItemDimmerAction* iMenuDimmerAction;
+
+    };
+
+#endif // C_VTUIMENUS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/menu/tvtuimenucommanditerator.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* 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:  Menu command iterator class definition.
+*
+*/
+
+
+#ifndef T_VTUIMENUCOMMANDITERATOR_H
+#define T_VTUIMENUCOMMANDITERATOR_H
+
+#include "mvtuicommanditerator.h"
+
+/**
+ *  TVtUiMenuCommandIterator
+ *
+ *  Menu command iterator class definition.
+ *
+ *  @since S60 v3.2
+ */
+class TVtUiMenuCommandIterator : public MVtUiCommandIterator
+    {
+
+public: // public methods
+
+    /**
+     * C++ constructor
+     *
+     */
+    TVtUiMenuCommandIterator( CEikMenuPane& aMenuPane );
+
+public: // from MVtUiCommandIterator
+
+    /**
+     * @see MVtUiCommandIterator::HasNext
+     */
+    TBool HasNext() const;
+
+    /**
+     * @see MVtUiCommandIterator::Next
+     */
+    TInt Next();
+
+private:
+
+    // Pointer to menu pane to be iterated
+    CEikMenuPane* iMenuPane;
+
+    // Current iteration point
+    TInt iCurrent;
+
+    };
+
+#endif // T_VTUIMENUCOMMANDITERATOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/mvtuifeature.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* 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:  Observer interface for handling features
+*
+*/
+
+
+#ifndef MVTUIFEATURE_H
+#define MVTUIFEATURE_H
+
+//  INCLUDES
+#include <e32std.h>
+
+#include "tvtuifeatureids.h"
+
+// CLASS DECLARATION
+
+/**
+*  Interface for handling features
+*
+*  @since S60 v3.2
+*/
+class MVtUiFeature
+    {
+    public:  // New functions
+        /**
+        * ENotSupported
+        *  feature is not supported in current configuration.
+        * EUnprepared
+        *   starting may require some init code to run.
+        * EPreparing
+        *   running initialization code.
+        * EReady
+        *   feature can be started.
+        * EActive
+        *   feature is running.
+        * EDisabled
+        *   feature is supported but cannot be started at this time.
+        * EFailed
+        *   started but failed (maybe temporary or permanent, feature specific)
+        */
+        enum TVtUiFeatureState
+            {
+            ENotSupported,
+            EUnprepared,
+            EPreparing,
+            EReady,
+            EActive,
+            EDisabled,
+            EFailed
+            };
+
+        /**
+        * Starts the feature.
+        */
+        virtual void StartL() = 0;
+
+        /**
+        * Stops the feature.
+        */
+        virtual void Stop() = 0;
+
+        /**
+        * Current state of the feature
+        */
+        virtual TVtUiFeatureState State() const = 0;
+
+        /**
+        * Id()
+        */
+        virtual TVtUiFeatureId Id() const = 0;
+    };
+
+#endif // MVTUIFEATURE_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/numberentry/CVtUiNumberEntryControl.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,196 @@
+/*
+* 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:  Number entry control for Video Telephone application.
+*
+*/
+
+
+
+#ifndef CVTUINUMBERENTRYCONTROL_H
+#define CVTUINUMBERENTRYCONTROL_H
+
+//  INCLUDES
+#include    <coecntrl.h>
+#include    <aknutils.h>
+
+#include    "mvtuicomponent.h"
+#include    "tvtuicomponentstate.h"
+#include    "mvtuinumbersource.h"
+
+// FORWARD DECLARATIONS
+class MVtUiFeature;
+class MVtUiComponentManager;
+class TVtUiStates;
+class MVtUiNumberEntryControlObserver;
+class CVtUiDTMFBuffer;
+
+// CLASS DECLARATION
+
+/**
+* TVtUiNumberEntryComponentState
+*
+* Component state implementation for Number Entry control. Component state is
+* used by the Component Manager.
+*
+* @since S60 3.2
+*/
+class TVtUiNumberEntryComponentState : public TVtUiComponentState
+    {
+
+public:
+
+    /**
+     * Constructor.
+     */
+    TVtUiNumberEntryComponentState( MVtUiComponent& aComponent );
+
+    };
+
+/**
+*  Number entry control for Video Telephone application.
+*
+*  @since Series 60 2.6
+*/
+class CVtUiNumberEntryControl
+    : public CCoeControl, public MVtUiComponent
+    {
+    public: // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        * @param aAppUi application ui.
+        * @param aUiStates ui states
+        */
+        CVtUiNumberEntryControl( MVtUiFeature& aFeature,
+            TVtUiStates& aUiStates );
+
+        /**
+        * Symbian constructor.
+        * @param aRect initial area.
+        */
+        void ConstructL( const TRect& aRect );
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiNumberEntryControl();
+
+    public: // New functions
+
+        /**
+        * Opens number entry.
+        * @return ETrue if number entry was opened, EFalse otherwise.
+        */
+        TBool OpenNumberEntry();
+
+        /**
+        * Returns ETrue if number entry is open.
+        * @return ETrue if number entry is open.
+        */
+        TBool IsNumberEntryOpen() const;
+
+        /**
+        * Closes number entry.
+        */
+        void CloseNumberEntry();
+
+        /**
+         * Register component to component manager.
+         */
+        void RegisterComponentL( MVtUiComponentManager& aComponentManager );
+
+        /**
+         * Unregister component to component manager.
+         */
+        void UnregisterComponent( MVtUiComponentManager& aComponentManager );
+
+        /**
+         * Adds number entry control observer.
+         */
+        void SetNumberEntryControlObserver(
+            MVtUiNumberEntryControlObserver* aObserver );
+
+    public: // Functions from base classes
+
+        /**
+        * @see CCoeControl::OfferKeyEventL.
+        */
+        virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+            TEventCode aType );
+
+    private:
+
+        /**
+        * Callback function to close number entry.
+        * @param aAny pointer to an instance of this class.
+        * @return KErrNone.
+        */
+        static TInt DoCloseNumberEntry( TAny* aAny );
+
+        /**
+        * Called from DoCloseNumberEntry when number entry needs to be closed.
+        */
+        void HandleTimeoutCloseNumberEntry();
+
+        /**
+        * Return ETrue if menu or dialog is being displayed.
+        */
+        TBool IsDisplayingMenuOrDialog() const;
+
+    private: // from MVtUiComponent
+
+        /**
+         * @see MVtUiComponent::ComponentId
+         */
+        TComponentId ComponentId() const;
+
+        /**
+         * @see MVtUiComponent::ComponentAsControl
+         */
+        CCoeControl* ComponentAsControl();
+
+        /**
+         * @see MVtUiComponent::DoActivateL
+         */
+        void DoActivateL();
+
+        /**
+         * @see MVtUiComponent::DoDeactivateL
+         */
+        void DoDeactivateL();
+
+    private:
+
+        // Reference to feature that owns this control.
+        MVtUiFeature& iFeature;
+
+        // Number entry area layout.
+        TAknLayoutRect iNumberEntryAreaLayout;
+
+        // Component state
+        TVtUiNumberEntryComponentState iComponentState;
+
+        // UI States
+        TVtUiStates& iUiStates;
+
+        // Number entry control observer
+        MVtUiNumberEntryControlObserver* iControlObserver;
+
+        // Buffer for digits
+        CVtUiDTMFBuffer* iInputBuffer;
+    };
+
+#endif      // CVTUINUMBERENTRYCONTROL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/numberentry/cvtuinumberentry.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* 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:  Number entry UI feature definition.
+*
+*/
+
+
+#ifndef C_VTUINUMBERENTRY_H
+#define C_VTUINUMBERENTRY_H
+
+#include "mvtuicommandui.h"
+#include "cvtuifeaturebase.h"
+#include "mvtuinumberentrycontrolobserver.h"
+#include "cvtuifeaturemanager.h"
+
+class CVtUiNumberEntryControl;
+
+/**
+ *  CVtUiNumberEntry
+ *
+ *  NumberEntry UI feature.
+ *
+ *  @since S60 v3.2
+ */
+ class CVtUiNumberEntry : public CVtUiFeatureBase,
+    public MVtUiNumberEntryControlObserver
+    {
+
+public:
+
+    /**
+     * Static constructor
+     */
+    static CVtUiNumberEntry* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiNumberEntry();
+
+public: // from CVtUiFeatureBase
+
+    /**
+    * @see CVtUiFeatureBase::StartL
+    */
+    void StartL();
+
+    /**
+    * @see CVtUiFeatureBase::Stop
+    */
+    void Stop();
+
+    /**
+    * @see CVtUiFeatureBase::InitFeatureL
+    */
+    void InitFeatureL();
+
+public: // from MVtUiNumberEntryControlObserver
+
+    /**
+     * @see MVtUiNumberEntryControlObserver::ControlActivatedL
+     */
+    void ControlActivatedL();
+
+    /**
+     * @see MVtUiNumberEntryControlObserver::ControlDeactivated
+     */
+    void ControlDeactivated();
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiNumberEntry( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+     * 2nd constructor
+     */
+    void ConstructL();
+
+    /**
+     * Prepares feature
+     */
+    void PrepareL();
+
+    /**
+     * Unprepares feature
+     */
+     void Unprepare();
+
+    /**
+     * Creates number entry control instance
+     */
+    void CreateNumberEntryControlL();
+
+    /**
+     * Deletes number entry control instance
+     */
+    void DeleteNumberEntryControl();
+
+private:
+
+    // Owned number entry control instance.
+    CVtUiNumberEntryControl* iNumberEntryControl;
+
+    };
+
+#endif // C_VTUINUMBERENTRY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/numberentry/mvtuinumberentrycontrolobserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* 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:  Key event observer API for components.
+*
+*/
+
+
+#ifndef M_VTUINUMBERENTRYCONTROLOBSERVER_H
+#define M_VTUINUMBERENTRYCONTROLOBSERVER_H
+
+/**
+* MVtUiNumberEntryControlObserver
+*
+* Observer API for number entry control.
+*
+* @since S60 v3.2
+*/
+class MVtUiNumberEntryControlObserver
+    {
+
+public:
+
+    /**
+     * Called when number entry control is activated.
+     */
+    virtual void ControlActivatedL() = 0;
+
+    /**
+     * Called when number entry control is deactivated.
+     */
+    virtual void ControlDeactivated() = 0;
+
+    };
+
+#endif // M_VTUINUMBERENTRYCONTROLOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuibrightness.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* 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:  Brightness ui feature
+*
+*/
+
+
+#ifndef     C_VTUIBRIGHTNESS_H
+#define     C_VTUIBRIGHTNESS_H
+
+#include    "cvtuiprefsliderbase.h"
+
+/**
+*  CVtUiBrightness
+*
+*  Brightness ui feature
+*
+*  @since S60 v3.2
+*/
+class CVtUiBrightness : public CVtUiPrefSliderBase
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiBrightness* NewL( CVtUiFeatureManager& aFeatureManager );
+    
+    /**
+    * Destructor
+    */
+    ~CVtUiBrightness();
+
+public: // from CVtUiPrefSliderBase
+    
+    /** 
+    * @see CVtUiPrefSliderBase::StartL
+    */
+    void StartL();
+
+    /** 
+    * @see CVtUiPrefSliderBase::Stop
+    */
+    void Stop();
+    
+protected: 
+
+    /*
+    * Constructor
+    */
+    CVtUiBrightness( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * 2nd constructor
+    */
+    void ConstructL(); 
+
+    };
+
+#endif // C_VTUIBRIGHTNESS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuibrightnesspopup.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* 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:  Brightness popup
+*
+*/
+
+
+#ifndef C_VTUIBRIGHTNESSPOPUP_H
+#define C_VTUIBRIGHTNESSPOPUP_H
+
+#include    "tvtuicomponentstate.h"
+#include    "cvtuiprefpopupbase.h"
+
+
+/**
+*  CVtUiBrightnessPopup
+*
+*  Brightness popup definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiBrightnessPopup : public CVtUiPrefPopupBase
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiBrightnessPopup* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * Destructor
+    */
+    ~CVtUiBrightnessPopup();
+
+protected: // from CVtUiPrefPopupBase 
+    
+    // @see CVtUiPrefPopupBase::CurrentValue
+    TInt CurrentValue() ;
+    
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiBrightnessPopup( CVtUiFeatureManager& aFeatureManager );
+
+    /*
+    * 2nd constructor
+    */
+    void ConstructL();
+
+    };
+
+#endif // C_VTUIBRIGHTNESSPOPUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuicolortone.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* 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:  Color tone feature.
+*
+*/
+
+
+#ifndef C_VTUICOLORTONE_H
+#define C_VTUICOLORTONE_H
+
+#include    <mvtengcamerapreferences.h>
+#include    "cvtuiprefsettinglistbase.h"
+#include    "cvtuifeaturebase.h"
+#include    "tvtuicomponentstate.h"
+#include    "mvtuicomponent.h"
+#include    "mvtuilayoutchangeobserver.h"
+
+/**
+*  TVtUiColorToneComponentState
+*
+* Video quality componentstate definition.
+*
+*  @since S60 v3.2
+*/
+class TVtUiColorToneComponentState : public TVtUiComponentState
+    {
+
+public:
+
+    /**
+    * Constructor
+    * @param aComponent Reference to component.
+    */
+    TVtUiColorToneComponentState( MVtUiComponent& aComponent );
+    
+    };
+    
+/**
+*  CVtUiColorTone
+*
+*  Color tone UI feature definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiColorTone : public CVtUiPrefSettingListBase,
+    public MVtUiComponent, public MVtUiLayoutChangeObserver
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiColorTone* NewL( CVtUiFeatureManager& aFeatureManager );
+    
+    /**
+    * Destructor
+    */
+    ~CVtUiColorTone();
+
+public: // from MVtUiFeature
+
+    /** 
+    * @see MVtUiFeature::StartL
+    */
+    void StartL();
+
+     /** 
+    * @see MVtUiFeature::Stop
+    */
+    void Stop();
+    
+     /** 
+    * @see MVtUiFeature::InitFeatureL
+    */
+    void InitFeatureL();
+
+public: // from MVtUiComponent
+
+    /**
+    * @see MVtUiComponent::ComponentId
+    */
+    MVtUiComponent::TComponentId ComponentId() const;
+
+    /**
+    * @see MVtUiComponent::ComponentAsControl
+    */
+    CCoeControl* ComponentAsControl();
+
+    /**
+    * @see MVtUiComponent::DoActivateL
+    */
+    void DoActivateL();
+
+    /**
+    * @see MVtUiComponent::DoDeactivateL
+    */
+    void DoDeactivateL();
+    
+public: // from MVtUiComponentManager
+
+    /**
+    * @see MVtUiComponentManager::HandleLayoutChangeL
+    */
+    void HandleLayoutChangeL();
+
+protected: // from base class
+     
+   	/**
+    * @see CVtUiPrefSettingListBase::CurrentSelection
+    */
+    virtual TInt CurrentSelection();
+    
+    /**
+    * @see CVtUiPrefSettingListBase::SetItemsL
+    */
+    virtual void SetItemsL( CDesCArray& aArray );
+    
+    /**
+    * @see CVtUiPrefSettingListBase::SettingPageResId
+    */
+    virtual TInt SettingPageResId() const;
+    
+    /**
+    * @see CVtUiPrefSettingListBase::SettingPageItemChangedL
+    */
+    virtual void SettingPageItemChangedL( TInt aIndex );
+    
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiColorTone( CVtUiFeatureManager& aFeatureManager );
+
+    // Maps color tone enum to array index
+    TInt MapCTEnumToArrayIndex( MVtEngCameraPreferences::TColorTone&
+        aColorTone ) const;
+    
+    // Maps arrya index to color tone enum 
+    MVtEngCameraPreferences::TColorTone MapArrayIndexToCTEnum(
+        TInt aIndex) const;        
+
+    // Callback function that stops the feature.
+    static TInt DoStopL( TAny* aAny );
+    
+    // Callback function that starts the feature.
+    static TInt DoStartL( TAny* aAny );    
+
+private:
+
+    // Component state
+    TVtUiColorToneComponentState iComponentState;
+  
+    };
+
+#endif // CVTUICOLORTONE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuicontrast.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* 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:  Contrast ui feature
+*
+*/
+
+
+#ifndef     C_VTUICONTRAST_H
+#define     C_VTUICONTRAST_H
+
+#include    "cvtuiprefsliderbase.h"
+
+
+/**
+*  CVtUiContrast
+*
+*  Contrast ui feature
+*
+*  @since S60 v3.2
+*/
+class CVtUiContrast : public CVtUiPrefSliderBase
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiContrast* NewL( CVtUiFeatureManager& aFeatureManager );
+    
+    /**
+    * Destructor
+    */
+    ~CVtUiContrast();
+
+public: // from CVtUiPrefSliderBase
+    
+    /** 
+    * @see CVtUiPrefSliderBase::StartL
+    */
+    void StartL();
+
+    /** 
+    * @see CVtUiPrefSliderBase::Stop
+    */
+    void Stop();
+
+protected: 
+
+    /*
+    * Constructor
+    */
+    CVtUiContrast( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * 2nd constructor
+    */
+    void ConstructL(); 
+
+    };
+
+#endif // C_VTUICONTRAST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuicontrastpopup.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* 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:  Contrast popup
+*
+*/
+
+
+#ifndef C_VTUICONTRASTPOPUP_H
+#define C_VTUICONTRASTPOPUP_H
+
+#include    "tvtuicomponentstate.h"
+#include    "cvtuiprefpopupbase.h"
+
+
+/**
+*  CVtUiContrastPopup
+*
+*  Contrast popup definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiContrastPopup : public CVtUiPrefPopupBase
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiContrastPopup* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * Destructor
+    */
+    ~CVtUiContrastPopup();
+
+protected: // from CVtUiPrefPopupBase 
+    
+    // @see CVtUiPrefPopupBase::CurrentValue
+    TInt CurrentValue();
+    
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiContrastPopup( CVtUiFeatureManager& aFeatureManager );
+
+    /*
+    * 2nd constructor
+    */
+    void ConstructL();
+
+    };
+
+#endif // C_VTUICONTRASTPOPUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuiprefpopupbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* 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:  Base class for video preference popups
+*
+*/
+
+
+#ifndef     C_VTUIPREFPOPUPBASE_H
+#define     C_VTUIPREFPOPUPBASE_H
+
+
+#include    "cvtuipopupbase.h"
+
+class MVtEngCameraPreferences;
+class CVtUiFeatureManager;
+/*
+*  CVtUiPrefPopupBase
+*
+*  Base class for video preference popups
+*
+*  @since S60 v3.2
+*/
+class CVtUiPrefPopupBase : public CVtUiPopupBase
+    {
+    
+public:
+
+    /**
+    * Destructor
+    */
+    ~CVtUiPrefPopupBase();
+
+
+public: // from CVtUiPopupBase
+
+    /**
+    * @see CVtUiPopupBase::HandleControlEventL
+    */
+    void HandleControlEventL( 
+        CCoeControl* aControl,TCoeEvent aEventType );
+    
+    /**
+    * @see CVtUiPopupBase::UpdatePopupL
+    */    
+    void UpdatePopupL();
+    
+private: // from base class
+    
+    /**
+    * @see CVtUiPopupBase::OfferKeyEventL
+    */  
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent, 
+            TEventCode aCode );
+
+protected: // new functions
+    
+    // Does the actual viewfinder adjusting
+    void AdjustVideoL( TInt aValue );
+    
+    // from base class CVtUiPopupBase::DoActivateL()
+    void DoActivateL();
+    
+    // Gets current adjustvalue
+    virtual TInt CurrentValue() = 0;
+    
+protected:
+
+    /**
+    * Constructor
+    */
+    CVtUiPrefPopupBase( CVtUiFeatureManager& aFeatureManager,
+        TVtUiBlockListBitField aBitField, TComponentId aComponentId,
+         TInt aCmdId );
+
+     /**
+     * 2nd constructor
+     */
+    void BaseConstructL();
+
+protected:    
+    
+    // Pointer to camera preferences
+    MVtEngCameraPreferences* iCameraPref;
+    
+    // Reference to feature manager
+    CVtUiFeatureManager& iFeatureManager;
+    
+    // Engine command id
+    TInt iEngineCommandId;
+    
+    // Current value
+    TInt iCurrent;
+    };
+
+#endif // C_VTUIPREFPOPUPBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuiprefsettinglistbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,204 @@
+/*
+* 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:  Base class for video preference setting list.
+*
+*/
+
+
+#ifndef C_VTUIPEFSETTINGLISTBASE_H
+#define C_VTUIPEFSETTINGLISTBASE_H
+
+#include    <akntransparentcamerasettingpage.h>
+#include    "mvtuicommandui.h"
+#include    "cvtuifeaturebase.h"
+#include    "mvtuicomponent.h"
+#include    "tvtuicomponentstate.h"
+#include    "tvtuifeatureids.h"
+#include    "mvtuisettingpageobserver.h"
+
+class CVtUiAppUi;
+class CVtUiTransparentSettingPage;
+class MVtEngCameraPreferences;
+
+/**
+*  CVtUiPrefSettingListBase
+*
+*  Base class for color tone and white balance
+*
+*  @since S60 v3.2
+*/
+class CVtUiPrefSettingListBase : public CVtUiFeatureBase,
+    public MAknSettingPageObserver, MVtUiSettingPageObserver
+    {
+
+public:
+
+    /**
+    * Destructor
+    */
+    ~CVtUiPrefSettingListBase();
+    
+    /**
+    * has pending settingpange changed cmd cause camera cover switched.
+    */
+    TBool IsPendingCmd();
+    
+    /**
+    * handle pending settingpange command
+    */
+    void HandlePendingCmdL();
+
+public: // from MVtUiFeature
+
+    /** 
+    * @see MVtUiFeature::Stop 
+    */
+    virtual void Stop() = 0;
+    
+    /** 
+    * @see MVtUiFeature::InitFeatureL
+    */
+    virtual void InitFeatureL();
+
+protected: // from MAknSettingPageObserver
+    
+    /** 
+    * @see MAknSettingPageObserver::HandleSettingPageEventL 
+    */
+    void HandleSettingPageEventL(
+        CAknSettingPage* aSettingPage,
+        TAknSettingPageEvent aEventType );    
+
+protected: // from MVtUiSettingPageObserver
+    
+    /** 
+    * @see MVtUiSettingPageObserver::ListStateChangedL
+    */
+    void ListStateChangedL();
+
+protected:
+     
+     // Gets currently selected list item
+     virtual TInt CurrentSelection() = 0;
+     
+     // Set items to setting page
+     virtual void SetItemsL( CDesCArray& aArray ) = 0;
+     
+     // Gets resource id for selection list
+     virtual TInt SettingPageResId() const = 0;
+     
+     // This function gets called when focus is moved
+     // to new item in the settin page list
+     virtual void SettingPageItemChangedL( TInt aIndex ) = 0;
+     
+     // Start function calls this
+     void StartSettingPageL();
+     
+     // Stop function calls this
+     void StopSettingPageL();
+     
+public: // from CCoeControl
+    
+    /* 
+    * @see CCoeControl::SizeChanged
+    */
+    void SizeChanged();
+    
+public:  
+ 
+    /** 
+    * Updates setting pages background bitmap
+    * @param aFrame Bitmap for setting page's backgound.
+    */
+    void UpdateBackground( CFbsBitmap* aFrame );
+    
+    /** 
+    * Updates setting value
+    * E.g disabling video will reset camera settings. and 
+    * after enabling video camera setting value needs to be restored.
+    */
+    void UpdateSettingL();
+
+protected:
+
+    /**
+     * Constructor
+     */
+    CVtUiPrefSettingListBase( CVtUiFeatureManager& aFeatureManager,
+        TVtUiFeatureId aFeatureId );
+
+     /**
+     * 2nd constructor
+     */
+    void ConstructL();
+
+    // Reads item from resource and appends it to the array
+    void ReadAndAppendItemL( CDesCArray& aItems, TInt aResId );
+
+private:
+    
+    // Does the initialisation of the setting page
+    void CreateSettingPageL();
+    
+    // Resizes backround bitmap
+    void ResizeBackroundBitmapRect( );
+
+protected:    
+    
+    // Pointer to camera preferences
+    MVtEngCameraPreferences* iCameraPref;
+    
+    // The original value (which was active when the
+    // setting page was launched)
+    TInt iOriginalSelection;
+    
+    // Supported color tone or white balance modes
+    TUint32 iSupportedModes;
+    
+    // Contains currenltly supported items in setting page
+    RArray< TInt> iActiveItems;
+            
+     // whether or not has a pending command
+     TBool iPendingSettingChangeCmd;
+
+private:
+    
+    // Owned setting page instance
+    CVtUiTransparentSettingPage* iSettingPage;
+    
+    // Background bitmap for  setting page
+    CFbsBitmap* iViewfinderBitmap;
+
+    // Currently focused value 
+    TInt iCurrentSelection;
+    
+    // Position of bitmap's top left corner
+    TPoint iBitmapTopLeftCorner;
+    
+    // Background bitmap's clip rect
+    TRect iBitmapClippingRect;
+    
+    // Reference to appui
+    CVtUiAppUi& iAppUi;
+    
+    // Window priority for context control
+    TInt iWindowPriority;
+    
+    // Window position for context control
+    TInt iWindowPosition;
+
+    
+    };
+
+#endif // CVTUIPEFSETTINGLISTBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuiprefsliderbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,75 @@
+/*
+* 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:  Base class for video pref sliders
+*
+*/
+
+
+#ifndef     CVTUIPREFSLIDERBASE_H
+#define     CVTUIPREFSLIDERBASE_H
+
+#include    "cvtuisliderbase.h"
+
+class CVtUiPopupBase;
+
+/**
+*  CVtUiPrefSliderBase
+*
+*  Base class for video pref sliders
+*
+*  @since S60 v3.2
+*/
+class CVtUiPrefSliderBase : public CVtUiSliderBase
+    {
+
+public:
+
+    /**
+    * Destructor
+    */
+    ~CVtUiPrefSliderBase();
+
+public: // from CVtUiSliderBase
+
+    /** 
+    * @see CVtUiSliderBase::StartL
+    */
+    void StartL();
+
+     /** 
+    * @see CVtUiSliderBase::Stop
+    */
+    void Stop();
+    
+     /** 
+    * @see CVtUiSliderBase::InitFeatureL
+    */
+    void InitFeatureL();
+
+protected: 
+
+    /*
+    * Constructor
+    */
+    CVtUiPrefSliderBase( CVtUiFeatureManager& aFeatureManager,
+        TVtUiFeatureId aFeatureId );
+
+    /**
+    * 2nd constructor
+    */
+    void BaseConstructL( ); 
+    
+    };
+
+#endif // CVTUIPREFSLIDERBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuiprefsliderskmodifier.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* 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:  Video preference slider softkey modifier class definition.
+*
+*/
+
+
+#ifndef C_VTUIPREFSLIDERMODIFIER_H
+#define C_VTUIPREFSLIDERMODIFIER_H
+
+#include <e32base.h>
+#include "cvtuicommandmodifybase.h"
+
+class   CVtUiAppUi;
+
+/**
+*  CVtUiPrefSliderSKModifier
+*
+* Video preference slider softkey modifier class definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiPrefSliderSKModifier : public CVtUiCommandModifyBase
+    {
+    public: // static methods
+        /**
+        * Static constructor.
+        * @param aAppUi Reference to command appui.
+        * @param aResourceId Reference resource id.
+        */
+        static CVtUiPrefSliderSKModifier* NewL( CVtUiAppUi& aAppUi,
+            TInt aResourceId );
+
+        /**
+        * Destructor
+        */
+        ~CVtUiPrefSliderSKModifier();
+
+    public: // from base class
+
+        /**
+        * @See CVtUiCommandModifyBase::ModifyCommandsL
+        */
+        virtual void ModifyCommandsL( MVtUiCommandSetting& aCommandSettings );
+
+       /**
+        * @See CVtUiCommandModifyBase::Supports
+        */
+        virtual TBool Supports( MVtUiCommandSetting::Type aType ) const;
+
+    private:
+        /**
+         * C++ constructor
+         *
+         */
+        CVtUiPrefSliderSKModifier( CVtUiAppUi& aAppUi, TInt aResourceId  );
+
+        /**
+         * 2nd constructor
+         */
+        void ConstructL();
+
+    private: // data
+
+        // refrence to appui
+        CVtUiAppUi& iAppUi;
+        
+        // softkey resource id
+        TInt iResourceId;
+
+    };
+
+#endif // C_VTUIPREFSLIDERMODIFIER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuitransparentsettingpage.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,103 @@
+/*
+* 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:  CVtUiTransparentSettingPage API definition.
+*
+*/
+
+
+#ifndef CVTUITRANSPARENTSETTINGPAGE_H
+#define CVTUITRANSPARENTSETTINGPAGE_H
+
+#include <akntransparentcamerasettingpage.h>
+
+class MVtUiSettingPageObserver;
+class CAknsBasicBackgroundControlContext;
+
+/**
+*  CVtUiTransparentSettingPage
+*
+*  CVtUiTransparentSettingPage API definition.
+*
+*  @since S60 v3.2
+*/   
+class CVtUiTransparentSettingPage : public CAknTransparentCameraSettingPage
+{
+public: // public methods
+    /**
+    * handle layoutChange
+     */
+    void HandleLayoutChangeL();
+
+    /**
+    * Constructor.
+    * @param aResourceID Setting Page to use.
+    * @param aCurrentSelectionIndex The currently selected index.
+    * @param aItemArray List of option texts and their selection states.
+    * @param aAppUi Reference to AppUi.
+    * @return Newly created instance of CVtUiTransparentSettingPage class.
+    */
+    CVtUiTransparentSettingPage(
+        TInt aResourceID, 
+        TInt& aCurrentSelectionIndex, 
+        const MDesCArray* aItemArray );
+     
+    /**
+    * 2nd constructor
+    */   
+    void ConstructL();
+        
+    /**
+    * Destructor
+    */        
+    ~CVtUiTransparentSettingPage();
+
+    /**
+    * Adds setting page observer.
+    * @param aObserver Observer for setting page.
+    */
+    void SetSettingPageEventStateObserver(
+        MVtUiSettingPageObserver* aObserver );
+
+private: // from aknsettinpage
+
+     /**
+     * @see CAknSettinPage::DynamicInitL
+     */
+     void  DynamicInitL();
+     
+     /**
+     * @get the layout data in portrait or landscape mode
+     */
+		 void		GetTheLayoutData();
+		 
+     /**
+     * @see CAknSettinPage::HandleControlEventL
+     */
+     void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
+     
+private: // new functions
+        
+        /*
+        * Gets rect from layout data.
+        */
+        TRect RectFromLayout( const TAknWindowComponentLayout&
+            aComponentLayout ) const;
+                 
+private:
+    
+    // Setting page observer
+    MVtUiSettingPageObserver* iSettingPageObserver;
+}; 
+
+#endif // CVTUITRANSPARENTSETTINGPAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuivideoquality.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,160 @@
+/*
+* 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:  Video quality feature.
+*
+*/
+
+
+#ifndef C_VTUIVIDEOQUALITY_H
+#define C_VTUIVIDEOQUALITY_H
+
+#include    <gulicon.h>
+#include    "cvtuifeaturebase.h"
+#include    "mvtuicomponent.h"
+#include    "tvtuicomponentstate.h"
+#include    "videotelui.hrh"
+
+/**
+*  TVtUiVideoQualityComponentState
+*
+* Video quality componentstate definition.
+*
+*  @since S60 v3.2
+*/
+class TVtUiVideoQualityComponentState : public TVtUiComponentState
+    {
+
+public:
+
+    /**
+    * Constructor
+    * @param aComponent Reference to component.
+    */
+    TVtUiVideoQualityComponentState( MVtUiComponent& aComponent );
+    
+    };
+
+/**
+*  CVtUiVideoQuality
+*
+*  Video quality UI feature definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiVideoQuality : public CVtUiFeatureBase,
+    public MVtUiComponent
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiVideoQuality* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * Destructor
+    */
+    ~CVtUiVideoQuality();
+
+public: // from MVtUiFeature
+
+    /** 
+    * @see MVtUiFeature::StartL
+    */
+    void StartL();
+
+    /** 
+    * @see MVtUiFeature::Stop 
+    */
+    void Stop();
+    
+    /** 
+    * @see MVtUiFeature::InitFeatureL
+    */
+    void InitFeatureL();
+
+public: // from MVtUiComponent
+
+    /**
+    * @see MVtUiComponent::ComponentId
+    */
+    MVtUiComponent::TComponentId ComponentId() const;
+
+    /**
+    * @see MVtUiComponent::ComponentAsControl
+    */
+    CCoeControl* ComponentAsControl();
+
+    /**
+    * @see MVtUiComponent::DoActivateL
+    */
+    void DoActivateL();
+
+    /**
+    * @see MVtUiComponent::DoDeactivateL
+    */
+    void DoDeactivateL();
+
+private:
+    
+    // Creates icons for list
+    CGulIcon* CreateIconLC( TVtUiBitmapId aIconId, TVtUiBitmapId aMaskId );
+
+    // Shows the selection list
+    void ShowSelectionListL();
+    
+    // Async the selection list
+    static TInt AsyncShowSelectionList( TAny* aPtr );
+    
+    // Reads items from source to target array and updates the selection icon
+    // if needed.
+    void SetItemsL( CDesCArray& aTarget,const CDesCArray& aSource );
+    
+    // Return curretly active item.
+    TInt ActiveItem() const;
+    
+    // Item selected, adjust video quality.
+    void ItemSelectedL( TInt aItemIndex );
+    
+private:
+
+    /**
+    * Constructor
+    */
+    CVtUiVideoQuality( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * 2nd constructor
+    */
+    void ConstructL();
+    
+    /**
+    * Callback function that stops the feature.
+    * @param aAny pointer to an instance of the class.
+    * @return always KErrNone.
+    */
+    static TInt DoStop( TAny* aAny );
+
+private:
+
+    // Component state
+    TVtUiVideoQualityComponentState iComponentState;
+    
+    // Async callback for selection list
+    CAsyncCallBack* iShowSelectionListCallback;
+    };
+
+#endif // CVTUIVIDEOQUALITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/cvtuiwhitebalance.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,167 @@
+/*
+* 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:  White balance feature.
+*
+*/
+
+
+#ifndef C_VTUIWHITEBALANCE_H
+#define C_VTUIWHITEBALANCE_H
+
+#include    <mvtengcamerapreferences.h>
+#include    "cvtuiprefsettinglistbase.h"
+#include    "tvtuicomponentstate.h"
+#include    "mvtuicomponent.h"
+#include    "mvtuilayoutchangeobserver.h"
+
+/**
+*  TVtUiWhiteBalanceComponentState
+*
+* Video quality componentstate definition.
+*
+*  @since S60 v3.2
+*/
+class TVtUiWhiteBalanceComponentState : public TVtUiComponentState
+    {
+
+public:
+
+    /**
+    * Constructor
+    * @param aComponent Reference to component.
+    */
+    TVtUiWhiteBalanceComponentState( MVtUiComponent& aComponent );
+    
+    };
+    
+/**
+*  CVtUiWhiteBalance
+*
+*  White balance UI feature definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiWhiteBalance : public CVtUiPrefSettingListBase,
+    public MVtUiComponent, public MVtUiLayoutChangeObserver 
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiWhiteBalance* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * Destructor
+    */
+    ~CVtUiWhiteBalance();
+
+public: // from MVtUiFeature
+
+    /** 
+    * @see MVtUiFeature::StartL 
+    */
+    void StartL();
+
+    /** 
+    * @see MVtUiFeature:Stop
+    */
+    void Stop();
+    
+    /** 
+    * @see MVtUiFeature::InitFeatureL 
+    */
+    void InitFeatureL();
+
+public: // from MVtUiComponent
+
+    /**
+    * @see MVtUiComponent::ComponentId
+    */
+    MVtUiComponent::TComponentId ComponentId() const;
+
+    /**
+    * @see MVtUiComponent::ComponentAsControl
+    */
+    CCoeControl* ComponentAsControl();
+
+    /**
+    * @see MVtUiComponent::DoActivateL
+    */
+    void DoActivateL();
+
+    /**
+    * @see MVtUiComponent::DoDeactivateL
+    */
+    void DoDeactivateL();
+
+public: // from MVtUiComponentManager
+
+    /**
+    * @see MVtUiComponentManager::HandleLayoutChangeL
+    */
+    void HandleLayoutChangeL();
+    
+protected: // from base class
+   
+   	/**
+    * @see CVtUiPrefSettingListBase::CurrentSelection
+    */
+    virtual TInt CurrentSelection();
+    
+    /**
+    * @see CVtUiPrefSettingListBase::SetItemsL
+    */
+    virtual void SetItemsL( CDesCArray& aArray );
+    
+    /**
+    * @see CVtUiPrefSettingListBase::SettingPageResId
+    */
+    virtual TInt SettingPageResId() const;
+    
+    /**
+    * @see CVtUiPrefSettingListBase::SettingPageItemChangedL
+    */
+    virtual void SettingPageItemChangedL( TInt aIndex );
+
+private:
+
+    /**
+    * Constructor
+    */
+    CVtUiWhiteBalance( CVtUiFeatureManager& aFeatureManager );
+
+    // Maps white balance enum to array index
+    TInt MapWBEnumToArrayIndex( MVtEngCameraPreferences::TWhiteBalance&
+        aWhiteBalance ) const;
+    
+    // Maps arrya index to white balance enum 
+    MVtEngCameraPreferences::TWhiteBalance MapArrayIndexToWBEnum( TInt aIndex) const;        
+
+    // Callback function that stops the feature.
+    static TInt DoStopL( TAny* aAny );
+    
+    // Callback function that starts the feature.
+    static TInt DoStartL( TAny* aAny );    
+    
+private:
+
+    // Component state
+    TVtUiWhiteBalanceComponentState iComponentState;
+
+    };
+
+#endif // CVTUIWHITEBALANCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/prefs/mvtuisettingpageobserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* 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:  Observer API for CVtUiTransparentSettingPage.
+*
+*/
+
+
+#ifndef M_VTUISETTINGPAGEOBSERVER_H
+#define M_VTUISETTINGPAGEOBSERVER_H
+
+/**
+* MVtUiSettingPageObserver
+*
+* Observer API for CVtUiTransparentSettingPage.
+*
+* @since S60 v3.2
+*/
+class MVtUiSettingPageObserver
+    {
+
+public:
+
+    /**
+    * Called when EEventStateChanged event occurs 
+    * in setting page.
+    */
+    virtual void ListStateChangedL() = 0;
+
+    };
+
+#endif // M_VTUISETTINGPAGEOBSERVER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/softkey/cvtuisoftkeycontext.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* 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:  Softkey context class definition.
+*
+*/
+
+
+#ifndef C_VTUISOFTKEYCONTEXT_H
+#define C_VTUISOFTKEYCONTEXT_H
+
+#include <e32base.h>
+
+#include "cvtuicmdcontext.h"
+
+/**
+ *  CVtUiSoftkeyContext
+ *
+ *  Softkey command context class definition.
+ *
+ *  @since S60 v3.2
+ */
+class CVtUiSoftkeyContext : public CVtUiCmdContext
+    {
+
+public: // public methods
+
+    /**
+     * C++ destructor.
+     */
+    ~CVtUiSoftkeyContext();
+
+    /**
+     * Static constructor
+     * @param aCommandManager Reference to command manager.
+     */
+    static CVtUiSoftkeyContext* NewL( MVtUiCommandManager& aCommandManager );
+
+public: // virtual methods
+
+    /**
+     * Make validations.
+     *
+     * @param aAction Reference to validation action base.
+     */
+    void ValidateL( CVtUiCmdValidationActionBase& aAction );
+
+private:
+
+    /**
+     * C++ constructor
+     *
+     *  @param aCommandManager Reference to command manager.
+     */
+    CVtUiSoftkeyContext( MVtUiCommandManager& aCommandManager );
+
+    /**
+     * 2nd consttuctor, may leave.
+     */
+    void ConstructL();
+
+    };
+
+#endif // C_VTUISOFTKEYCONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/softkey/cvtuisoftkeys.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,127 @@
+/*
+* 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:  Softkey UI feature.
+*
+*/
+
+
+#ifndef C_VTUISOFTKEYS_H
+#define C_VTUISOFTKEYS_H
+
+#include "mvtuicommandui.h"
+#include "cvtuifeaturebase.h"
+
+class CEikButtonGroupContainer;
+class CVtUiSoftkeySetting;
+class CVtUiCommandModifyBase;
+class CVtUiSoftkeyValidationAction;
+class CVtUiSoftkeyContext;
+
+/**
+ *  CVtUiSoftkeys
+ *
+ *  Sofktey UI feature definition.
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVtUiSoftkeys ) : public CVtUiFeatureBase,
+    public MVtUiCommandUi
+    {
+
+public:
+
+    /**
+     * Static constructor
+     * @param aFeatureManager Reference to feature manager.
+     * @param aButtonGroupContainer Reference to button group container.
+     */
+    static CVtUiSoftkeys* NewL( CVtUiFeatureManager& aFeatureManager,
+        CEikButtonGroupContainer& aButtonGroupContainer );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiSoftkeys();
+
+public:
+
+    /**
+     * Returns reference to application button group container.
+     */
+    CEikButtonGroupContainer& ButtonGroup();
+
+public: // from CVtUiFeatureBase
+
+    /**
+    * @see CVtUiFeatureBase::StartL
+    */
+    void StartL();
+
+    /**
+    * @see CVtUiFeatureBase::Stop
+    */
+    void Stop();
+
+    /**
+    * @see CVtUiFeatureBase::InitFeatureL
+    */
+    void InitFeatureL();
+
+public: // from MVtUiCommandUi
+
+    /**
+     * @see MVtUiCommandUi::RefreshL
+     */
+    void RefreshL();
+
+    /**
+     * @see MVtUiCommandUi::AddCommandModifierL
+     */
+    TInt AddCommandModifier( CVtUiCommandModifyBase& aModifier );
+
+    /**
+     * @see MVtUiCommandUi::RemoveCommandModifierL
+     */
+    void RemoveCommandModifier( CVtUiCommandModifyBase& aModifier );
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiSoftkeys( CVtUiFeatureManager& aFeatureManager,
+        CEikButtonGroupContainer& aButtonGroupContainer );
+
+    /**
+     * 2nd constructor
+     */
+    void ConstructL();
+
+private:
+
+    // Softkey container
+    CEikButtonGroupContainer& iButtonGroupContainer;
+
+    // Softkey context instance
+    CVtUiSoftkeyContext* iSoftkeyCommandContext;
+
+    // Softkey setter
+    CVtUiSoftkeySetting* iSoftkeySetting;
+
+    // Softkey validation action instance
+    CVtUiSoftkeyValidationAction* iSoftkeyValidationAction;
+
+    };
+
+#endif // C_VTUISOFTKEYS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/softkey/cvtuisoftkeysetting.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* 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:  Softkey settings class definition.
+*
+*/
+
+
+#ifndef C_VTUISOFTKEYSETTING_H
+#define C_VTUISOFTKEYSETTING_H
+
+#include "cvtuicommandsetting.h"
+
+class CVtUiSoftkeys;
+class CVtUiSoftkeyValidationAction;
+
+/**
+ *  CVtUiSoftkeySetting
+ *
+ *  Softkey setting class definition.
+ *
+ *  @since S60 v3.2
+ */
+class CVtUiSoftkeySetting :
+    public CVtUiCommandSetting< CVtUiSoftkeyValidationAction >
+    {
+
+public:
+
+    /**
+     * Constructor
+     * @param aSoftkeys Reference to softkeysr.
+     */
+    CVtUiSoftkeySetting( CVtUiSoftkeys& aSoftkeys );
+
+    /**
+     * Destructor
+     */
+    ~CVtUiSoftkeySetting();
+
+public: // from CVtUiCommandSetting
+
+    /**
+     * @see CVtUiCommandSetting::DoDefineCommandsL
+     */
+    void DoDefineCommandsL();
+
+private:
+
+    // Softkey container
+    CVtUiSoftkeys* iSoftkeys;
+
+    };
+
+#endif // C_VTUISOFTKEYSETTING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/softkey/cvtuisoftkeyvalidationaction.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* 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:  Softkey validation action class definition.
+*
+*/
+
+
+#ifndef C_CVTUISOFTKEYVALIDATIONACTION_H
+#define C_CVTUISOFTKEYVALIDATIONACTION_H
+
+#include <e32base.h>
+
+#include "cvtuicmdvalidationactionbase.h"
+
+/**
+ *  CVtUiSoftkeyValidationAction
+ *
+ *  Softkey validation action definition.
+ *
+ *  @since S60 v3.2
+ */
+class CVtUiSoftkeyValidationAction : public CVtUiCmdValidationActionBase
+    {
+
+public:
+
+    /**
+     * Static constructor
+     */
+    static CVtUiSoftkeyValidationAction* NewL();
+
+public: // from CVtUiCmdValidationActionBase
+
+    /**
+     * @see CVtUiCmdValidationActionBase::BeginProcess
+     */
+    void BeginProcess();
+
+    /**
+     * @see CVtUiCmdValidationActionBase::ProcessL
+     */
+    void ProcessL( const MVtUiCmdValidatorCallBack& aCallBack );
+
+public: // new methods
+
+    /**
+     * Returns resource id after validation process.
+     */
+    TInt ResourceId() const;
+
+private:
+
+    /**
+     * C++ constructor.
+     *
+     */
+    CVtUiSoftkeyValidationAction();
+
+private: // data
+
+    // Index to currently selected softkey
+    TInt iCurrentIdx;
+
+    };
+
+#endif // C_CVTUISOFTKEYVALIDATIONACTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/toolbar/cvtuifixedtoolbar.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 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:  Fixed toolbar UI feature class definition.
+*
+*/
+
+
+#ifndef C_VTUIFIXEDTOOLBAR_H
+#define C_VTUIFIXEDTOOLBAR_H
+
+#include "cvtuitoolbarbase.h"
+
+/**
+* CVtUiFixedToolbar
+*
+* Toolbar UI feature definition.
+*
+* @since S60 3.2
+*/
+class CVtUiFixedToolbar : public CVtUiToolbarBase
+    {
+    public: // public methods
+
+        /**
+        * Static constructor.
+        * @param aFeatureManager feature manager.
+        */
+        static CVtUiFixedToolbar* NewL(CVtUiFeatureManager& aFeatureManager );
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiFixedToolbar();
+
+    public: // from CVtUiToolbarBase
+
+        /**
+        * @see CVtUiToolbarBase::DoActivateL
+        */
+        void DoActivateL();
+
+        /**
+        * @see CVtUiToolbarBase::DoDeactivateL
+        */
+        void DoDeactivateL();
+
+        /**
+        * @see CVtUiToolbarBase::CreateToolbarButtonsL
+        */
+        void CreateToolbarButtonsL();
+
+        /**
+        * @see CVtUiToolbarBase::PopulateCmdsIdsL
+        */
+        void PopulateCmdsIdsL();
+
+        /**
+        * @see CVtUiToolbarBase::SetToolbarVisibilityAfterLayoutChange
+        */
+        void SetToolbarVisibilityAfterLayoutChangeL( TBool aVisible );
+
+    private:
+
+        // Hides/shows toolbar
+        void MakeToolbarVisible( const TBool aVisible );
+
+        // Dimms/undimms all toolbar buttons
+        void DimToolbarbuttons( TBool aIsDimmed );
+
+        // Sets toolbar visible
+        static TInt DoShowToolbarL( TAny* aAny );
+
+        // Sets toolbar buttons dimmed
+        static TInt DoDimToolbarButtons( TAny* aAny );
+
+    private:
+
+        /**
+        * C++ constructor
+        */
+        CVtUiFixedToolbar( CVtUiFeatureManager& aFeatureManager );
+
+        /**
+        * 2nd phase constructor
+        */
+        void ConstructL();
+
+    private: // data
+
+        // for callback usage
+        CIdle* iIdle;
+    };
+
+#endif // C_VTUIFIXEDTOOLBAR_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/toolbar/cvtuifloatingtoolbar.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* 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:  Floating toolbar UI feature class definition.
+*
+*/
+
+
+#ifndef C_VTUIFLOATINGTOOLBAR_H
+#define C_VTUIFLOATINGTOOLBAR_H
+
+#include "cvtuitoolbarbase.h"
+#include "mvtuiresourcechangeobserver.h"
+#include <aknlayoutscalable_avkon.cdl.h>
+
+/**
+* CVtUiFloatingToolbar  
+* 
+* Toolbar UI feature definition.
+*
+* @since S60 3.2
+*/
+class CVtUiFloatingToolbar : public CVtUiToolbarBase,
+    public MVtUiResourceChangeObserver
+    {
+    public: // public methods
+
+        /**
+        * Static constructor.
+        * @param aFeatureManager feature manager.
+        */
+        static CVtUiFloatingToolbar* NewL( CVtUiFeatureManager& 
+            aFeatureManager );
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiFloatingToolbar();
+    
+       
+    public: // from CVtUiToolbarBase
+
+
+        /**
+        * @see CVtUiToolbarBase::DoActivateL
+        */
+        void DoActivateL();
+
+        /**
+        * @see CVtUiToolbarBase::DoDeactivateL
+        */
+        void DoDeactivateL();
+
+        /**
+        * @see CVtUiToolbarBase::CreateToolbarButtonsL
+        */
+        void CreateToolbarButtonsL();
+
+        /**
+        * @see CVtUiToolbarBase::PopulateCmdsIdsL
+        */
+        void PopulateCmdsIdsL();            
+
+    public: // from MVtUiResourceChangeObserver
+
+        /**
+        * @see MVtUiComponent::HandleResourceChangeL
+        */
+        void HandleResourceChangeL( TInt aType );         
+         
+    private:
+
+        /**
+        * C++ constructor
+        */
+        CVtUiFloatingToolbar( CVtUiFeatureManager& aFeatureManager );
+
+        /**
+        * 2nd phase constructor
+        */
+        void ConstructL();
+    
+        /**
+
+        /*
+        * Gets rect from layout data.
+        */
+        TRect RectFromLayout( const TAknWindowComponentLayout&
+            aComponentLayout ) const;
+
+        /*
+        * Sets toolbar layout.
+        */
+        void LayoutToolbarL();
+
+        /*
+        * Gets variety for layoutdata.
+        */
+        TInt GetVariety( TBool aIsLandscapeOrientation );
+    
+    private: // data
+
+    
+        
+    };
+
+#endif // C_VTUIFLOATINGTOOLBAR_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/toolbar/cvtuihidetoolbaritemaction.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* 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:  Toolbar hide item action class definition.
+*
+*/
+
+
+#ifndef C_VTUIHIDETOLLBARITEMACTION_H
+#define C_VTUIHIDETOLLBARITEMACTION_H
+
+#include    <e32base.h>
+#include    "cvtuicmdvalidationactionbase.h"
+#include    "tvtuistates.h"
+
+class CVtUiToolbarBase;
+
+/**
+*  CVtUiHideToolbarItemAction
+*
+*  Toolbar hide item action definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiHideToolbarItemAction : public CVtUiCmdValidationActionBase
+    {
+    public:
+
+        /**
+        * Leave-safe constructor.
+        * @param aToolbar Pointer to toolbar.
+        * @param aUiStates Reference to uistates.
+        */
+        static CVtUiHideToolbarItemAction* NewL( CVtUiToolbarBase* aToolbar,
+               const TVtUiStates& aUiStates );
+         
+        /**
+        * Destructor
+        *
+        */
+        ~CVtUiHideToolbarItemAction();
+
+    public: // from CVtUiCmdValidationActionBase
+
+        /**
+        * @See CVtUiCmdValidationActionBase::ProcessL
+        */
+        void ProcessL( const MVtUiCmdValidatorCallBack& aCallBack );
+
+        
+         /**
+         * @See CVtUiCmdValidationActionBase::EndProcess
+         */
+         virtual void EndProcess();
+        
+    private:
+
+        /**
+        * C++ constructor.
+        *
+        */
+        CVtUiHideToolbarItemAction( CVtUiToolbarBase* aToolbar,
+            const TVtUiStates& aUiStates );
+
+        /**
+        * Sets given toolbar control hidden in toolbar.
+        *
+        */
+        void SetItemHiddenL( TInt aCommandId );
+        
+        /**
+        * Decides if toolbar control should be dimmed or shown.
+        *
+        */
+        void HideOrShowToolbarControlL( TInt aCommandId );
+
+    private: // data
+
+        // Toolbar instance this action is currently working on
+        CVtUiToolbarBase* iToolbar;
+        
+        // Reference to UI states instance
+        const TVtUiStates& iUiStates;
+        };
+
+#endif // C_VTUIHIDETOLLBARITEMACTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/toolbar/cvtuitoolbarbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,372 @@
+/*
+* 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:  Base class for toolbar.
+*
+*/
+
+
+#ifndef C_VTUITOOLBAR_H
+#define C_VTUITOOLBAR_H
+
+#include <e32base.h>
+#include <aknappui.h>
+#include <akntoolbarobserver.h>
+
+#include "mvtuifeature.h"
+#include "CVtUiAppUi.h"
+#include "cvtuifeaturebase.h"
+#include "mvtuicommandui.h"
+#include "mvtuicomponent.h"
+#include "mvtuiresourcechangeobserver.h"
+#include "tvtuicomponentstate.h"
+#include  "mvtuilayoutchangeobserver.h"
+#include <aknlayoutscalable_avkon.cdl.h>
+
+class MVtuiFeature;
+class CAknToolbar;
+class CVtUiToolbarItem;
+class TVtUiFeatureState;
+class TVtUiStates;
+class CVtUiToolbarContext;
+class CVtUiToolbarCmdPolicy;
+class CVtUiHideToolbarItemAction;
+class CVtUiFeatureManager;
+class CVtUiToolbarSKModifier;
+class CVtUiToolbarButton;
+
+/**
+*  TVtUiToolbarComponentState
+*
+* Toolbar componentstate definition.
+*
+*  @since S60 v3.2
+*/
+class TVtUiToolbarComponentState : public TVtUiComponentState
+    {
+
+public:
+
+    /**
+    * Constructor
+    * @param aComponent Reference to component.
+    */
+    TVtUiToolbarComponentState( MVtUiComponent& aComponent );
+    
+    };
+
+/**
+* CVtUiToolbar  
+* 
+* Toolbar UI feature definition.
+*
+* @since S60 3.2
+*/
+class CVtUiToolbarBase : public CVtUiFeatureBase, public MAknToolbarObserver,
+    public MVtUiCommandUi, public MVtUiComponent,
+    public MVtUiLayoutChangeObserver
+    {
+    public: // public methods
+
+        /**
+        * C++ destructor.
+        */
+        ~CVtUiToolbarBase();
+    
+    public: // from MAknToolbarObserver 
+    
+        /**
+        * @see MAknToolbarObserver::DynInitToolbarL
+        */
+        void DynInitToolbarL( 
+            TInt aResourceId,
+            CAknToolbar* aToolbar );
+        
+        /**
+        * @see MAknToolbarObserver::DynInitToolbarL
+        */
+        void OfferToolbarEventL( TInt aCommand );
+    
+    public: // from MVtUiFeature
+        /**
+        * @see MVtUiFeature::StartL
+        */
+        void StartL();
+
+        /**
+        * @see MVtUiFeature::Stop
+        */
+        void Stop();
+        
+        /*
+        * @see MVtUiFeature::InitFeatureL
+        */
+        void InitFeatureL();
+        
+    public: // from MVtUiCommandUi
+    
+        /**
+        * @see MVtUiCommandUi::RefreshL
+        */
+        void RefreshL();
+
+        /**
+        *  @see MVtUiCommandUi::AddCommandModifier
+        */
+         TInt AddCommandModifier( CVtUiCommandModifyBase& aModifier );
+
+        /**
+        * @see MVtUiCommandUi::RemoveCommandModifier
+        */
+         void RemoveCommandModifier( CVtUiCommandModifyBase& aModifier );
+        
+    public: // from MVtUiComponent
+
+        /**
+        * @see MVtUiComponent::ComponentId
+        */
+        TComponentId ComponentId() const;
+
+        /**
+        * @see MVtUiComponent::ComponentAsControl
+        */
+        CCoeControl* ComponentAsControl();
+
+        /**
+        * @see MVtUiComponent::DoActivateL
+        */
+        virtual void DoActivateL();
+
+        /**
+        * @see MVtUiComponent::DoDeactivateL
+        */
+        virtual void DoDeactivateL();
+    
+    public: // from MVtUiComponentManager
+
+        /**
+        * @see MVtUiComponentManager::HandleLayoutChangeL
+        */
+        void HandleLayoutChangeL();
+
+    public:
+
+        /**
+        * Return number of commands in toolbar.
+        * @return Number of commands.
+        */
+        TInt NumberOfToolbarControls() const;
+        
+        /**
+        * Maps command id array index to command id.
+        * @param aIndex Command id array index.
+        * @return Command id associated with index.
+        */
+        TInt CommandIdByCmdIdsArrayIndex( TInt aIndex ) const;
+   
+        /**
+        * Updates toolbar's buttons states and
+        * redraws the toolbar.
+        */
+        void UpdateToolbarL();
+     
+        /**
+        * EHidden
+        *  command is hidden
+        * EDimmed
+        *  command is dimmed
+        * EShown
+        * command is visible
+        */
+        enum TCmdStateFlags
+            {
+            ENotInitialized = -1,
+            EHidden,
+            EDimmed,
+            EShown
+            }; 
+
+         /**
+        * Sets visibility of toolbar commands.
+        * @param aCmdId command id.
+        * @param aNewState command's new state.
+        * @return ETrue if command is available, otherwise EFalse.
+        */
+        void SetCmdIdVisibilityStateL( TInt aCmdId, TCmdStateFlags aNewState);
+        
+        /**
+        * Cheks if command is available in toolbar.
+        * @param aCmdId command id.
+        * @return ETrue if command is available, otherwise EFalse.
+        */
+        TBool IsCommandInToolbar( TInt aCmdId ) const;
+         
+    protected:
+
+        /**
+        * C++ constructor
+        */
+        CVtUiToolbarBase( CVtUiFeatureManager& aFeatureManager );
+
+        /**
+        * 2nd phase constructor
+        */
+        void BaseConstructL();
+
+    protected:    
+  
+        /**
+        * Creates toolbar buttons
+        */
+        virtual void CreateToolbarButtonsL();
+
+        /*
+        * Appends all the commnands used by toolbar to an array.
+        */
+        virtual void PopulateCmdsIdsL();    
+            
+        /*
+        * Sets toolbar visibility after layoutchange
+        */    
+        virtual void SetToolbarVisibilityAfterLayoutChangeL( TBool aVisible );
+    
+        /**
+        * Creates all toolbar items()
+        */
+        void CreateToolbarItemL( TInt aResourceId,
+            TInt aCommandId, CVtUiAppUi& appUi );
+   
+        /**
+        * Finds command from array by command id.
+        */
+        CVtUiToolbarButton* FindToolbarItemByCommandId( const TInt aCommandId );
+         
+        /*
+        * Starts or stops to block pointer events
+        * @param aIsBlocking ETrue if events are blocked
+        * otherwise EFalse
+        */
+        void BlockPointerEvents( TBool aIsBlocking );
+           
+        /*
+        * Starts or stops to block key events
+        * @param aIsBlocking ETrue if events are blocked
+        * otherwise EFalse
+        */
+        void BlockKeyEvents( TBool aIsBlocking );
+         
+        /*
+        * Cheks if dialer component is active
+        * @return ETrue if dialer is aactive, otherwise EFalse. 
+        */
+        TBool IsDialerActive() const;
+        
+        /**
+        * Dims toolbar.
+        * @param aDimmed ETrue ETrue to dim the toolbar, 
+        *      EFalse to set the toolbar as not dimmed
+        */
+        void DimToolbar( const TBool aDimmed, const TBool aDrawNow );
+    private:
+    
+        /**
+        * Hides command from toolbar.
+        */
+        void HideToolbarButton( const TInt aCommandId, const TBool aHide,
+            const TBool aDrawNow );
+        
+        /**
+        * Dims command from toolbar.
+        */
+        void DimToolbarButton( const TInt aCommandId, const TBool aDimmed,
+            const TBool aDrawNow ); 
+       
+        /**
+        * Maps toggle button id to single command id.
+        */
+        TInt MapCmdIdToChilId( TInt aCmdId );
+        
+        /**
+        * Maps single command id to toggle button id.
+        */
+        TInt MapCmdIdToParentId( TInt aCmdId );
+        
+        /*
+        * Checks if command id associated with toggle button is visible.
+        * Togglle button has two states and two command ids which has their
+        * own state values. See from .rss file.
+        */
+        TBool IsCmdIdVisibleInToggleButton( TInt aCmdId );
+        
+        /*
+        * Checks if both command ids in togglebutton are dimmed.
+        */
+        TBool IsToggleButtonHidden( TInt aFirstCmdId, TInt aSecondCmdId );
+        
+        /*
+        * Removes registrations.
+        */
+        void Clean();
+        
+    protected: // data
+        
+        // array of supported commmand ids
+        RArray<TInt> iCmdIds;    
+        
+        // current focus id
+        TInt iCmdFocus;
+        
+         // owned toolbar control
+        CAknToolbar* iToolbar;
+        
+        // Number of supported toolbar buttons
+        TInt iNumberOfToolbarButtons;
+     
+    private: // data
+         
+        // struct used by iCmdStates array
+        class TCommandState 
+            {
+            public:
+                TInt iCmdId;
+                TCmdStateFlags iOldState;
+                TCmdStateFlags iNewState;
+            };     
+        
+         // owned toolbar item array
+        RPointerArray<CVtUiToolbarButton> iToolBarControls;
+
+        // toolbar context instance
+        CVtUiToolbarContext* iToolbarCtx; 
+       
+        // owned hide toolbar item action
+        CVtUiHideToolbarItemAction* iHideToolbarItemAction;
+        
+        // Toolbar command policy instance
+        CVtUiToolbarCmdPolicy* iToolbarCmdPolicy;
+        
+        // owned softkey modifier
+        CVtUiToolbarSKModifier* iToolbarSKModifier;
+        
+        // array which hold state information of the commands
+        RArray<TCommandState> iCmdStates;
+        
+        // Component state
+        TVtUiToolbarComponentState iComponentState;
+        
+        // ETrue if capture mode was on in previous update
+        TBool iWasCaptureModePreviousState;
+    
+    };
+
+#endif // C_VTUITOOLBAR_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/toolbar/cvtuitoolbarbutton.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,131 @@
+/*
+* 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:  CVtUiToolbarButton class definition.
+*
+*/
+
+
+#ifndef C_VTUITOOLBARBUTTON_H
+#define C_VTUITOOLBARBUTTON_H
+
+#include <aknbutton.h> 
+
+class CVtUiAppUi;
+
+/**
+*  CVtUiToolbarButton
+*
+*  Toolbar button class definition.
+*
+*  @since S60 3.2
+*/
+class CVtUiToolbarButton : public CAknButton
+    {
+    public:
+    
+        /**
+        * Static constructor.
+        * @param aResourceId Resource id.
+        * @param aAppUi Reference to appui.
+        * @param aCmdId Reference to command id.
+        */
+    	static CVtUiToolbarButton* NewL( TInt aResourceId, 
+		    CVtUiAppUi& aAppUi, TInt aCmdId );
+		
+		 /**
+        * Static constructor.
+        * @param aResourceId Resource id.
+        * @param aAppUi Reference to appui.
+        * @param aCmdId Reference to command id.
+        */
+    	static CVtUiToolbarButton* NewLC( TInt aResourceId, 
+		    CVtUiAppUi& aAppUi, TInt aCmdId );
+		
+        /**
+        * C++ destructor.
+        */
+		~CVtUiToolbarButton();
+		
+        /*  
+        * Shows help text for a certain period of time.              	
+        */
+        void ShowHelpL(); 
+          
+        /*  
+        * Return commmand id
+        */           
+        TInt CmdId() const;   
+        
+        /*
+        * Starts or stops to block pointer events
+        * @param aIsBlocking ETrue if events are blocked
+        * otherwise EFalse
+        */
+        void BlockPointerEvents( TBool aIsBlocking );
+           
+        /*
+        * Starts or stops to block key events
+        * @param aIsBlocking ETrue if events are blocked
+        * otherwise EFalse
+        */
+        void BlockKeyEvents( TBool aIsBlocking );      
+        
+        
+        /* @see CAknButton::OfferKeyEventL */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+            TEventCode aType );
+        
+        /* @see CAknButton::HandlePointerEventL */
+        void HandlePointerEventL( const TPointerEvent&
+            aPointerEvent );                                  	
+
+        /* @see CAknButton::StatesCount */
+        TInt StatesCount() const;
+
+    private:
+    
+        /**
+        * Constructor
+        */
+        CVtUiToolbarButton( CVtUiAppUi& aAppUi, TInt aCmdId );
+        	 
+    private:
+        
+        /**
+        * Checks whether key events should be blocked.
+        */
+        TBool IsCommandActive() const;  
+        
+    private: 
+         
+         // reference to appui
+         CVtUiAppUi& iAppUi;
+         
+         // command id
+         TInt iCmdId;
+         
+         // Flag to indicate is key event  blocking on
+         TBool iIsBlockingKeyEvents;
+         
+         // Flag to indicate is pointer event blocking on
+         TBool iIsBlockingPointerEvents;
+         
+         // time stamp to limit pointerevents
+         TTime iTimeStamp;
+         
+         TBool isLimitingPointers;
+         
+    };
+
+#endif // C_VTUITOOLBARBUTTON_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/toolbar/cvtuitoolbarcmdpolicy.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* 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:  Toolbar command policy implementation.
+*
+*/
+
+
+#ifndef C_VTUITOOLBARCMDPOLICY_H
+#define C_VTUITOOLBARCMDPOLICY_H
+
+#include <e32base.h>
+
+#include "tvtuicmdpolicypriority.h"
+#include "cvtuicmdvalidatorbase.h"
+
+class CVtUiCmdValidationActionBase;
+class CVtUiToolbarBase;
+
+/**
+*  CVtUiToolbarCmdPolicy
+*
+*  Toolbar command policy implementation.
+*
+*  @since S60 v3.2
+*/
+class CVtUiToolbarCmdPolicy : public CVtUiCmdValidatorBase
+    {
+    public: // public methods
+
+        /**
+        * Static constructor.
+        * @param aToolbar Reference to toolbar.
+        */
+        static CVtUiToolbarCmdPolicy* NewL( CVtUiToolbarBase& aToolbar );
+
+    public: // from CVtUiCmdValidatorBase
+
+        /**
+        * @see CVtUiCmdValidatorBase::ValidateMenuItemsL
+        */
+        void ValidateMenuItemsL( CVtUiCmdValidationActionBase& aAction,
+            TInt aReferencePriority );
+
+        /**
+        * @see CVtUiCmdValidatorBase::ValidateSoftkeyItemsL
+        */
+        void ValidateSoftkeyItemsL( CVtUiCmdValidationActionBase& aAction,
+            TInt aReferencePriority );
+
+        /**
+        * @see CVtUiCmdValidatorBase::ValidateToolbarItemsL
+        */
+        void ValidateToolbarItemsL( CVtUiCmdValidationActionBase& aAction,
+            TInt aReferencePriority );
+
+        /**
+        * @see CVtUiCmdValidatorBase::CustomValidationL
+        */
+        void CustomValidationL( CVtUiCmdCustomValidationActionBase& aAction,
+            TInt aReferencePriority );
+
+        /**
+        * @see CVtUiCmdValidatorBase::ValidatesContext
+        */
+        TBool ValidatesContext( const TVtUiCmdContextType& aCtxType )
+            const;
+            
+    private:
+
+        /**
+        * C++ constructor
+        *
+        */
+        CVtUiToolbarCmdPolicy( CVtUiToolbarBase& aToolbar );
+
+        /**
+        * Callback for menu validation.
+        *
+        */
+        TBool ValidateMenuCommand( TInt aCommandId ) const;
+
+    private: // data
+
+        // Reference to cvtuitoolbar
+        CVtUiToolbarBase& iToolbar;
+        
+    };
+
+#endif // C_VTUITOOLBARCMDPOLICY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/toolbar/cvtuitoolbarcontext.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* 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:  Toolbar context class definition.
+*
+*/
+
+
+#ifndef C_VTUITOOLBARCONTEXT_H
+#define C_VTUITOOLBARCONTEXT_H
+
+#include <e32base.h>
+
+#include "cvtuicmdcontext.h"
+
+class CVtUiCmdValidatorBase;
+
+/** Toolbar context reference priority */
+const TInt KVtUiToolbarContextPriority = 50;
+
+/**
+*  CVtUiToolbarContext
+*
+*  Toolbar context class definition.
+*
+*  @since S60 v3.2
+*/
+class  CVtUiToolbarContext : public CVtUiCmdContext
+    {
+    public: // public methods
+
+        /**
+         * C++ destructor.
+         *
+         */
+        ~CVtUiToolbarContext();
+
+        /**
+        * Leave safe destructor.
+        * @param aCommandManager Reference to command manager.
+        */
+        static CVtUiToolbarContext* NewL(
+            MVtUiCommandManager& aCommandManager );
+
+    public: // from CVtUiCmdContext
+
+        /**
+        *  @see CVtUiCmdContext::ValidateL
+        */
+        void ValidateL( CVtUiCmdValidationActionBase& aAction );
+
+    private:
+
+        /**
+        * C++ constructor
+        *
+        * @param aCommandManager Reference to command manager.
+        */
+        CVtUiToolbarContext( MVtUiCommandManager& aCommandManager );
+
+        /**
+         * 2nd consttuctor, may leave.
+         */
+        void ConstructL();
+        
+    };
+
+#endif // C_VTUITOOLBARCONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/toolbar/cvtuitoolbarskmodifier.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* 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:  Toolbar softkey modifier class definition.
+*
+*/
+
+
+#ifndef C_VTUITOOLBARSKMODIFIER_H
+#define C_VTUITOOLBARSKMODIFIER_H
+
+#include <e32base.h>
+#include "cvtuicommandmodifybase.h"
+
+class   CVtUiAppUi;
+class   TVtUiStates;
+
+/**
+*  CVtUiToolbarSKModifier
+*
+* Toolbar softkey modifier class definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiToolbarSKModifier : public CVtUiCommandModifyBase
+    {
+    public: // static methods
+        /**
+        * Static constructor.
+        * @param aAppUi Reference to command appui.
+        * @param aUiStates Reference to uistates.
+        */
+        static CVtUiToolbarSKModifier* NewL( CVtUiAppUi& aAppUi,
+                const TVtUiStates& aUiStates );
+
+        /**
+        * Destructor
+        */
+        ~CVtUiToolbarSKModifier();
+
+    public: // from base class
+
+        /**
+        * @See CVtUiCommandModifyBase::ModifyCommandsL
+        */
+        virtual void ModifyCommandsL( MVtUiCommandSetting& aCommandSettings );
+
+       /**
+        * @See CVtUiCommandModifyBase::Supports
+        */
+        virtual TBool Supports( MVtUiCommandSetting::Type aType ) const;
+
+    private:
+        /**
+         * C++ constructor
+         *
+         */
+        CVtUiToolbarSKModifier( CVtUiAppUi& aAppUi,
+                const TVtUiStates& aUiStates );
+
+        /**
+         * 2nd constructor
+         */
+        void ConstructL();
+
+    private: // data
+
+        // refrence to appui
+        CVtUiAppUi& iAppUi;
+
+        // UI states
+        const TVtUiStates& iUiStates;
+
+    };
+
+#endif // C_VTUITOOLBARSKMODIFIER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/toolbar/tvtuitoolbarcommanditerator.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* 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:  Toolbar command iterator class definition.
+*
+*/
+
+
+#ifndef T_VTUITOOLBARCOMMANDITERATOR_H
+#define T_VTUITOOLBARCOMMANDITERATOR_H
+
+#include "mvtuicommanditerator.h"
+
+class CVtUiToolbarBase;
+
+/**
+*  TVtUiToolbarCommandIterator
+*
+*  Toolbar command iterator class definition.
+*
+*  @since S60 v3.2
+*/
+class TVtUiToolbarCommandIterator : public MVtUiCommandIterator
+    {
+
+public: // public methods
+
+    /**
+    * C++ constructor
+    * @param aToolbar Reference to toolbar.
+    */
+    TVtUiToolbarCommandIterator( CVtUiToolbarBase& aToolbar );
+
+public: // from MVtUiCommandIterator
+
+    /**
+     * @see MVtUiCommandIterator::HasNext
+     */
+    TBool HasNext() const;
+
+    /**
+     * @see MVtUiCommandIterator::Next
+     */
+    TInt Next();
+
+private:
+
+    // Pointer to Toolbar
+    CVtUiToolbarBase* iToolbar;
+
+    // Current iteration point
+    TInt iCurrent;
+    
+    };
+
+#endif // T_VTUITOOLBARCOMMANDITERATOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/tvtuifeatureids.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* 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:  Feature ids.
+*
+*/
+
+
+#ifndef T_VTUIFEATUREIDS_H
+#define T_VTUIFEATUREIDS_H
+
+/**
+ *
+ * Feature IDs.
+ *
+ */
+enum TVtUiFeatureId
+    {
+    /** Toolbar feature id */
+    EVtUiFeatureIdToolbar = 1,
+
+    /** Softkey feature id */
+    EVtUiFeatureIdSoftkey,
+
+    /** Menu feature id */
+    EVtUiFeatureIdMenu,
+
+    /** Mini Dialer feature id */
+    EVtUiFeatureIdMiniDialer,
+
+    /** Number entry feature id */
+    EVtUiFeatureIdNumberEntry,
+    
+    /** Video quality feature id */
+    EVtUiFeatureIdVideoQuality,
+    
+    /** White balance feature id */
+    EVtUiFeatureIdWhiteBalance,
+
+    /** Color tone feature id */
+    EVtUiFeatureIdColourTone,
+
+    /** Brightness feature id */
+    EVtUiFeatureIdBrightness,
+
+    /** Contrast feature id */
+    EVtUiFeatureIdContrast,
+
+    /** Dialer feature id */
+    EVtUiFeatureIdDialer,
+
+    /** Volume feature id */
+    EVtUiFeatureIdVolume,
+
+    /** Zoom feature id */
+    EVtUiFeatureIdZoom
+    };
+
+#endif // T_VTUIFEATUREIDS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/volume/cvtuivolume.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* 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:  Volume ui feature
+*
+*/
+
+
+#ifndef C_VTUIVOLUME_H
+#define C_VTUIVOLUME_H
+
+#include "cvtuisliderbase.h"
+
+/**
+*  CVtUiVolume
+*
+*  Volume ui feature
+*
+*  @since S60 v3.2
+*/
+class CVtUiVolume : public CVtUiSliderBase
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiVolume* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * Destructor
+    */
+    ~CVtUiVolume();
+
+    /**
+    * Refresh volume popup status.
+    */
+    void RefreshL();
+
+public: // from CVtUiSliderBase
+
+    /**
+    * @see CVtUiSliderBase::StartL
+    */
+    void StartL();
+    
+    /**
+    * @see CVtUiSliderBase::Stop
+    */
+    void Stop();
+    
+    /*
+    * Return current slider's volume value 
+    */
+    TInt GetVolumeValue();
+
+protected:
+
+    /*
+    * Constructor
+    */
+    CVtUiVolume( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * 2nd constructor
+    */
+    void ConstructL();
+
+    };
+
+#endif // C_VTUIVOLUME_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/volume/cvtuivolumecontrol.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 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:  Volume control adjusts engine side volume values.
+*
+*/
+
+
+
+#ifndef CVTUIVOLUMECONTROL_H
+#define CVTUIVOLUMECONTROL_H
+
+
+#include    <e32base.h>
+#include    <mvtengcommandobserver.h>
+#include    <mvtengaudio.h>
+
+class MVtEngCommandHandler;
+class MVtUiEngineCommandManager;
+class CVtUiFeatureManager;
+
+
+/**
+*  Volume control adjusts engine side volume values.
+*
+*  @since Series 60 v5.0
+*/
+class CVtUiVolumeControl
+    : public CBase,
+      private MVtEngCommandObserver
+    {
+    public: // Constructors and destructor
+
+    // Type for volume settings.
+    typedef MVtEngAudio::TVtEngOutputVolume TVolume;
+
+    /**
+    * Constructor.
+    *
+    * @param aSelfPtr optional pointer to itself.
+    * @param aCommandHandler command handler.
+    * @param aAudio audio interface.
+    * @param aCommandManager command manager.
+    * @param aFeatureManager Reference to feature manager.
+    */
+    CVtUiVolumeControl(
+        MVtEngCommandHandler& aCommandHandler,
+        MVtEngAudio& aAudio,
+        MVtUiEngineCommandManager& aCommandManager,
+        CVtUiFeatureManager& aFeatureManager );
+
+    /*
+    * 2nd phase constructor
+    */
+    void ConstructL();
+
+    /**
+    * Destructor.
+    */
+    ~CVtUiVolumeControl();
+
+public: // New functions
+
+    // Adjust volume to new value
+    void AdjustVolumeL( TVolume aVolume );
+        
+private:
+
+    /**
+    * @see MVtEngCommandObserver::HandleVTCommandPerformedL.
+    */
+    virtual void HandleVTCommandPerformedL(
+        TVtEngCommandId aCommand,
+        const TInt aError );
+    
+    // Checks if volume is changed in slider
+    TBool IsVolumeChangedL();
+
+private:
+
+    // Reference to command handler.
+    MVtEngCommandHandler& iCommandHandler;
+
+    // Reference to audio interface.
+    MVtEngAudio& iAudio;
+
+    // Reference to command manager.
+    MVtUiEngineCommandManager& iCommandManager;
+
+    // ETrue if command is performed.
+    TBool iCommandPerformed;
+
+    // Volume being updated to engine.
+    TVolume iVolume;
+
+    // Volume pointer descriptor.
+    TPtrC8 iVolumePtr;
+    
+    // Reference to featuremanager
+    CVtUiFeatureManager& iFeatureManager;
+    
+    // Is control adjusting volume
+    TBool iIsActive;
+    };
+
+#endif      // CVtUiVolumeControl_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/volume/cvtuivolumepopup.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* 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:  Volume popup definition
+*
+*/
+
+
+#ifndef C_VTUIVOLUMEPOPUP_H
+#define C_VTUIVOLUMEPOPUP_H
+
+#include "tvtuicomponentstate.h"
+#include "cvtuipopupbase.h"
+#include "mvtengaudio.h"
+
+class CVtUiFeatureManager;
+class CVtEngModel;
+
+/**
+*  CVtUiVolumePopup
+*
+*  Volume popup definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiVolumePopup : public CVtUiPopupBase
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiVolumePopup* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * Destructor
+    */
+    ~CVtUiVolumePopup();
+
+    /**
+    * Refresh volume popup status.
+    */
+    void RefreshL();
+
+    /**
+    * Update volume popup and audio routing
+    */
+    void UpdateVolumeAndRoutingL();
+
+private: // from base class
+
+    /**
+    * @see CVtUiPopupBase::DoActivateL
+    */
+    void DoActivateL();
+
+    /**
+    * @see CVtUiPopupBase::OfferKeyEventL
+    */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent,
+        TEventCode aCode );
+
+    /**
+    * @see CVtUiPopupBase::HandleControlEventL
+    */
+    void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiVolumePopup( CVtUiFeatureManager& aFeatureManager );
+
+    /*
+    * 2nd constructor
+    */
+    void ConstructL();
+
+    /**
+    * Returns current output volume for given routing.
+    */
+    TInt OutputVolume( MVtEngAudio::TAudioRoutingState aRouting ) const;
+        
+    /**
+    * Updates volume 
+    */   
+    void UpdateVolumeL();        
+
+private:
+
+    // Engine model
+    CVtEngModel& iModel;
+
+    // Stored audio routing state.
+    MVtEngAudio::TAudioRoutingState iAudioRouting;
+
+    // Stored volume
+    TInt iVolume;
+    
+    // Reference to feature manager
+    CVtUiFeatureManager& iFeatureManager;
+
+    };
+
+#endif // C_VTUIVOLUMEPOPUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/zoom/cvtuizoom.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* 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:  Zoom ui feature
+*
+*/
+
+
+#ifndef C_VTUIZOOM_H
+#define C_VTUIZOOM_H
+
+#include "cvtuisliderbase.h"
+
+/**
+*  CVtUiZoom
+*
+*  Zoom ui feature
+*
+*  @since S60 v3.2
+*/
+class CVtUiZoom : public CVtUiSliderBase
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiZoom* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * Destructor
+    */
+    ~CVtUiZoom();
+
+    /**
+    * Refresh zoom popup status.
+    */
+    void RefreshL();
+
+public: // from CVtUiSliderBase
+
+    /**
+    * @see CVtUiSliderBase::StartL
+    */
+    void StartL();
+
+    /**
+    * @see CVtUiSliderBase::Stop
+    */
+    void Stop();
+    
+    /**
+    * @see CVtUiSliderBase::ComponenStateChangedL
+    */
+    void ComponenStateChangedL();
+    
+protected:
+
+    /*
+    * Constructor
+    */
+    CVtUiZoom( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * 2nd constructor
+    */
+    void ConstructL();
+
+    };
+
+#endif // C_VTUIZOOM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/features/zoom/cvtuizoompopup.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* 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:  Zoom popup definition
+*
+*/
+
+
+#ifndef C_VTUIZOOMPOPUP_H
+#define C_VTUIZOOMPOPUP_H
+
+#include "tvtuicomponentstate.h"
+#include "cvtuipopupbase.h"
+
+class CVtUiFeatureManager;
+class MVtEngMedia;
+
+/**
+*  CVtUiZoomPopup
+*
+*  Zoom popup definition.
+*
+*  @since S60 v3.2
+*/
+class CVtUiZoomPopup : public CVtUiPopupBase
+    {
+
+public:
+
+    /**
+    * Static constructor
+    * @param aFeatureManager Reference to feature manager.
+    */
+    static CVtUiZoomPopup* NewL( CVtUiFeatureManager& aFeatureManager );
+
+    /**
+    * Destructor
+    */
+    ~CVtUiZoomPopup();
+
+    /**
+    * Refresh zoom popup status.
+    */
+    void RefreshL();
+
+private: // from CVtUiPopupBase
+
+    /**
+    * @see CVtUiPopupBase::DoActivateL
+    */
+    void DoActivateL();
+
+private: // from base class
+
+    /**
+    * @see CVtUiPopupBase::OfferKeyEventL
+    */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent,
+        TEventCode aCode );
+
+    /**
+    * @see CVtUiPopupBase::HandleControlEventL
+    */
+    void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
+
+private:
+
+    /**
+     * Constructor
+     */
+    CVtUiZoomPopup( CVtUiFeatureManager& aFeatureManager );
+
+    /*
+    * 2nd constructor
+    */
+    void ConstructL();
+
+    /*
+    * Updates zoom adjust range according to current active provider.
+    */
+    void UpdateAdjustRangeL();
+
+    /**
+    * Returns current zoom step or KErrNotFound if an error happens.
+    */
+    TInt CurrentZoomStep() const;
+
+    /**
+    * Returns maximum zoom step or KErrNotFound if an error happens.
+    */
+    TInt MaxZoomStep() const;
+    
+    void ScaleAndSetZoomFactorL( TInt aValue );
+
+private:
+
+    // Reference to feature manager
+    CVtUiFeatureManager& iFeatureManager;
+
+    // Engine media
+    MVtEngMedia& iMedia;
+
+    // Current zoom
+    TInt iCurrent;
+
+    // Maximum zoom value
+    TInt iMax;
+
+    };
+
+#endif // C_VTUIZOOMPOPUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/mvtuinumbersource.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* 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:  Number Source API
+*
+*/
+
+
+#ifndef M_VTUINUMBERSOURCE_H
+#define M_VTUINUMBERSOURCE_H
+
+#include <e32base.h>
+
+/**
+ *  MVtUiNumberSource
+ *
+ *  @since S60 v3.2
+ */
+class MVtUiNumberSource
+    {
+
+public:
+
+    /**
+     * Gets number typed by the user.
+     *
+     */
+    virtual void GetContents( TDes& aContents ) const = 0;
+
+    };
+
+#endif // M_VTUINUMBERSOURCE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/mvtuishutterobserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* 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:  Interface for reporting application shutdown readiness.
+*
+*/
+
+
+#ifndef M_MVTUISHUTTEROBSERVER_H
+#define M_MVTUISHUTTEROBSERVER_H
+
+
+/**
+* Observer interface for reporting shutdown readiness.
+*
+* @since S60 v3.2
+*/
+class MVtUiShutterObserver
+    {
+public:
+
+    /**
+    * Called when application can exit.
+    */
+    virtual void HandleShutdownReady() = 0;
+    };
+    
+#endif // M_MVTUISHUTTEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/mvtuistatecontext.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* 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:  Interface for state objects to request application services.
+*
+*/
+
+
+#ifndef M_MVTUISTATECONTEXT_H
+#define M_MVTUISTATECONTEXT_H
+
+#include <e32def.h> 
+#include <vtengcommands.h>
+#include "mvtuishutterobserver.h"
+
+class TVtUiAppStateBase;
+class CVtEngModel;
+class MVtUiNumberSource;
+class TVtUiVideoTelephonyVariation;
+
+/**
+* Provides service interface for application state objects.
+*
+* @since S60 v3.2
+*/
+class MVtUiStateContext : public MVtUiShutterObserver
+    {
+    public:
+                
+        /**
+        * Starts first phase of startup when prepare is received.
+        */
+        virtual void StartupPhase1L() = 0;
+        
+        /**
+        * Starts application shutdown.
+        */
+        virtual void ShutdownL() = 0;
+        
+        /**
+        * Starts second phase of startup.
+        */
+        virtual void StartupPhase2L() = 0;
+        
+        /**
+        * Sets application to foreground and background.            
+        * @param aForeground ETrue => foreground, EFalse => background
+        */
+        virtual void ChangeApplicationFocus( const TBool aForeground ) = 0;
+        
+        /**
+        * Changes current application state.
+        * @param aState new state
+        */
+        virtual void ChangeState( TVtUiAppStateBase* aState ) = 0;
+        
+        /**
+        * Starts DTMF tone.
+        * @param aTone DTMF tone.
+        */
+        virtual void StartDtmfTone( const TChar& aTone ) = 0;
+        
+        /**
+        * Stops tarts DTMF tone.
+        */
+        virtual void StopDtmfTone() = 0;
+        
+        /**
+        * Returns model.
+        * @return model
+        */
+        virtual CVtEngModel& Model() = 0;
+                        
+        /**
+        * Returns video telephony variation.
+        * @return variation
+        */
+        virtual const TVtUiVideoTelephonyVariation& 
+            VideoTelephonyVariation() const = 0;
+        /**
+        * Returns source containing numbers typed by the user.
+        * @return number soure
+        */
+        virtual MVtUiNumberSource* NumberSource() const = 0;
+        
+        /**
+        * Executes engine command.
+        * @param aCommand command id
+        * @param aParams command params
+        */
+        virtual void DoExecuteCmdL( const TVtEngCommandId aCommand,
+                TDesC8* aParams ) = 0;
+        
+        /**
+        * Refreshes application UI.
+        * @param aRefreshFlags identifies what to refresh
+        */
+        virtual void RefreshL( const TInt aRefreshFlags ) = 0;          
+        
+        /**
+        * Updates engine states.
+        */
+        virtual void  RefreshStatesL() = 0;
+
+        /**
+        * Handles layout change.
+        */
+        virtual void DoHandleLayoutChangedL() = 0;
+
+        /**
+        * Sets call id.
+        */
+        virtual void SetCallIdL( const TInt aCallId ) = 0;
+        
+        /**
+        * Sets display text of remote end.
+        */
+        virtual TBool SetCallNameL( const TDesC& aName ) = 0;
+        
+        /**
+
+        
+        /**
+        * Refresh flags
+        */        
+        enum TRefreshFlags
+            {
+            /** Navipane is refreshed */
+            ENaviPane       = 0x01,
+            /** Softkeys are refreshed */
+            ESoftkeys       = 0x02,
+            /** Refreshes blind (video availability) status */
+            EBlind          = 0x04,
+            /** Refreshes state sync with call handling */
+            ESynchronise    = 0x08,
+            /** Refreshes internal states (media etc) */
+            EUiStates       = 0x10,
+            /** Refreshes everything */
+            EAll            = ENaviPane | 
+                              ESoftkeys | 
+                              EBlind | 
+                              ESynchronise | 
+                              EUiStates
+            };
+    };
+
+    
+#endif // M_MVTUISTATECONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/sliders/cvtuipopupbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,275 @@
+/*
+* 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:  Base class for video telephone popups
+*
+*/
+
+
+#ifndef     C_VTUIPOPUPBASE_H
+#define     C_VTUIPOPUPBASE_H
+
+#include    <coecobs.h>
+
+#include    "mvtuicomponent.h"
+#include    "tvtuicomponentstate.h"
+#include    "tvtuifeatureids.h"
+#include    "mvtuiresourcechangeobserver.h"
+#include    "mvtuikeyeventobserver.h"
+
+class CAknVolumePopup;
+class MVtUiComponentManager;
+class MVtUiComponentStateObserver;
+class CFbsBitmap;
+
+/**
+*  TVtUiBaseComponentState
+*
+*  Base componentstate definition.
+*
+*  @since S60 v3.2
+*/
+class TVtUiBaseComponentState : public TVtUiComponentState
+    {
+
+public:
+    /**
+    * Constructor
+    * @param aComponent Reference to component.
+    */
+    TVtUiBaseComponentState( MVtUiComponent& aComponent,
+        TVtUiBlockListBitField aBitField  );
+    };
+
+/**
+*  CVtUiPopupBase
+*
+*  Base class for vide telephone  popups
+*
+*  @since S60 v3.2
+*/
+class CVtUiPopupBase : public CBase, public MVtUiComponent,
+    public MVtUiResourceChangeObserver, public MCoeControlObserver,
+    public MVtUiKeyEventObserver
+    {
+
+public:
+
+    /**
+    * Destructor
+    */
+    ~CVtUiPopupBase();
+
+public: // from MVtUiComponent
+
+    /**
+    * @see MVtUiComponent::ComponentId
+    */
+    TComponentId ComponentId() const;
+
+    /**
+    * @see MVtUiComponent::ComponentAsControl
+    */
+    CCoeControl* ComponentAsControl();
+
+    /**
+    * @see MVtUiComponent::DoActivateL
+    */
+    virtual void DoActivateL();
+
+    /**
+    * @see MVtUiComponent::DoDeactivateL
+    */
+    virtual void DoDeactivateL();
+
+public: // from MVtUiComponentManager
+
+    /**
+    * @see MVtUiComponentManager::HandleResourceChangeL
+    */
+    void HandleResourceChangeL( TInt aType );
+
+public: // from MCoeControlObserver
+
+   /**
+   * @see MCoeControlObserver::HandleControlEventL
+   */
+   virtual void HandleControlEventL(
+        CCoeControl* aControl,TCoeEvent aEventType ) = 0;
+
+public: // from MVtUiKeyEventObserver
+
+    /**
+    * @see CCoeControl::MVtUiKeyEventObserver
+    */
+   TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent, TEventCode aCode );
+
+public: // new functions
+   
+    /**
+    * Set popup to be pemanently visible i.e. tapping outside
+    * the control doesn't close the control.
+    * @param aPermanent If Etrue popup will be visible all the time,
+    * otherwise popup is closed and next time will obey timeout.
+    */
+    void SetPermanenVisibility( TBool aPermanent );
+    
+    /**
+    * Set new component observer
+    * @param iCompStateObserver New observer
+    */
+    void SetObserver( MVtUiComponentStateObserver& aCompStateObserver );
+    
+    /**
+    * Gets slider control value.
+    * @return value within slider control's value range
+    */
+    TInt Value() const;
+
+    /**
+    * update popup itself
+    */
+    virtual void UpdatePopupL();
+    
+protected: // new functions
+   
+    /**
+    * Set new value to slider control.
+    * @param aValue value within slider control's value range.
+    */
+    void SetValue( TInt aValue );
+    
+    /**
+    * Scales the given value to slider control's value range
+    * and sets it to the slider control
+    * @param aValue value within popup control's value range.
+    */
+    void ScaleAndSetValue( TInt aValue );
+    
+    /**
+    * Gets value from the slider control and scales it
+    * @return value within popup control's value range
+    */ 
+    TInt ScaledValue() const;
+    
+    /**
+    * Gets value from the slider control and scales it
+    * @param aValue value in popup control's value range.
+    * @return value within slider control's value range
+    */ 
+    TInt SliderValueWithScaling( TInt aValue ) const;
+    
+    /**
+    * Set new end point values popup control
+    * These values are not same as slider's range
+    */
+    void SetMinAndMaxValues( TInt aMax, TInt aMin );
+   
+    /*
+    * Set adjust range of the slider
+    */
+    void SetAdjustRange( TInt aMinimumValue, TInt aMaximumValue,
+        TInt aStepCount );
+
+    /**
+    * Set value type for vertical slider control
+    */
+    void SetValueType( TInt aValueType );
+    
+    /**
+    * Shows popup.
+    */
+    void ShowPopupL();
+
+    /**
+    * Opens popup.
+    */
+    void OpenPopupL();
+
+    /**
+    * Closes popup
+    */
+    void ClosePopup();
+    
+    /**
+    * Set time out time in seconds
+    */
+    void SetTimeOut( TInt aTime );
+    
+    /**
+    * Checks whether popup is visible
+    */
+    TBool IsPopUpVisible();
+    
+protected:    
+    
+    /**
+    * Constructor
+    */
+    CVtUiPopupBase( MVtUiComponentManager& aComponentManager,
+        TVtUiBlockListBitField aBitField, TComponentId aComponentId );
+
+     /**
+     * 2nd constructor
+     */
+    void BaseConstructL();
+
+private:
+
+    /**
+    * Position of the popup
+    */
+    TPoint PopupPosition() const;
+    
+    /**
+    * Sets popup controls's value
+    */
+    void SetPopupValue( TInt aValue );
+
+protected: // Set in child constructor
+
+    // Reference to component manager
+    MVtUiComponentManager& iComponentManager;
+
+    // Component state
+    TVtUiBaseComponentState iComponentState;
+
+    // Component id
+    TComponentId iComponentId;
+
+private:
+
+    // class for slider handling
+    CAknVolumePopup* iPopup;
+
+    // Interface for component state observing
+    MVtUiComponentStateObserver* iCompStateObserver;
+
+    // Maximum value
+    TInt iMax;
+
+    // Minimum value
+    TInt iMin;
+
+    // Number of steps
+    TInt iStepCount;
+    
+    // Time out for showing popup
+    TInt iTimeOutTime;
+    
+    // Scaling constant
+    TInt iScalingConstant;
+    
+    };
+
+#endif // CVTUIPEFSLIDERBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/sliders/cvtuisliderbase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* 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:  Base class for video telephone sliders
+*
+*/
+
+
+#ifndef     C_VTUISLIDERBASE_H
+#define     C_VTUISLIDERBASE_H
+
+#include    "cvtuifeaturebase.h"
+#include    "mvtuicomponent.h"
+#include    "mvtuicomponentstateobserver.h"
+
+class CVtUiPopupBase;
+
+/**
+*  CVtUiSliderBase
+*
+*  Base class for vide telephone sliders
+*
+*  @since S60 v3.2
+*/
+class CVtUiSliderBase : public CVtUiFeatureBase, public MVtUiComponentStateObserver
+    {
+
+public:
+
+    /**
+    * Destructor
+    */
+    ~CVtUiSliderBase();
+    
+    /**
+    * update slider itself
+    */
+    void UpdateSlider();
+    
+public: // from MVtUiFeature
+
+    /**
+    * @see MVtUiFeature::StartL
+    */
+    void StartL();
+
+     /**
+    * @see MVtUiFeature::Stop
+    */
+    void Stop();
+
+     /**
+    * @see MVtUiFeature::InitFeatureL
+    */
+    void InitFeatureL();
+
+public: // from MVtUiComponentStateObserver
+
+    /**
+    * @see MVtUiComponentStateObserver::ComponenStateChangedL
+    */
+    virtual void ComponenStateChangedL();
+    
+    /**
+    * @see CVtUiPopupBase::SetPermanenVisibility
+    */
+    void SetPermanenVisibility( TBool aPermanent );
+
+protected:
+
+    /*
+    * Constructor
+    */
+    CVtUiSliderBase( CVtUiFeatureManager& aFeatureManager,
+        TVtUiFeatureId aFeatureId );
+
+    /**
+    * 2nd constructor
+    */
+    void ConstructL();
+
+    /**
+    * Sets popup pointer.
+    */
+    void SetPopup( CVtUiPopupBase* aPopup );
+
+    /**
+    * Gets popup reference.
+    */
+    CVtUiPopupBase& Popup();
+
+    /**
+    * Gets popup const reference.
+    */
+    const CVtUiPopupBase& Popup() const;
+
+private:
+
+    // pop up base
+    CVtUiPopupBase* iPopup;
+
+    };
+
+#endif // CVTUIPEFSLIDERBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/sliders/mvtuicomponentstateobserver.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* 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:  Observer API for popup based controls
+*
+*/
+
+
+#ifndef M_VTUICOMPONENTSTATEOBSERVER_H
+#define M_VTUICOMPONENTSTATEOBSERVER_H
+
+/**
+* MVtUiComponentStateObserver
+*
+* Observer API for popup based controls
+*
+* @since S60 v3.2
+*/
+class MVtUiComponentStateObserver
+    {
+
+public:
+
+    /**
+    * Called when component state changes
+    */
+    virtual void ComponenStateChangedL() = 0;
+
+    };
+
+#endif // M_VTUICOMPONENTSTATEOBSERVER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/tvtuiappstatebase.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,250 @@
+/*
+* Copyright (c) 2007 - 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:  Base class for application states.
+*
+*/
+
+
+#ifndef T_VTUIAPPSTATEBASE_H
+#define T_VTUIAPPSTATEBASE_H
+
+#include <e32base.h>
+#include <mvtengsessioninfo.h>
+#include "mvtuistatecontext.h"
+#include "mvtuishutterobserver.h"
+#include "tvtuistates.h"
+
+/**
+* Base class for application states related to application startup, normal
+* operation and shutdown. AppUi delegates decision making by forwarding
+* events/commands it receives to current state.
+* Not all event handlers declared by the base class are applicable in
+* all concrete states. All methods returning TEventResponse imply that it may
+* consume the event completely and caller should not process it further.
+*
+* It should be kept in mind that as new functionality is added to application,
+* state classes may need changes if e.g. handling of specific event should be
+* allowed in appUi. By default event handler in specific state may consume all
+* events. Note that in this context e.g. HandleCommandL is considered as an
+* event handler.
+*
+* @since S60 v3.2
+*/
+class TVtUiAppStateBase : public MVtUiShutterObserver
+    {
+public: // new functions
+
+    /**
+    * Return value from state's event handlers.
+    */
+    enum TEventResponse
+        {
+        /** Event was handled by a state and should
+         *  not be further processed by caller.
+         */
+        EEventHandled,
+        /** Event can be handled by caller. */
+        EEventNotHandled
+    };
+
+    /**
+    * Performs state dependent actions when phase 1 of
+    * startup is completed.
+    */
+    virtual void AppUiStartupPhase1DoneL();
+
+    /**
+    * Performs state dependent actions when startup fails.
+    */
+    virtual void AppUiStartupFailedL();
+
+    /**
+    * Performs state dependent actions when phase 2 of
+    * startup is completed.
+    */
+    virtual void AppUiStartupPhase2DoneL();
+
+    /**
+    * Handles completion of shutdown.
+    */
+    virtual void ShutdownDoneL();
+
+    /**
+    * Handles completion of an VT engine command.
+    * @param aCommand completed command
+    * @param aError error
+    * @return event response, is caller allowed to handle event
+    */
+    virtual TEventResponse HandleVTCommandPerformedL(
+        const TVtEngCommandId aCommand,
+        const TInt aError );
+
+    /**
+    * Handles event from the engine.
+    * @param aEvent
+    * @return event response, is caller allowed to handle event
+    */
+    virtual TEventResponse HandleVtEventL( const TInt aEvent );
+
+    /**
+    * Handles command from the user (or application framework).
+    * @param aCommand
+    * @return event response, is caller allowed to handle event
+    */
+    virtual TEventResponse HandleCommandL( const TInt aCommand );
+
+    /**
+    * Performs state dependent actions for foreground change event.
+    * @param aIsForeground foreground status passed from UI framework
+    * @return ETrue if application should behave as in foreground
+    */
+    virtual TBool HandleForegroundChangedL( const TBool aIsForeground );
+
+    /**
+    * Performs state dependent previous actions for foreground change event.
+    * @param aIsForeground foreground status passed from UI framework
+    * @return ETrue if application should behave as in foreground
+    */
+    virtual TBool PreHandleForegroundChangedL( const TBool aIsForeground );
+    /**
+    * Performs state dependent actions for layout change.
+    */
+    virtual void HandleLayoutChangedL();
+    
+    /**
+    * Sends DTMF tone if allowed by current state.
+    * @param aTone DTMF tone to send
+    */
+    virtual void StartDtmfTone( const TChar& aTone );
+
+    /**
+    * Stops DTMF tone if allowed by current state.
+    */
+    virtual void StopDtmfTone();
+
+    /**
+    * Sets initial application state.
+    * @param aCtx state context providing services to states
+    * @param aUiStates ui states
+    */
+    static void SetInitialStateL(
+        MVtUiStateContext& aCtx,
+        TVtUiStates& aUiStates);
+
+protected: // for concrete state classes
+
+    /**
+    * Destructor, for cleanup.
+    */
+    virtual ~TVtUiAppStateBase();
+
+    /**
+    * Performs entry action for a state.
+    */
+    virtual void OpenL();
+
+    /**
+    * Performs exit action for a state and deletes that state.
+    */
+    virtual void Close();
+
+    /**
+    * Sets current state.
+    */
+    void ChangeStateL( TVtUiAppStateBase& aNewState );
+
+    /**
+    * Sets transition to resetting state as cleanup item.
+    */
+    void CleanupResetPushL();
+
+    /**
+    * Starts shutdown when leave occurred.
+    */
+    static void TransitionToReset( TAny* aAny );
+
+
+    /**
+    * Ends the call if necessary and starts shutdown.
+    * @return ETrue if shutdown started.
+    */
+    TBool CheckEndActiveCallL();
+
+    /**
+    * Returns engine session state.
+    * @param aUpdate is state forced to update
+    * @return session state
+    */
+    MVtEngSessionInfo::TSessionState SessionState(
+        const TBool aUpdate ) const;
+
+    /**
+    * Sets forced lights state in the system.
+    */
+    void SetLightsState( const TBool aOn );
+
+    /**
+    * Delegates engine command execution to the state context.
+    */
+    template < typename T >
+    inline void ExecuteEngineCommand(
+        TInt aCommand, T& aParam );
+
+    /**
+    * Sets execution state.
+    */
+    void SetExecState( const TVtUiStates::TVtUiExecState aState );
+
+protected: // constructor
+
+    // c++ constructor
+    TVtUiAppStateBase( MVtUiStateContext& aCtx, TVtUiStates& aUiStates );
+
+private: // from MVtUiShutterObserver
+
+    /**
+    * Handles 'shutdown ready' event.
+    */
+    virtual void HandleShutdownReady();
+
+private: // new functions
+
+    /**
+    * Updates applications lock state and sends to background if
+    * the device is locked.
+    */
+    void HandleDeviceLockEventL( const TBool aDeviceIsLocked );
+
+protected: // data members
+
+    // Context providing services to states
+    MVtUiStateContext&  iCtx;
+
+    // Various application specific state information
+    TVtUiStates&        iUiStates;
+
+    /** Prevents sending end call command to call handling if ETrue.
+     *  It is not allowed when call clearing is network originated.
+     */
+    
+    /**
+     * shutdown request received
+     */
+    static TBool iShutdownRequested;
+    
+    };
+
+#include "tvtuiappstatebase.inl"
+
+#endif // T_VTUIAPPSTATEBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/tvtuiappstatebase.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  Base class for application states.
+*
+*/
+
+
+template < typename T >
+inline void TVtUiAppStateBase::ExecuteEngineCommand( 
+    TInt aCommand, T& aParam )
+    {
+    TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ), 
+        sizeof( T ) );    
+    TRAP_IGNORE( iCtx.DoExecuteCmdL( aCommand, &params ) );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/tvtuiappstates.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,274 @@
+/*
+* 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:  Concrete application state classes
+*
+*/
+
+
+#ifndef T_VTUIAPPSTATES_H
+#define T_VTUIAPPSTATES_H
+
+#include "tvtuiappstatebase.h"
+#include <babitflags.h>
+#include <vtengcommands.h>
+
+class CAknQueryDialog;
+
+/**
+*  Initial application state. Responsible for startup phase 1 and
+*  startup phase 2 (see EVtUiAppUiStartup in CVtUiAppUi.cpp).
+*  Certain other state changes are required for phase 2 and history
+*  of their reception is handled with precondition flags.
+*
+*  @since S60 v3.2
+*/
+class TVtUiStateStarting : public TVtUiAppStateBase
+    {
+public:
+    /**
+    * returns singleton instance of TVtUiStateStarting
+    * @param aCtx state context
+    * @param aUiStates UI states
+    * @return singleton
+    */
+    static TVtUiStateStarting* InstanceL(
+        MVtUiStateContext& aCtx,
+        TVtUiStates& aUiStates );
+
+public: // from TVtUiAppStateBase
+
+    /** @see TVtUiAppStateBase */
+    virtual void AppUiStartupPhase1DoneL();
+
+    /** @see TVtUiAppStateBase */
+    virtual void AppUiStartupPhase2DoneL();
+
+    /** @see TVtUiAppStateBase */
+    virtual TEventResponse HandleVtEventL( TInt aEvent );
+
+    /** @see TVtUiAppStateBase */
+    virtual TEventResponse HandleCommandL( const TInt aCommand );
+
+    /** @see TVtUiAppStateBase */
+    virtual TBool HandleForegroundChangedL( TBool aIsForeground );
+
+private: // from TVtUiAppStateBase
+
+    /** @see TVtUiAppStateBase */
+    virtual void OpenL();
+
+    /** @see TVtUiAppStateBase */
+    virtual void Close();
+
+private: // new methods
+
+    void CheckSessionStateL();
+    static TInt AsynchOpen( TAny* aAny );
+    
+    void DoOpenL();
+    
+    /** Preconditions that must be passed in order to proceed
+     * to Phase 2 in startup.
+     */
+    enum TPreconditions
+        {
+        /** waiting for CLI from engine*/
+        EWaitingCLI,
+        /** waiting for phase1 to complete */
+        EWaitingPhase1ToComplete,
+        /** waiting for engine to get proper state */
+        EWaitingSessionState
+    };
+
+    /**
+    * Clears precondition passed as argument and checks if any
+    * preconditions hold and if not proceeds to phase 2 of startup.
+    */
+    void CheckPhase2StartupL( const TPreconditions aClearCondition );
+    
+    void HandleCLIReceivedL();
+
+private: // constructors and destructors
+
+    // c++ constructor
+    TVtUiStateStarting(
+        MVtUiStateContext& aCtx,
+        TVtUiStates& aUiStates );
+
+    // Destructor
+    virtual ~TVtUiStateStarting();
+
+private: // data members
+
+    // Precondition for state change to running
+    TBitFlags8 iPreconditions;
+
+    // Singleton
+    static TVtUiStateStarting* iInstance;
+    
+    // Starts phase1 startup in state state context. Needed because
+    // initial state is opened from within state context construction.
+    CAsyncCallBack*     iStartCallback;
+    };
+
+/**
+*  Application state that is active in normal operation.
+*
+*  @since S60 v3.2
+*/
+class TVtUiStateRunning : public TVtUiAppStateBase
+    {
+public:
+    /**
+    * returns singleton instance of TVtUiStateRunning
+    * @param aCtx state context
+    * @param aUiStates UI states
+    * @return singleton
+    */
+    static TVtUiStateRunning* InstanceL(
+        MVtUiStateContext& aCtx,
+        TVtUiStates& aUiStates );
+
+public: // from TVtUiAppStateBase
+
+    /** @see TVtUiAppStateBase */
+    virtual TEventResponse HandleVtEventL( TInt aEvent );
+
+    /** @see TVtUiAppStateBase */
+    virtual TEventResponse HandleCommandL( const TInt aCommand );
+
+    /** @see TVtUiAppStateBase */
+    virtual TBool HandleForegroundChangedL( TBool aIsForeground );
+
+    /** @see TVtUiAppStateBase */
+    virtual TBool PreHandleForegroundChangedL( TBool aIsForeground );
+    /** @see TVtUiAppStateBase */
+    virtual void HandleLayoutChangedL();
+
+    /** @see TVtUiAppStateBase */
+    virtual void StartDtmfTone( const TChar& aTone );
+
+    /** @see TVtUiAppStateBase */
+    virtual void StopDtmfTone();
+
+    /** @see TVtUiAppStateBase */
+    virtual void OpenL();
+
+private: // from TVtUiAppStateBase
+    /** @see TVtUiAppStateBase */
+    virtual void Close();
+
+private: // constructors and destructors
+
+    // c++ constructor
+    TVtUiStateRunning(
+        MVtUiStateContext& aCtx,
+        TVtUiStates& aUiStates );
+
+    // Destructor
+    virtual ~TVtUiStateRunning();
+
+private: // new functions
+
+    /** Requests call handling subsystem to initiate a voice call.
+     * Starts shutdown of the application.
+     */
+    void CreateVoiceCallL();
+
+    /** Dials emergency call and starts shutdown */
+    void DialEmergencyCallL();
+    
+    void ShutdownWithEngineCommandL( const TInt aCommand );
+
+private: // data members
+    // singleton
+    static TVtUiStateRunning* iInstance;
+    // Create voice call query instance
+    CAknQueryDialog* iCreateVoiceCallDlg;
+    };
+
+/**
+*  Application state that is active during shutdown.
+*
+*  @since S60 v3.2
+*/
+class TVtUiStateResetting : public TVtUiAppStateBase
+    {
+public:
+    /**
+    * returns singleton instance of TVtUiStateResetting
+    * @param aCtx state context
+    * @param aUiStates UI states
+    * @param aCommand engine command to send when resetting state activates
+    * @return singleton
+    */
+    static TVtUiStateResetting* InstanceL(
+        MVtUiStateContext& aCtx,
+        TVtUiStates& aUiStates,
+        const TVtEngCommandId aCommand = KVtEngCommandNone );
+
+public: // from TVtUiAppStateBase
+
+    /** @see TVtUiAppStateBase */
+    virtual void AppUiStartupFailedL();
+
+    /** @see TVtUiAppStateBase */
+    virtual void ShutdownDoneL();
+
+    /** @see TVtUiAppStateBase */
+    virtual TEventResponse HandleVTCommandPerformedL(
+        TVtEngCommandId aCommand,
+        const TInt aError );
+
+    /** @see TVtUiAppStateBase */
+    virtual TEventResponse HandleVtEventL( TInt aEvent );
+
+    /** @see TVtUiAppStateBase */
+    virtual TEventResponse HandleCommandL( const TInt aCommand );
+
+    /** @see TVtUiAppStateBase */
+    virtual TBool HandleForegroundChangedL( TBool aIsForeground );
+
+    /** @see TVtUiAppStateBase */
+    virtual void HandleLayoutChangedL();
+
+private: // from TVtUiAppStateBase
+
+    /** @see TVtUiAppStateBase */
+    virtual void OpenL();
+
+    /** @see TVtUiAppStateBase */
+    virtual void Close();
+
+private: // constructors and destructors
+
+    // c++ constructor
+    TVtUiStateResetting(
+        MVtUiStateContext& aCtx,
+        TVtUiStates& aUiStates,
+        const TVtEngCommandId aCommand = KVtEngCommandNone );
+
+    // Destructor
+    virtual ~TVtUiStateResetting();
+
+private: // data members
+
+    // Singleton
+    static TVtUiStateResetting* iInstance;
+    
+    // Used in user originated shutdown (end active call/switch to voice)
+    TVtEngCommandId iCommand;
+    };
+
+#endif // T_VTUIAPPSTATES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/tvtuiwsevent.h	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* 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:  VT UI window server event definition.
+*
+*/
+
+
+#ifndef T_VTUIWSEVENT_H
+#define T_VTUIWSEVENT_H
+
+#include <w32std.h>
+
+/**
+ * TVtUiWsEvent
+ *
+ * VT UI WS event code enumerations. Name 'code' used instead of 'type' to keep
+ * naming consistent with with window server.
+ */
+enum TVtUiWsEventCodes
+    {
+    // New number source activated
+    EVtUiWsEventNumberSourceActivate = EEventUser + 6000,
+    // Number source deactivated
+    EVtUiWsEventNumberSourceDeactivate,
+    // Enter rendering mode
+    EVtUiWsEventBeginRenderingMode,
+    // Leave rendering mode
+    EVtUiWsEventEndRenderingMode
+    };
+
+/**
+ *  TVtUiWsEvent
+ *
+ *  Base class for VT UI ws events
+ *
+ *  @since S60 v3.2
+ */
+template < class T >
+class TVtUiWsEvent : public TWsEvent
+    {
+
+public:
+
+    /**
+     * Constructor
+     *
+     * @param aType Event type @see TVtUiWsEventCodes.
+     */
+    inline TVtUiWsEvent( TInt aType, T* aData );
+
+    /**
+     * Return data contained in this event.
+     */
+    inline T* Data() const;
+
+    };
+
+#include "tvtuiwsevent.inl"
+
+#endif // T_VTUIWSEVENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/tvtuiwsevent.inl	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* 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:  VT UI window server event inline methods.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TVtUiWsEvent::TVtUiWsEvent
+// -----------------------------------------------------------------------------
+//
+template < class T >
+TVtUiWsEvent< T >::TVtUiWsEvent( TInt aType, T* aData )
+    {
+    SetType( aType );
+    Int()[ 0 ] = ( TInt ) aData;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiWsEvent::Data
+// -----------------------------------------------------------------------------
+//
+template < class T >
+T* TVtUiWsEvent< T >::Data() const
+    {
+    return ( T* )Int()[ 0 ];
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/inc/videotelui.hrh	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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:  Header for constants.
+*
+*/
+
+
+#ifndef VIDEOTELUI_HRH
+#define VIDEOTELUI_HRH
+
+// CONSTANTS
+
+// Video Telephone application UID.
+#define KVtUiAppUidValue 0x101F8681
+
+// Enumerates commands
+enum
+    {
+    // Enable submenu
+    EVtUiCmdEnableMain = 5000,
+    // Enable video
+    EVtUiCmdEnableVideo, //5001
+    // Enable audio
+    EVtUiCmdEnableAudio, //5002
+    // Enable both video and audio
+    EVtUiCmdEnableBoth, //5003
+    // Disable submenu
+    EVtUiCmdDisableMain, //5004
+    // Disable video
+    EVtUiCmdDisableVideo, //5005
+    // Disable audio
+    EVtUiCmdDisableAudio, //5006
+    // Disable both video and audio
+    EVtUiCmdDisableBoth, //5007
+    // Deactivate BT handsfree
+    EVtUiCmdDeactivateBT, //5008
+    // Deactivet BT and activate HF (used in toolbar)
+    EVtUiCmdSwitchFromBTToIHF, //5009
+    // Activate BT handsfree
+    EVtUiCmdActivateBT, //5010
+    // Activate loudspeaker
+    EVtUiCmdActivateLoudspeaker, //5011
+    // Deactivate loudspeaker
+    EVtUiCmdDeactivateLoudspeaker, //5012
+    // End active call
+    EVtUiCmdEndActiveCall, //5013
+    // Use primary camera
+    EVtUiCmdUsePrimaryCamera, //5014
+    // Use secondary camera
+    EVtUiCmdUseSecondaryCamera, //5015
+    // Swap images' places
+    EVtUiCmdSwapImagesPlaces, //5016
+    // Zoom
+    EVtUiCmdZoom, //5017
+    // Send DTMF
+    EVtUiCmdSendDTMF, //5018
+    // Switch to voice call
+    EVtUiCmdCreateVoice, //5019
+    // Enable capture mode
+    EVtUiCmdSnapshot, //5020
+    // Freeze outgoing video
+    EVtUiCmdCapture, //5021
+    // Disable capture mode
+    EVtUiCmdCancelCapture, //5022
+    // Go to Idle.
+    EVtUiCmdGoToIdle, //5023
+    // Other items
+    EVtUiCmdOkOptions = 6000,
+    // Dial emergency
+    EVtUiCmdDialEmergency,
+    // Share object image
+    EVtUiCmdShareObjectImage = 6100,
+    // Share object video clip
+    EVtUiCmdShareObjectVideoClip, //6101
+    // Stop sharing image object
+    EVtUiCmdStopSharingObjectImage, //6102
+    // Stop sharing video clip object
+    EVtUiCmdStopSharingObjectVideoClip, //6103
+    // Activates zoom mode
+    EVtUiCmdToolbarActivateZoomMode, //6104
+    // Toggles disable video/ enable video
+    EVtUiCmdToolbarToggleVideo,             //6105
+    // Toggles mute audio/ unmute audi
+    EVtUiCmdToolbarToggleMicrophone,  //6106
+    // Changes audio routing
+    EVtUiCmdToolbarAudioRouting,  //6107
+    // Toggles primary/secondary camera
+    EVtUiCmdToolbarToggleCamera, //6108
+    // Adjust video submenu
+    EVtUiCmdAdjustVideo, //6109
+    // Adjust video preferences
+    EVtUiCmdAdjustVideoVideoQuality, //6110
+    // Adjust video white balance
+    EVtUiCmdAdjustVideoWhiteBalance, //6111
+    // Adjust video brightness
+    EVtUiCmdAdjustVideoBrightness, //6112
+    // Adjust video contrast
+    EVtUiCmdAdjustVideoContrast, //6113
+    // Adjust video colour tone
+    EVtUiCmdAdjustVideoColourTone, //6114
+    // Dialer close
+    EVtUiDialerExit //6115
+    };
+
+// Enumerates bitmap identifiers
+enum TVtUiBitmapId
+    {
+    // Reserved to indicate no bitmap.
+    EVtUiBitmapNone,
+    // Viewfinder background.
+    EVtUiBitmap_qgn_graf_call_video_out_bg,
+    // Viewfinder background mask.
+    EVtUiBitmap_qgn_graf_call_video_out_bg_mask,
+    // Blind in icon.
+    EVtUiBitmap_qgn_indi_call_video_blind_in,
+    // Blind out icon.
+    EVtUiBitmap_qgn_indi_call_video_blind_out,
+    // Earpiece icon.
+    EVtUiBitmap_qgn_indi_earpiece,
+    // Earpiece icon mask.
+    EVtUiBitmap_qgn_indi_earpiece_mask,
+    // Loudspeaker icon.
+    EVtUiBitmap_qgn_indi_speaker,
+    // Loudspeaker icon mask.
+    EVtUiBitmap_qgn_indi_speaker_mask,
+    // Zoom area mask.
+    EVtUiBitmap_qgn_graf_zoom_area,
+    // Zoom direction bitmap.
+    EVtUiBitmap_qgn_indi_zoom_dir,
+    // Zoom direction bitmap mask.
+    EVtUiBitmap_qgn_indi_zoom_dir_mask,
+    // Zoom area minimum icon.
+    EVtUiBitmap_qgn_indi_zoom_min,
+    // Zoom area maximum icon.
+    EVtUiBitmap_qgn_indi_zoom_max,
+    // Scalable blind in icon soft mask,
+    EVtUiBitmap_qgn_indi_call_video_blind_in_mask_icon,
+    // Scalable blind out icon soft mask,
+    EVtUiBitmap_qgn_indi_call_video_blind_out_mask_icon,
+    // Current active list item indicator
+    EVtUiBitmap_qgn_prop_sub_current,
+    // Current active list item indicator mask
+    EVtUiBitmap_qgn_prop_sub_current_mask
+    };
+
+#endif    // VIDEOTELUI_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/loc/videotelui.loc	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,396 @@
+/*
+* 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:  Localisation texts for Video Telephone application.
+*
+*/
+
+
+// LOCALISATION STRINGS
+
+// d: Text shown in fast swap window while there is active video call.
+// l: cell_app_pane_t1
+// r: 2.6
+//
+#define qtn_apps_videophone_grid "Video tel"
+
+// d: It is text for menu option. If it is selected,
+// d: then submenu is opened containing Video / Audio / Both
+// d: items.
+// l: list_single_pane_t1_cp2/opt3
+// r: 2.6
+//
+#define qtn_incal_enable_main_option "Enable"
+
+// d: It is text for submenu option. It enables / disables
+// d: video.
+// l: list_single_popup_submenu_pane_t1
+// r: 2.6
+//
+#define qtn_incal_change_video_option "Video"
+
+// d: It is text for submenu option. It enables / disables
+// d: audio.
+// l: list_single_popup_submenu_pane_t1
+// r: 2.6
+//
+#define qtn_incal_change_audio_option "Audio"
+
+// d: It is text for submenu option. It enables / disables
+// d: both audio and video.
+// l: list_single_popup_submenu_pane_t1
+// r: 2.6
+//
+#define qtn_incal_change_both_option "Both"
+
+// d: It is text for menu option. If it is selected,
+// d: then submenu is opened containing Video / Audio / Both
+// d: items.
+// l: list_single_pane_t1_cp2/opt3
+// r: 2.6
+//
+#define qtn_incal_disable_main_option "Disable"
+
+// d: It is text for menu option. If it is selected,
+// d: then zoom mode is activated.
+// l: list_single_pane_t1_cp2
+// r: 2.6
+//
+#define qtn_incal_zoom_own_video "Zoom"
+
+// d: It is the prompt in confirmation query shown when
+// d: incoming video call is answered.
+// l: popup_note_window
+// r: 3.2
+//
+#define qtn_incal_send_video_image "Allow video image?"
+
+// d: It is text for options menu list item.
+// d: It opens touch input window for sending DTMF tones
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_send_dtmf_tone_option "Activate keypad"
+
+// d: It it text shown in title pane during active
+// d: video call. %N is replaced with call index.
+// l: title_pane_t2/opt9
+// r: 2.6
+//
+#define qtn_call_number_video "Call %N"
+
+// d: It is text shown in main pane until the first image
+// d: is received.
+// l: main_list_empty_pane
+// r: 2.6
+//
+#define qtn_incal_waiting_image "Waiting image..."
+
+// d: It is text shown in a note when video call is
+// d: answered and camera activation fails, because
+// d: camera is in use in other application.
+// l: popup_note_window
+// r: 2.6
+//
+#define qtn_incal_close_camcorder "Camera already in use an other application."
+
+// d: It is text in softkey to enable audio (unmute microphone).
+// l: control_pane_t1/opt7
+// r: 2.6
+//
+#define qtn_incal_softk_enable_audio "Enable audio"
+
+// d: It is text for menu option. If it is selected,
+// d: then swaps locations of uplink and downlink
+// d: video streams.
+// l: list_single_pane_t1_cp2
+// r: 2.8
+//
+#define qtn_incal_swap_vt_images "Swap images' places"
+
+// d: It is text shown in a note when "use primary
+// d: camera" or "use secondary camera" operations fails.
+// l: popup_note_window
+// r: 2.6
+//
+#define qtn_err_cam_swap "Other camera wasn't usable"
+
+// d: It is text for menu option. If it is selected,
+// d: then new softkeys are now Capture and Cancel.
+// l: list_single_pane_t1_cp2
+// r: 3.1
+//
+#define qtn_incal_snapshot_option "Snapshot"
+
+// d: It is text for right softkey in freeze mode.
+// l: control_pane_t1/opt7
+// r: 3.1
+//
+#define qtn_softk_capture "Capture"
+
+// d: It is text for switch
+// d: to voice query dialog.
+// l: popup_note_window
+// r: 3.1
+#define qtn_query_create_voice_call "End active call and create voice call to the same contact?"
+
+// d: It is text for menu option.
+// d: It switches video to voice call.
+// l: list_single_pane_t1_cp2
+// r: 3.1
+#define qtn_incal_video_to_voice "Switch to voice call"
+
+// d: It is text for menu option.
+// d: It opens dialog for selecting image to be shared with peer.
+// l: list_single_pane_t1_cp2
+// r: 3.1
+#define qtn_incal_video_call_share_file "Share file"
+
+// d: It is text for softkey option.
+// d: It stops sending selected image to peer.
+// l: control_pane_t1/opt7
+// r: 3.1
+#define qtn_softk_disable_share "Disable share"
+
+//d: Error note text when user selects image that cannot be opened.
+//d: Corrupted or unsupported image selected.
+//l: popup_note_window
+//r:3.1
+//
+#define qtn_tel_info_unable_open_image "Unable to open image"
+
+//d: Error note text when user selects multiframe image that is corrupted.
+//d: Corrupted image selected.
+//l: popup_note_window
+//r: 5.0
+//
+#define qtn_incal_note_decoding_failed "Unable to animate image"
+
+//d: Error note text when user selects a DRM protected image.
+//d: DRM protected media gallery object selected.
+//l: popup_note_window
+//r:3.1
+//
+#define qtn_drm_not_allowed "Unable to select protected objects"
+
+//d: Text for image initializing wait note
+//d: Shown when image to be shared is being initialized.
+//l: popup_note_wait_window
+//r:3.1
+//
+#define qtn_vt_progress_decoding_image "Decoding image"
+
+//d: Toolbar tooltip for disable video.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_disable_video "Disable video sending"
+
+//d: Toolbar tooltip for enable video.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_enable_video "Enable video sending"
+
+
+//d: Toolbar tooltip for mute microphone.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_mute_microphone "Mute microphone"
+
+//d: Toolbar tooltip for unmute microphone.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_unmute_microphone "Unmute microphone"
+
+//d: Toolbar tooltip for swap images.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_swap_images "Change image order"
+
+//d: Toolbar tooltip for secondary camera.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_secondary_cam "Use secondary camera"
+
+//d: Toolbar tooltip for primary camera.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_primary_cam "Use primary camera"
+
+//d: Toolbar tooltip for zoom.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_zoom "Activate zoom mode"
+
+//d: Toolbar tooltip for share.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_share "Share file"
+
+//d: Toolbar tooltip for send snapshot.
+//l: popup_preview_text_window_t1
+//r:3.2
+//
+#define qtn_vt_tooltip_send_snapshot "Send snapshot"
+
+// d: It is text for menu option.
+// d: It opens submenu with Received video quality / White balance /
+// d: Brightness / Contrast / Colour tone
+// l: list_single_pane_t1_cp2/opt3
+// r: 5.0
+#define qtn_incal_video_adjust_option "Adjust video"
+
+// d: It is text for submenu option.
+// d: It opens list query dialog with options Normal / Details / Motion.
+// l: list_single_popup_submenu_pane_t1
+// r: 5.0
+#define qtn_incal_video_prefer_option "Received video quality"
+
+// d: It is text for list query option.
+// d: It adjusts incoming video frame rate to 10 frames per second.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_normal_list_option "Normal"
+
+// d: It is text for list query option.
+// d: It adjusts incoming video frame rate to 5 frames per second.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_details_list_option "Details"
+
+// d: It is text for list query option.
+// d: It adjusts incoming video frame rate to 15 frames per second.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_motion_list_option "Motion"
+
+// d: It is text for submenu option.
+// d: It opens list query dialog with options Automatic / Sunny / Cloudy /
+// d: Incandescent / Fluorescent
+// l: list_single_popup_submenu_pane_t1
+// r: 5.0
+#define qtn_incal_video_white_balance_option "White balance"
+
+// d: It is text for list query option.
+// d: It adjusts incoming video frame rate to 15 frames per second.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_automatic_option "Automatic"
+
+// d: It is text for list query option.
+// d: It adjusts white balance of outgoing video.
+// d: It sets white balance to Sunny.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_sunny_option "Sunny"
+
+// d: It is text for list query option.
+// d: It adjusts white balance of outgoing video.
+// d: It sets white balance to Cloudy.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_cloudy_option "Cloudy"
+
+// d: It is text for list query option.
+// d: It adjusts white balance of outgoing video.
+// d: It sets white balance to Incandescent.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_incandescent_option "Incandescent"
+
+// d: It is text for list query option.
+// d: It adjusts white balance of outgoing video.
+// d: It sets white balance to Fluorescent.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_fluorescent_option "Fluorescent"
+
+// d: It is text for submenu option.
+// d: It shows control for adjusting outgoing video Brightness.
+// l: list_single_popup_submenu_pane_t1
+// r: 5.0
+#define qtn_incal_video_brightness_option "Brightness"
+
+// d: It is text for submenu option.
+// d: It shows control for adjusting outgoing video Contrast.
+// l: list_single_popup_submenu_pane_t1
+// r: 5.0
+#define qtn_incal_video_contrast_option "Contrast"
+
+// d: It is text for submenu option.
+// d: It opens list query dialog with options Normal / Sepia /
+// d: Black and white / Negative
+// l: list_single_popup_submenu_pane_t1
+// r: 5.0
+#define qtn_incal_video_colour_tone_option "Colour tone"
+
+// d: It is text for list query option.
+// d: It adjusts colour tone of outgoing video.
+// d: It sets colour tone to Normal.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_ct_normal_option "Normal"
+
+// d: It is text for list query option.
+// d: It adjusts colour tone of outgoing video.
+// d: It sets colour tone to Sepia.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_sepia_option "Sepia"
+
+// d: It is text for list query option.
+// d: It adjusts colour tone of outgoing video.
+// d: It sets colour tone to Black and white.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_b_and_w_option "Black and white"
+
+// d: It is text for list query option.
+// d: It adjusts colour tone of outgoing video.
+// d: It sets colour tone to Negative.
+// l: list_single_pane_t1_cp2
+// r: 5.0
+#define qtn_incal_negative_option "Negative"
+
+// d: Toolbar tooltip for changing audio routing to handset.
+// l: popup_preview_text_window_t1
+// r: 5.0
+//
+#define qtn_vt_tooltip_audio_handset "Audio to handset"
+
+// d: Toolbar tooltip for changing audio routing to loudspeaker.
+// l: popup_preview_text_window_t1
+// r: 5.0
+//
+#define qtn_vt_tooltip_audio_loudspeaker "Audio to loudspeaker"
+
+// d: Toolbar tooltip for changing audio routing to bluetooth handsfree.
+// l: popup_preview_text_window_t1
+// r: 5.0
+//
+#define qtn_vt_tooltip_audio_bthf "Audio to Bluetooth handsfree"
+
+// d: It is text in softkey to open dialer (for dtmf sending).
+// l: control_pane_t1/opt7
+// r: 5.0
+//
+#define qtn_incal_softk_dialer "Dialer"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/rom/videotelui.iby	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2004-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
+ *
+*/
+
+
+#ifndef __VIDEOTELUI_IBY__
+#define __VIDEOTELUI_IBY__
+
+REM Video Telephone application
+
+#ifdef __CS_VIDEO_TELEPHONY
+
+S60_APP_EXE(videotelui)
+S60_APP_AIF_ICONS(videotelui)
+S60_APP_BITMAP(videotelui)
+
+// Enabler for eclipsing ROM binaries
+data=ZSYSTEM\install\videotelui_stub.sis           system\install\videotelui_stub.sis
+data=ZPRIVATE\10003a3f\apps\videotelui_reg.rsc     private\10003a3f\import\apps\videotelui_reg.rsc
+
+#if defined ( RD_VT_RTF )
+
+data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\VtStartRecord.wav       System\sounds\digital\VtStartRecord.wav
+data=ABI_DIR\BUILD_DIR\z\system\sounds\digital\VtStopRecord.wav        System\sounds\digital\VtStopRecord.wav
+
+#endif //RD_VT_RTF
+#endif // __CS_VIDEO_TELEPHONY
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/rom/videoteluiResources.iby	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2004-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:  IBY file
+ *
+*/
+
+
+#ifndef __VIDEOTELUI_RESOURCES_IBY__
+#define __VIDEOTELUI_RESOURCES_IBY__
+
+#ifdef __CS_VIDEO_TELEPHONY
+data=DATAZ_\APP_RESOURCE_DIR\videotelui.rsc                             APP_RESOURCE_DIR\videotelui.rsc
+#endif // __CS_VIDEO_TELEPHONY
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiActivateBtHfDialog.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* 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:  Implementation of the CVtUiActivateBtHfDialog class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiActivateBtHfDialog.h"
+#include    "MVtUiEngineCommandManager.h"
+#include    <mvtengcommandhandler.h>
+#include    <videotelui.rsg>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiActivateBtHfDialog::CVtUiActivateBtHfDialog
+// -----------------------------------------------------------------------------
+//
+CVtUiActivateBtHfDialog::CVtUiActivateBtHfDialog(
+        CEikDialog** aSelfPtr,
+        TInt* aError, 
+        MVtEngCommandHandler& aCommandHandler,
+        MVtUiEngineCommandManager& aCommandManager )
+    : CAknWaitDialog( aSelfPtr ),
+      iCommandHandler( aCommandHandler ),
+      iCommandManager( aCommandManager ),
+      iError( aError ),
+      iAudioRouting( MVtEngAudio::EActivateBT )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActivateBtHfDialog::~CVtUiActivateBtHfDialog
+// -----------------------------------------------------------------------------
+//
+CVtUiActivateBtHfDialog::~CVtUiActivateBtHfDialog()
+    {
+    if ( iError )
+        {
+        *iError = KErrCancel;
+        iError = NULL;
+        }
+
+    if ( iCommandPerformed )
+        {
+        iCommandHandler.CancelCommand( KVtEngSetAudioRouting ); // ignore error
+        }
+    iCommandManager.RemoveObserver( *this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActivateBtHfDialog::ExecuteDialogLD
+// -----------------------------------------------------------------------------
+//
+void CVtUiActivateBtHfDialog::ExecuteDialogLD()
+    {
+    CleanupStack::PushL( this );
+    iCommandManager.AddObserverL( *this );
+    SetTone( CAknNoteDialog::ENoTone );
+    CleanupStack::Pop( this );
+
+    ExecuteLD( R_VIDEOTELUI_BTHF_CONNECT_WAIT_NOTE );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActivateBtHfDialog::PostLayoutDynInitL
+// -----------------------------------------------------------------------------
+//
+void CVtUiActivateBtHfDialog::PostLayoutDynInitL()
+    {
+    iCommandHandler.ExecuteL( KVtEngSetAudioRouting, &iAudioRouting );
+    iCommandPerformed = ETrue;
+
+    CAknWaitDialog::PostLayoutDynInitL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActivateBtHfDialog::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiActivateBtHfDialog::HandleVTCommandPerformedL( 
+        TVtEngCommandId aCommand,
+        const TInt aError )
+    {
+    if ( aCommand == KVtEngSetAudioRouting )
+        {
+        if ( iError )
+            {
+            *iError = aError;
+            iError = NULL;
+            }
+
+        ProcessFinishedL();
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiActiveExec.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* 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 of the CVtUiActiveExec class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiActiveExec.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiActiveExec::CVtUiActiveExec
+// -----------------------------------------------------------------------------
+//
+CVtUiActiveExec::CVtUiActiveExec(
+        const TInt aPriority )
+    : CActive( aPriority )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActiveExec::~CVtUiActiveExec
+// -----------------------------------------------------------------------------
+//
+CVtUiActiveExec::~CVtUiActiveExec()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActiveExec::Start
+// -----------------------------------------------------------------------------
+//
+void CVtUiActiveExec::Start( 
+        TInt aStartState, 
+        MVtUiActiveExec& aExec )
+    {
+    Cancel();
+
+    iInitialState = aStartState;
+    iCurrentState = aStartState;
+    iNextState = aStartState;
+
+    iActiveExec = &aExec;
+
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActiveExec::InitialState
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiActiveExec::InitialState() const
+    {
+    return iInitialState;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActiveExec::RequestStatus
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiActiveExec::RequestStatus() const
+    {
+    return iStatus.Int();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActiveExec::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtUiActiveExec::RunL()
+    {
+    User::LeaveIfError( iStatus.Int() );
+    TBool synch = ETrue;
+
+    // Execute to the next asynchronous operation.
+    while ( synch )
+        {
+        iCurrentState = iNextState;
+        if ( iCurrentState )
+            {
+            synch = iActiveExec->ActiveExecExecuteL( 
+                *this,
+                iCurrentState, 
+                iNextState, 
+                iStatus );
+
+            if ( !synch )
+                {
+                SetActive();
+                }
+            }
+        else
+            {   
+            iActiveExec->ActiveExecDone( *this, iInitialState );
+            if ( !IsActive() )
+                {
+                iInitialState = 0;
+                }
+
+            synch = EFalse;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActiveExec::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtUiActiveExec::DoCancel()
+    {
+    if ( iActiveExec )
+        {
+        iActiveExec->ActiveExecCancel( *this, iCurrentState );
+        
+        iCurrentState = 0;
+        iActiveExec = NULL;
+        iInitialState = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiActiveExec::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiActiveExec::RunError( TInt aError )
+    {
+    if ( iActiveExec->ActiveExecContinue( *this, iCurrentState, aError ) )
+        {
+        iNextState = iCurrentState;
+
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        SetActive();
+        }
+    else
+        {
+        if ( !IsActive() )
+            {
+            iInitialState = 0;
+            }
+        }
+    
+    return KErrNone;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiAllowVideoDialog.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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 of the CVtUiAllowVideoDialog class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiAllowVideoDialog.h"
+#include    <stringloader.h>
+#include    <videotelui.rsg>
+
+// CONSTANTS
+
+// Timeout for allow video query.
+const TInt KVtUiAllowVideoDialogTimeout = 5000000;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiAllowVideoDialog::CVtUiAllowVideoDialog
+// -----------------------------------------------------------------------------
+//
+CVtUiAllowVideoDialog::CVtUiAllowVideoDialog(
+        CEikDialog** aSelfPtr,
+        const TTone& aTone )
+    : CAknQueryDialog( aTone ),
+      iSelfPtr( aSelfPtr )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAllowVideoDialog::~CVtUiAllowVideoDialog
+// -----------------------------------------------------------------------------
+//
+CVtUiAllowVideoDialog::~CVtUiAllowVideoDialog()
+    {
+    if ( iSelfPtr )
+        {
+        *iSelfPtr = NULL;
+        iSelfPtr = NULL;
+        }
+
+    if ( iRequestStatus )
+        {
+        User::RequestComplete( iRequestStatus, KErrNone );
+        iRequestStatus = NULL;
+        }
+
+    delete iQueryTimer;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAllowVideoDialog::ExecuteDialogLD
+// -----------------------------------------------------------------------------
+//
+void CVtUiAllowVideoDialog::ExecuteDialogLD(
+        TRequestStatus& aStatus )
+    {
+    aStatus = KRequestPending;
+
+    HBufC* prompt = StringLoader::LoadLC( R_VIDEOTELUI_QTN_SEND_VIDEO_IMAGE );
+
+    PrepareLC( R_VIDEOTELUI_ALLOW_VIDEO_QUERY );
+    SetPromptL( *prompt );
+    RunLD();
+
+    CleanupStack::PopAndDestroy( prompt );
+    iRequestStatus = &aStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAllowVideoDialog::PostLayoutDynInitL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAllowVideoDialog::PostLayoutDynInitL()
+    {
+    CAknQueryDialog::PostLayoutDynInitL();
+
+    iQueryTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    iQueryTimer->Start(
+        KVtUiAllowVideoDialogTimeout,
+        KVtUiAllowVideoDialogTimeout,
+        TCallBack( DoDismissDialogTimeoutL, this ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAllowVideoDialog::OkToExitL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAllowVideoDialog::OkToExitL( TInt aCommand )
+    {
+    const TBool exit = 
+        CAknQueryDialog::OkToExitL( aCommand );
+
+    if ( exit )
+        {
+        CVtUiAllowVideoDialog::TResult result =
+            CVtUiAllowVideoDialog::EQueryCanceled;
+
+        switch ( aCommand )
+            {
+            case EAknSoftkeyOk:
+            case EAknSoftkeyYes:
+                result = CVtUiAllowVideoDialog::EUserAllowed;
+                break;
+
+            case EAknSoftkeyNo:
+                result = CVtUiAllowVideoDialog::EUserDenied;
+                break;
+
+            default:
+                break;
+            }
+
+        if ( iRequestStatus )
+            {
+            User::RequestComplete( iRequestStatus, result );
+            iRequestStatus = NULL;
+            }
+        }
+
+    return exit;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAllowVideoDialog::DoDismissDialogTimeoutL
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAllowVideoDialog::DoDismissDialogTimeoutL( TAny* aAny )
+    {
+    CVtUiAllowVideoDialog* self =
+        static_cast< CVtUiAllowVideoDialog* >( aAny );
+
+    TRequestStatus* status = self->iRequestStatus;
+    self->iRequestStatus = NULL;
+    
+    delete self;    
+
+    User::RequestComplete( 
+        status,
+        CVtUiAllowVideoDialog::EQueryDismissedTimeout );
+
+    return KErrNone;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiApp.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* 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 of the CVtUiApp application class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiApp.h"
+#include    "CVtUiDoc.h"
+#include    "videotelui.hrh"
+
+#include    <eikstart.h>
+
+// CONSTANTS
+
+// UID of Video Telephone application.
+const TUid KVtUiAppUid = { KVtUiAppUidValue };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiApp::CVtUiApp
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiApp::CVtUiApp()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiApp::CreateDocumentL
+// Creates CVtUiDoc instance.
+// -----------------------------------------------------------------------------
+//
+CApaDocument* CVtUiApp::CreateDocumentL()
+    {
+    return new ( ELeave ) CVtUiDoc( *this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiApp::AppDllUid
+// Returns application uid.
+// -----------------------------------------------------------------------------
+//
+TUid CVtUiApp::AppDllUid() const
+    {
+    return KVtUiAppUid;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// ---------------------------------------------------------
+// NewApplication implements
+// 
+// Creates an instance of application.
+//
+// Returns: an instance of CVtUiApp
+// ---------------------------------------------------------
+//
+LOCAL_C CApaApplication* NewApplication()
+    {
+    return new CVtUiApp;
+    }
+
+// ---------------------------------------------------------
+// E32Main implements
+// 
+// It is called when executable is started. 
+//
+// Returns: error code.
+// ---------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    return EikStart::RunApplication( NewApplication );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiAppUi.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,7302 @@
+/*
+* 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:  Implementation of the CVtUiAppUi application UI class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "videotelui.hrh"
+#include    "CVtUiAppUi.h"
+#include    "CVtUiMainControl.h"
+#include    "CVtUiContextControl.h"
+#include    "CVtUiNumberEntryActivationControl.h"
+#include    "CVtUiNaviPane.h"
+#include    "VtUiLayout.h"
+#include    "MVtUiEngineCommandManager.h"
+#include    "CVtUiExecuteCmdDialog.h"
+#include    "CVtUiAllowVideoDialog.h"
+#include    "CVtUiBlankControl.h"
+#include    "VtUiLayout.h"
+#include    "VtUiUtility.h"
+#include    "VtUiPanic.h"
+#include    "CVtUiActivateBtHfDialog.h"
+#include    "CVtUiRemoteVideoControl.h"
+#include    <csxhelp/incl.hlp.hrh>
+
+
+#include    <aknincallbubblenotify.h>
+#include    <aknslayeredbackgroundcontrolcontext.h>
+#include    <aknutils.h>
+#include    <aknnavi.h>
+#include    <akntitle.h>
+#include    <akndlgshut.h>
+#include    <aknnotedialog.h>
+#include    <aknnotewrappers.h>
+#include    <akncontext.h>
+#include    <eikspane.h>
+#include    <eikmenup.h>
+#include    <eikmenub.h>
+#include    <apgcli.h>
+#include    <featmgr.h>
+#include    <videotelui.rsg>
+#include    <hlplch.h>
+#include    <apgwgnam.h>
+#include    <stringloader.h>
+#include    <akndef.h>
+#include    <aknconsts.h>
+
+
+#include    <e32property.h>
+#include    <ecom/ecom.h>
+#include    <coreapplicationuisdomainpskeys.h>
+#include    <uikoninternalpskeys.h>
+#include    <centralrepository.h>
+#include    <videotelephonyinternalcrkeys.h>
+#include    <settingsinternalcrkeys.h>
+#include    <e32property.h>
+#include    <telcommsinfopskeys.h>
+#include    <telinformationpskeys.h>
+#include    <activeidle2domainpskeys.h>
+#include 	<ctsydomainpskeys.h>
+
+#include    <aknquerydialog.h>
+#include 	<aknglobalnote.h>
+#include 	<aknsoundsystem.h>
+
+
+#include    <cvtlogger.h>
+#include    <cvtengmodel.h>
+#include    <mvtengeventobserver.h>
+#include    <mvtengcommandobserver.h>
+#include    <mvtengcommandhandler.h>
+#include    <mvtengframeobserver.h>
+#include    <mvtengaudio.h>
+#include    <mvtengsessioninfo.h>
+#include    <vtengevents.h>
+#include    <mvtengmedia.h>
+
+#include    "CVtUiBitmapManager.h"
+
+#include    <mgfetch.h>
+#include    <mmgfetchverifier.h>
+#include    <caf/manager.h>
+#include    <caf/virtualpathptr.h>
+
+#include    "cvtuifeaturemanager.h"
+#include    "cvtuicomponentmanager.h"
+#include    "cvtuicommandmanager.h"
+#include    "tvtuistates.h"
+#include    "cvtuimenus.h"
+#include    "cvtuisoftkeys.h"
+#include    "cvtuitoolbarbase.h"
+#include    "cvtuiwhitebalance.h"
+#include    "cvtuicolortone.h"
+#include    "cvtuibrightness.h"
+#include    "cvtuicontrast.h"
+#include    <remconinterfaceselector.h>
+#include    <remconcoreapitarget.h>
+#include    <remconcoreapitargetobserver.h>
+#include    "tvtuiwsevent.h"
+#include    "mvtuinumbersource.h"
+#include	"tVtuifeaturevariation.h"
+#include    "cvtuidialer.h"
+#include    "tvtuiappstates.h"
+#include    "cvtuivolume.h"
+#include    "cvtuizoom.h"
+#include    "cvtuivolumecontrol.h"
+
+using namespace ContentAccess;
+
+// CONSTANTS
+
+// Engine orientation to application orientation map
+const CVtUiAppUi::TAppUiOrientation engToAppOrientation[] = {
+    CVtUiAppUi::EAppUiOrientationLandscape,
+    CVtUiAppUi::EAppUiOrientationPortrait,
+    CVtUiAppUi::EAppUiOrientationUnspecified };
+
+// Amount of help contexts.
+const TInt KVtUiHelpContextAmount = 1;
+
+// UID of Video Telephone application.
+const TUid KVtUiAppUid = { KVtUiAppUidValue };
+
+// Granularity of command observer array.
+const TInt KVtUiCommandObserverArrayGranularity = 5;
+
+// Default call index.
+const TInt KVtUiDefaultCallId = 1;
+
+// Control priority for the blank control. Above all other controls.
+const TInt KVtUiBlankControlPriority =
+    ECoeStackPriorityEnvironmentFilter + 100;
+
+// Exit timeout.
+const TInt KVtUiExitTimeout = 10000000;
+
+// UID of the main telephone application
+const TUid KVtUiTelephoneUid = { 0x100058B3 };
+
+// Reset value for volume
+const TInt  KVolumeResetValue = -1;
+
+
+// Name of the EIKON server window group.
+_LIT( KVtUiEikonServer, "EikonServer" );
+
+// Name of the AknCapServer window group.
+_LIT( KVtUiAknCapServer, "*akncapserver*" );
+
+// Name of the AknNotifierServer window group.
+_LIT( KVtUiAknNotifierServer, "*aknnfysrv*" );
+
+// Volume repeat delay.
+const TInt KVtUiVolumeRepeatDelay = KAknStandardKeyboardRepeatRate;
+
+// Volume repeat long delay.
+const TInt KVtUiVolumeRepeatLongDelay = KAknKeyboardRepeatInitialDelay;
+
+// Start time for toolbar timer
+const TTimeIntervalMicroSeconds32 KStartTime( 600000 );
+
+// period time for toolbar timer
+const TTimeIntervalMicroSeconds32 KPeriodTime( 300000 );
+
+// The maximum frequency that user can swap image places.
+const TInt64 KVtUiMaxSwapImagesFreq( 1000000 );
+
+// Enumerates methods used in event handling. This enumeration MUST
+// match with methodArray local array.
+enum TVtUiHandleEvents
+    {
+    // Refresh states
+    EVtUiRefreshStates =                    1 << 0,
+    // Handle remote problem.
+    EVtUiHandleVideoFrameRemoteProblem =    1 << 1,
+    // Handle local problem.
+    EVtUiHandleVideoFrameLocalProblem =     1 << 2,
+    // Refresh navipane.
+    EVtUiRefreshNaviPane =                  1 << 3,
+    // Refresh softkeys.
+    EVtUiRefreshSoftkeys =                  1 << 4,
+    // Refresh blind icon status.
+    EVtUiRefreshBlind =                     1 << 5,
+    // Stop showing waiting image text.
+    EVtUiStopWaitingImage =                 1 << 6,    
+    // Rx resolution changed.
+    EVtUiChangeRemoteVideoLayout =          1 << 7,
+    // Show initializing image progress
+    EVtUiShowImageInitializingProgress =    1 << 8,
+    // Hide initializing image progress
+    EVtUiHideImageInitializingProgress =    1 << 9,
+    // Set camera orientation
+    EVtUiSetOrientation =                   1 << 10,
+    //Handle media status change
+    EVtUiMediaStateChanged =                1 << 11,
+    //Show decoding error note
+    EVtUiShowDecodingError =                1 << 12,
+    // Stop the white balance and color tone
+    EVtUiStopWBOrColortone =                1 << 13,
+    // refresh Menu
+    EVtUiRefreshMenu =                      1 << 14,
+    // Stop brightness and contrast slider
+    EVtUiStopBrightnessOrContrast =         1 << 15,
+    // refresh zoom popup
+    EVtUiRefreshZoomPopup =       					1 << 16
+    };
+
+// Enumerates states for CVtUiActiveExec.
+enum
+    {
+    // Operation finished. Must equal to zero.
+    EVtUiAppUiNone,
+
+    // Active execution states for iActiveExec:
+
+    // Startup (prepare engine):
+    EVtUiAppUiStartup = 100,                             // 100
+    //     Close dialogs.
+    EVtUiAppUiStartupCloseDialogs = EVtUiAppUiStartup,   // 100
+    //     Initialise engine.
+    EVtUiAppUiStartupInitEngine,                         // 101
+    //     Prepare viewfinder.
+    EVtUiAppUiStartupPrepareViewfinder,                  // 102
+    //     Prepare remote render.
+    EVtUiAppUiStartupPrepareRemoteRender,                // 103
+    //     Remove blank.
+    EVtUiAppUiStartupRemoveBlank,                        // 104
+
+    // Shutdown (reset engine):
+    EVtUiAppUiShutdown = 300,                            // 300
+    //     Close dialogs.
+    EVtUiAppUiShutdownCloseDialogs = EVtUiAppUiShutdown, // 300
+    //     Hide application.
+    EVtUiAppUiShutdownHideApplication,                   // 301
+    //     Reset engine.
+    EVtUiAppUiShutdownResetEngine,                       // 302
+    //     Remove blank.
+    EVtUiAppUiShutdownRemoveBlank,                       // 303
+
+    // Answered:
+    EVtUiAppUiAnswered = 500,                            // 500
+    //     Show blank dialog.
+    EVtUiAppUiAnsweredStart = EVtUiAppUiAnswered,        // 500
+    //     Refresh navipane.
+    EVtUiAppUiAnsweredRefreshNavi,                       // 501
+    //     Refresh softkeys.
+    EVtUiAppUiAnsweredRefreshSoftkeys,                   // 502
+    //     Start remote render.
+    EVtUiAppUiAnsweredStartRemoteRender,                 // 503
+
+    //     Prepares camera
+    EVtUiAppUiAnsweredCheckCamera,                       // 504
+    //     Choose if it's needed to show query or directly activate camera.
+    EVtUiAppUiAnsweredChoose,                            // 505
+    //     Set still image as source.
+    EVtUiAppUiAnsweredQuerySetupStill,                   // 506
+    //     Set none as source.
+    EVtUiAppUiAnsweredQuerySetupNone,                    // 507
+    //     Start viewfinder.
+    EVtUiAppUiAnsweredQuerySetupStart,                   // 508
+    //     Show "allow video image" query.
+    EVtUiAppUiAnsweredQueryShow,                         // 509
+    //     Check if user allowed video image.
+    EVtUiAppUiAnsweredQueryDecide,                       // 510
+    //     Select camera as source.
+    EVtUiAppUiAnsweredQuerySelectCamera,                 // 511
+    //     Select still image as source.
+    EVtUiAppUiAnsweredQuerySelectStill,                  // 512
+    //     Select none as source.
+    EVtUiAppUiAnsweredQuerySelectNone,                   // 513
+    //     Start viewfinder.
+    EVtUiAppUiAnsweredQueryStartViewfinder,              // 514
+    //     Finish.
+    EVtUiAppUiAnsweredQueryFinish,                       // 515
+    //     Select camera as source.
+    EVtUiAppUiAnsweredSelectCamera,                      // 516
+    //     Select still image as source.
+    EVtUiAppUiAnsweredSelectStill,                       // 517
+    //     Select none as source.
+    EVtUiAppUiAnsweredSelectNone,                        // 518
+    //     Start viewfinder.
+    EVtUiAppUiAnsweredStartViewfinder,                   // 519
+    //     Finish.
+    EVtUiAppUiAnsweredFinish,                            // 520
+
+    //     Prepares camera
+    EVtUiAppUiAnsweredDoPrepareCamera                   // 521
+    };
+
+/**
+* Enumerates background layers
+*/
+enum TVtUiBackgroundLayers
+    {
+    // Idle state background.
+    EVtUiLayerBackground = 0,
+    // Wallpaper layout.
+    EVtUiLayerWallpaper = 1,
+    // Amount of layers.
+    EVtUiLayerCount = 2
+    };
+
+// MODULE DATA STRUCTURES
+
+/**
+* Asynchronous command executor that does not use dialog for waiting the
+* execution completion.
+* @since Series 60 5.0
+*/
+class CVtEngCmdExec : public CBase, private MVtEngCommandObserver
+    {
+
+public:
+    /**
+    * Static constructor.
+    */
+    static CVtEngCmdExec* NewL( MVtEngCommandHandler& aCommandHandler,
+        MVtUiEngineCommandManager& aCommandManager,
+        CEikButtonGroupContainer& aCBA );
+
+    /**
+    * Executes given command asynchronously, waiting the command completion.
+    */
+    void ExecuteCmdLD( const TVtEngCommandId aCommandId );
+
+    /**
+    * Destructor.
+    */
+    ~CVtEngCmdExec();
+
+private: // from MVtEngCommandObserver
+
+    /**
+    * @see MVtEngCommandObserver::HandleVTCommandPerformedL
+    */
+    void HandleVTCommandPerformedL( TVtEngCommandId aCommand,
+        const TInt aError );
+
+private:
+
+    /**
+    * Constructor.
+    */
+    CVtEngCmdExec( MVtEngCommandHandler& aCommandHandler,
+        MVtUiEngineCommandManager& aCommandManager,
+        CEikButtonGroupContainer& aCBA );
+
+private:
+
+    CActiveSchedulerWait iWait;
+
+    MVtEngCommandHandler& iCommandHandler;
+
+    MVtUiEngineCommandManager& iCommandManager;
+
+    TVtEngCommandId iCommandId;
+
+    CEikButtonGroupContainer& iCBA;
+
+    };
+
+// -----------------------------------------------------------------------------
+// CVtEngCmdExec::NewL
+// -----------------------------------------------------------------------------
+//
+CVtEngCmdExec* CVtEngCmdExec::NewL( MVtEngCommandHandler& aCommandHandler,
+    MVtUiEngineCommandManager& aCommandManager, CEikButtonGroupContainer& aCBA )
+    {
+    CVtEngCmdExec* self = new ( ELeave ) CVtEngCmdExec( aCommandHandler,
+        aCommandManager, aCBA );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCmdExec::ExecuteCmdLD
+// -----------------------------------------------------------------------------
+//
+void CVtEngCmdExec::ExecuteCmdLD( const TVtEngCommandId aCommandId )
+    {
+    __VTPRINTENTER("CVtEngCmdExec::ExecuteCmdLD")
+    CleanupStack::PushL( this );
+    iCommandId = aCommandId;
+    iCommandManager.AddObserverL( *this );
+    iCommandHandler.ExecuteL( aCommandId, NULL );
+    iCBA.SetCommandSetL( R_VIDEOTELUI_SOFTKEYS_EMPTY );
+    iCBA.DrawNow();
+    iWait.Start();
+    CleanupStack::PopAndDestroy(); // this
+    __VTPRINTEXIT("CVtEngCmdExec::ExecuteCmdLD")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCmdExec::~CVtEngCmdExec
+// -----------------------------------------------------------------------------
+//
+CVtEngCmdExec::~CVtEngCmdExec()
+    {
+    __VTPRINTENTER("CVtEngCmdExec::~CVtEngCmdExec")
+    if ( iWait.IsStarted())
+        {
+        __VTPRINT(DEBUG_GEN, "CVtEngCmdExec::~CVtEngCmdExec AsyncStop")
+        iWait.AsyncStop();
+        }
+    iCommandManager.RemoveObserver( *this );
+    __VTPRINTEXIT("CVtEngCmdExec::~CVtEngCmdExec")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCmdExec::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+void CVtEngCmdExec::HandleVTCommandPerformedL( TVtEngCommandId aCommand,
+        const TInt aError )
+    {
+    __VTPRINTENTER("CVtEngCmdExec::HandleVTCommandPerformedL")
+    if ( iCommandId == aCommand )
+        {
+         if ( iWait.IsStarted())
+            {
+            __VTPRINT(DEBUG_GEN, "CVtEngCmdExec::HandleVTCommandPerformedL AsyncStop")
+            iWait.AsyncStop();
+            }
+        else
+            {
+            // request already completed
+            }
+        }
+    else
+        {
+        // wrong command ID
+        }
+    __VTPRINTEXIT("CVtEngCmdExec::HandleVTCommandPerformedL")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtEngCmdExec::CVtEngCmdExec
+// -----------------------------------------------------------------------------
+//
+CVtEngCmdExec::CVtEngCmdExec( MVtEngCommandHandler& aCommandHandler,
+    MVtUiEngineCommandManager& aCommandManager, CEikButtonGroupContainer& aCBA )
+    : iCommandHandler( aCommandHandler ),
+      iCommandManager( aCommandManager ), iCBA( aCBA )
+    {
+    }
+    
+/**
+* Encapsulates all instances related to user interface.
+* @since Series 60 2.6
+*/
+class CVtUiAppUi::CInstance
+    : public CBase
+    {
+    public: // Constructors and destructors
+
+        /**
+        * Two-phased constructor.
+        * @param aAppUi reference to application UI.
+        */
+        static CInstance* NewL( CVtUiAppUi& aAppUi );
+
+        /**
+        * Destructor.
+        */
+        ~CInstance();
+
+        /**
+        * Called when side volume key is pressed.
+        */
+        void VolumeKeyPressedL();
+
+        /**
+        * Create remote video control.
+        */        
+        void CreateRemoteVideoControl();
+
+    private:
+
+        /**
+        * Constructor.
+        */
+        CInstance( CVtUiAppUi& aAppUi );
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Relayout controls.
+        */
+        void LayoutChanged();
+
+    private:
+
+        // Parent can access members.
+        friend class CVtUiAppUi;
+
+        // Ref to application UI.
+        CVtUiAppUi& iAppUi;
+
+        // Owned bitmap manager.
+        CVtUiBitmapManager* iBitmapManager;
+
+        // ETrue if iMainControl has been added to stack.
+        TBool iMainControlInStack;
+
+        // Owned main pane control.
+        CVtUiMainControl* iMainControl;
+
+        // ETrue if iContextControl has been added to stack.
+        TBool iContextControlInStack;
+
+        // Owned context pane control.
+        CVtUiContextControl* iContextControl;
+
+        // Owned remote video control.
+        CVtUiRemoteVideoControl* iRemoteVideoControl;
+        
+        //ETrue if iRemoteVideoControl has been added to stack.
+        TBool iRemoteVideoControlInStack;
+
+        // Owned navi pane controller.
+        CVtUiNaviPane* iNaviPane;
+
+        // ETrue if number entry has been added to stack.
+        TBool iNumberEntryInStack;
+
+        // Owned number entry activation control.
+        CVtUiNumberEntryActivationControl* iNumberEntryActivation;
+
+    };
+
+/**
+* Encapsulates event handling.
+* @since Series 60 2.6
+*/
+class CVtUiAppUi::CEventObserver
+    : public CBase,
+      public MVtUiEngineCommandManager,
+      public MVtEngEventObserver,
+      public MVtEngCommandObserver,
+      public MVtEngFrameObserver,
+      private MBeating,
+      private MRemConCoreApiTargetObserver
+    {
+    public: // Constructors and destructors
+
+        /**
+        * Two-phased constructor.
+        * @param aAppUi application UI.
+        */
+        static CEventObserver* NewL( CVtUiAppUi& aAppUi );
+
+        /**
+        * Destructor.
+        */
+        ~CEventObserver();
+
+    public: // New functions
+
+        /**
+        * Returns engine model.
+        * @return model instance.
+        */
+        inline CVtEngModel& Model();
+        
+        /**
+        * Creates remote control framework session.
+        */
+        void CreateRemConSessionL();
+
+        /**
+        * Deletes remote control framework session.
+        */
+        void DeleteRemConSession();
+
+        /**
+        * Checks if command is supported by engine.
+        * @param aCommandId command.
+        * @return ETrue if supported, EFalse otherwise.
+        */
+        TBool CommandSupported( const TInt aCommandId ) const;
+
+        /**
+        * Checks if command is supported and synchronous.
+        * @param aCommandId command.
+        * @return ETrue if synchronous & supported, EFalse otherwise.
+        */
+        TBool CommandSupportedAndSynchronous(
+            const TInt aCommandId ) const;
+
+        /**
+        * Starts heartbeat timer.
+        */
+        void StartBeatL();
+
+        /**
+        * Stops heartbeat timer.
+        */
+        void StopBeat();
+
+        /**
+        * Stops volume repeat handling timer.
+        */
+        void StopVolumeRepeatTimer();
+        
+        /**
+        * Sends response to prepare.
+        * @param aResult result code.
+        */
+        void SendPrepareResponse( const TInt aResult );
+
+    public: // Functions from base classes
+
+        /**
+        * @see MVtUiCommandManager::AddObserverL.
+        */
+        virtual void AddObserverL( MVtEngCommandObserver& aObserver );
+
+        /**
+        * @see MVtUiCommandManager::RemoveObserver.
+        */
+        virtual void RemoveObserver( MVtEngCommandObserver& aObserver );
+
+        /**
+        * @see MVtEngEventObserver::HandleVtEventL.
+        */
+        virtual void HandleVtEventL( TInt aEvent );
+
+        /**
+        * @see MVtEngCommandObserver::HandleVTCommandPerformedL.
+        */
+        virtual void HandleVTCommandPerformedL(
+            TVtEngCommandId aCommand,
+            const TInt aError );
+
+        /**
+        * @see MVtEngFrameObserver::vtHandleFrameL.
+        */
+        virtual void vtHandleFrameL( TFrameType aType, CFbsBitmap* aBitmap );
+
+        /**
+        * @see MVtEngFrameObserver::vtSetFrame
+        */
+        virtual void vtSetFrame( TFrameType aType, CFbsBitmap* aBitmap );
+
+        /**
+        * @see MBeating::Beat.
+        */
+        virtual void Beat();
+
+        /**
+        * @see MBeating::Synchronize.
+        */
+        virtual void Synchronize();
+
+
+    private:
+
+        /**
+        * Constructor.
+        * @param aAppUi application UI.
+        */
+        CEventObserver( CVtUiAppUi& aAppUi );
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Executes CVtUiAppUi methods.
+        * @param aBits sum of subset of TVtUiHandleEvents.
+        */
+        void DoExecuteL( TInt aBits );
+        /**
+        * Handles volume change.
+        * @param aButtonAct button action.
+        */
+        void HandleVolumeChange(
+            TRemConCoreApiButtonAction aButtonAct );
+        /**
+        * Handles mute change.
+        * @param aButtonAct button action.
+        */
+        void HandleRemMuteChange(
+            TRemConCoreApiButtonAction aButtonAct );
+        /**
+        * @see MRemConCoreApiTargetObserver::MrccatoCommand.
+        */
+        virtual void MrccatoCommand(
+            TRemConCoreApiOperationId aOperationId,
+            TRemConCoreApiButtonAction aButtonAct );
+
+        /**
+        * Callback function to handle volume repeat.
+        * @param aAny pointer to an instance of this class.
+        * @return KErrNone.
+        */
+        static TInt DoHandleVolumeRepeat( TAny* aAny );
+
+    private:
+
+        // Type definition for CVtUiAppUi member functions.
+        typedef void (CVtUiAppUi::*TMethodL)();
+
+        // Ref to application ui.
+        CVtUiAppUi& iAppUi;
+
+        // Engine model.
+        CVtEngModel* iModel;
+
+        // ETrue when command events are being sent.
+        TBool iInCommandPerformed;
+
+        // Owned array of observers.
+        RPointerArray< MVtEngCommandObserver > iCommandObservers;
+
+        // Owned heart beat timer to update call duration.
+        CHeartbeat* iBeat;
+        
+
+        // Owned interface selector instance.
+        CRemConInterfaceSelector* iRemConInterfaceSelector;
+
+        // Pointer to target instance. Owned by iRemConInterfaceSelector.
+        CRemConCoreApiTarget* iRemConCoreApiTarget;
+
+        // Owned timer for volume repeat handling.
+        CPeriodic* iRemConVolumeRepeatTimer;
+
+        // Rencon operation id
+        TRemConCoreApiOperationId iRCCAOperationId;
+
+    };
+
+/**
+* Verifies objects fetched using media gallery. Only non DRM protected
+* objects are allowed.
+* @since Series 60 3.1
+*/
+class CVtUiAppUi::CVtUiAppUiMGVerifier :
+    public CBase,
+    public MMGFetchVerifier
+    {
+    public:
+
+    		/**
+    		* Static constructor, pushes created instance into cleanup stack.
+    		*/
+        static CVtUiAppUiMGVerifier* NewLC(
+            CVtUiAppUi& aAppUi, CCoeEnv& aCoeEnv );
+
+    		/**
+    		* Destructor.
+    		*/
+        ~CVtUiAppUiMGVerifier();
+
+    public: // from MMGFetchVerifier
+
+        /**
+    		* @see MMGFetchVerifier::VerifySelectionL
+    		*/
+        TBool VerifySelectionL( const MDesCArray* aSelectedFiles );
+
+    private:
+
+    		/**
+    		* 2nd constructor in two phase construction.
+    		*/
+        void ConstructL();
+
+        /**
+    		* Constructor.
+    		*/
+        CVtUiAppUiMGVerifier( CVtUiAppUi& aAppUi, CCoeEnv& aCoeEnv );
+
+    private:
+
+        // Reference to Application UI
+        CVtUiAppUi& iAppUi;
+
+        // Pointer to COE
+        CCoeEnv* iCoeEnv;
+
+        // Pointer to CManager which manages files and content access agents
+        CManager* iManager;
+    };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CVtUiAppUi
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CVtUiAppUi()
+    : iRenderingMode( ERenderingModeDefault ),
+      iLoudspeakerVolume( KVolumeResetValue ),
+      iHandsetVolume( KVolumeResetValue ),
+      iActiveCommands( 1 ),
+      iLayoutChg( EFalse ),
+      iDelayedCmd( 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ConstructL()
+    {
+    VTLOGINIT
+    __VTPRINTENTER( "VtUi.ConstructL" )
+
+    FeatureManager::InitializeLibL();
+    BaseConstructL( EAknEnableSkin | EAknEnableMSK );
+
+    iCba = Cba();
+    // Must be done before creating features
+    iVTVariation.ReadL();
+
+    iEventObserver = CEventObserver::NewL( *this );
+    iUiStates = new ( ELeave ) TVtUiStates( iEventObserver->Model() );
+    iUiStates->Update();
+		iUiStates->SetViewFindersInitialPlaceContextPane( ETrue );
+		
+    TVtUiAppStateBase::SetInitialStateL( *this, *iUiStates );
+
+    iCommandManager = CVtUiCommandManager::NewL( *iUiStates, *this );
+
+    iComponentManager = CVtUiComponentManager::NewL();
+
+    iFeatureManager = CVtUiFeatureManager::NewL( *this, *iUiStates,
+         *iCommandManager, *iComponentManager );
+
+    iInstance = CInstance::NewL( *this );
+
+    CEikMenuBar* menu = iEikonEnv->AppUiFactory()->MenuBar();
+    menu->SetContextMenuTitleResourceId( R_VIDEOTELUI_OK_MENUBAR );
+
+
+
+    CEikonEnv& eikEnv = *( iEikonEnv );
+    eikEnv.SetSystem( ETrue );
+    eikEnv.WsSession().ComputeMode( RWsSession::EPriorityControlDisabled );
+
+    iThisApplicationWgId = eikEnv.RootWin().Identifier();
+    iEikonServerWgId =
+        eikEnv.WsSession().FindWindowGroupIdentifier( 0, KVtUiEikonServer );
+    iAknCapServerWgId =
+    	eikEnv.WsSession().FindWindowGroupIdentifier( 0, KVtUiAknCapServer );
+    iAknNfyServerWgId =
+        eikEnv.WsSession().FindWindowGroupIdentifier( 0,
+            KVtUiAknNotifierServer );
+
+    __ASSERT_ALWAYS(
+        iEikonServerWgId != KErrNotFound,
+        VtUiPanic::Panic( EVtUiPanicEikonServerNotFound ) );
+    (void)eikEnv.RootWin().EnableFocusChangeEvents();
+
+
+    iUplinkWindow = iInstance->iContextControl;
+    iDownlinkWindow = iInstance->iMainControl;
+
+
+    if ( iCba )
+        {
+        CCoeControl* control = iCba->ButtonGroup()->AsControl();
+        static_cast< CEikCba* >( control )->
+            SetSkinBackgroundId( KAknsIIDQsnBgAreaControlIdle );
+        }
+
+    iBlankControl = new ( ELeave ) CVtUiBlankControl;
+    iBlankControl->ConstructL( ClientRect() );
+    AddToStackL(
+        iBlankControl,
+        KVtUiBlankControlPriority,
+        ECoeStackFlagRefusesFocus );
+
+    iUiStates->SetBlankControlAdded( ETrue );
+
+    iActiveExec =
+        new ( ELeave ) CVtUiActiveExec( CActive::EPriorityHigh );
+    SetCallIdL( KVtUiDefaultCallId );
+
+    iExitTimer = CPeriodic::NewL( CActive::EPriorityHigh );
+    CheckEngineFunctionality();
+
+    iAsyncCallback =
+        new ( ELeave ) CAsyncCallBack (
+            TCallBack( &AsyncViewFinderToMainPaneAndShare, this ),
+            CActive::EPriorityStandard );
+
+    iLayoutChangeCallback =
+        new ( ELeave ) CAsyncCallBack(
+            TCallBack( &DelayedHandleLayoutChanged, this ),
+            CActive::EPriorityStandard );
+
+    iCurrentCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch;
+
+    GetCameraOrientations();
+
+    SetInitialCameraOrientationL();
+
+    iVolCtrl= new ( ELeave )CVtUiVolumeControl(
+        Model().CommandHandler(),
+        Model().Audio(),
+        *iEventObserver,
+        *iFeatureManager);
+    iVolCtrl->ConstructL();
+
+    iIncallBubble = CAknIncallBubble::NewL();
+
+    iIsWaitingCallState = EFalse;
+    
+    __VTPRINTEXIT( "VtUi.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::~CVtUiAppUi
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::~CVtUiAppUi()
+    {
+    __VTPRINTENTER( "VtUi.~" )
+
+    iActiveCommands.Close();
+
+    delete iLayoutChangeCallback;
+    delete iAsyncCallback;
+
+    if ( iUiStates && iUiStates->IsBlankControlAdded() )
+        {
+        RemoveFromStack( iBlankControl );
+        }
+    TInt lightsValue = 0;
+    if ( RProperty::Get( KPSUidCoreApplicationUIs,
+            KLightsVTForcedLightsOn, lightsValue ) == KErrNone )
+        {
+        if ( lightsValue == EForcedLightsOn )
+            {
+            __VTPRINT( DEBUG_GEN, "VtUi.~ Good night!" )
+            (void) RProperty::Set(
+                KPSUidCoreApplicationUIs,
+                KLightsVTForcedLightsOn,
+                EForcedLightsOff );
+            }
+        }
+    delete iActiveExec;
+    delete iInstance;
+    delete iBlankControl;
+    // Delete volume control before its dependencies are deleted.
+    delete iVolCtrl;
+    delete iEventObserver;
+    delete iExitTimer;
+    // Featuremanager must be destructed
+    // before componentmanager and commandmanager
+    delete iFeatureManager;
+    delete iComponentManager;
+    delete iCommandManager;
+    delete iUiStates;
+
+    if ( iTbPeriodic )
+        {
+        iTbPeriodic->Cancel();
+        }
+    delete iTbPeriodic;
+
+    if ( iIncallBubble )
+        {
+        TRAP_IGNORE( iIncallBubble->SetIncallBubbleAllowedInUsualL( ETrue ) )    
+        }
+    delete iIncallBubble;
+
+    // Close all RComm sessions to prevent memory leaks.
+    REComSession::FinalClose();
+
+    FeatureManager::UnInitializeLib();
+    __VTPRINTEXIT( "VtUi.~" )
+    VTLOGUNINIT
+    }
+
+// -----------------------------------------------------------
+// CVtUiAppUi::SwitchLayoutToFlatStatusPaneL
+// -----------------------------------------------------------
+//
+void CVtUiAppUi::SwitchLayoutToFlatStatusPaneL( TBool aSwitch )
+    {
+    __VTPRINTENTER( "VtUi.SwitchLayoutToFlatStatusPaneL" )
+    CEikStatusPane* statusPane = StatusPane();
+
+    const TInt idleResId(
+        VtUiLayout::IsLandscapeOrientation() ?
+            R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL :
+                R_AVKON_STATUS_PANE_LAYOUT_USUAL );
+
+    const TBool isStatusPaneFlat(
+        ( statusPane->CurrentLayoutResId() ==
+            R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ) ||
+        ( statusPane->CurrentLayoutResId() ==
+            R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ) );
+
+    if ( aSwitch )
+        {
+        if ( isStatusPaneFlat && VtUiLayout::IsLandscapeOrientation() )
+            {
+            __VTPRINT( DEBUG_GEN,
+                "VtUi.SwitchLayoutToFlatStatusPaneL LAYOUT USUAL" );
+            NaviPaneL()->Pop();
+            statusPane->SwitchLayoutL( idleResId );
+            }
+        else if ( !isStatusPaneFlat && !VtUiLayout::IsLandscapeOrientation() )
+            {
+            __VTPRINT( DEBUG_GEN,
+                "VtUi.SwitchLayoutToFlatStatusPaneL USUAL FLAT" );
+            NaviPaneL()->PushDefaultL();
+            statusPane->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT );
+            }
+        }
+    else
+        {
+        if ( isStatusPaneFlat )
+            {
+            __VTPRINT( DEBUG_GEN,
+                "VtUi.SwitchLayoutToFlatStatusPaneL LAYOUT IDLE" );
+            NaviPaneL()->Pop();
+            statusPane->SwitchLayoutL( idleResId );
+            }
+        }
+    // ApplyCurrentSettingsL is called whenever statuspane
+    // visibility status or pane layout changes.
+    statusPane->ApplyCurrentSettingsL();
+    statusPane->DrawNow();
+    // Make sure whole control is fully updated
+    iInstance->iMainControl->DrawNow();
+    __VTPRINTEXIT( "VtUi.SwitchLayoutToFlatStatusPaneL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshL()
+    {
+    __VTPRINTENTER( "VtUi.Refresh" )
+    RefreshBlind();
+    RefreshNaviPaneL();    
+    __VTPRINTEXIT( "VtUi.Refresh" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshNaviPaneL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshNaviPaneL()
+    {
+    // Update only if navi pane exists
+    if ( iInstance )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.RefreshNavi" )
+        CVtUiNaviPane* navi = iInstance->iNaviPane;
+
+        // Refresh muted state
+        MVtEngMedia& media = Model().Media();
+        TInt mediaAvail;
+        VtUiUtility::GetOutgoingMediaState( media, mediaAvail );
+        mediaAvail = ~mediaAvail;
+        navi->SetMuted( mediaAvail & MVtEngMedia::EMediaAudio );
+
+        // Refresh call duration
+        MVtEngSessionInfo& session = Model().Session();
+        MVtEngSessionInfo::TDuration duration;
+        TBool enabled;
+        if ( session.GetDuration( duration, enabled ) != KErrNone )
+            {
+            enabled = EFalse;
+            }
+        navi->SetCallDuration( duration, enabled );
+
+        // Update all changes
+        navi->CommitL();
+
+        CheckBeatL( enabled );
+        }
+    }
+
+void CVtUiAppUi::StopBrightnessOrContrast()
+    {
+    
+    MVtUiFeature* br = iFeatureManager->GetFeatureById( EVtUiFeatureIdBrightness );
+    if ( br )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.StopBrightness" )
+        if ( br->State() ==  MVtUiFeature::EActive )
+            {
+            __VTPRINT( DEBUG_GEN, "VtUi.StopBrightnessOrContrast br->STOP" )
+            br->Stop();
+            }
+        }
+    
+    MVtUiFeature* cr = iFeatureManager->GetFeatureById( EVtUiFeatureIdContrast );
+    if ( cr )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.StopContrast" )
+        if ( cr->State() ==  MVtUiFeature::EActive )
+           {
+           __VTPRINT( DEBUG_GEN, "VtUi.StopBrightnessOrContrast cr->STOP" )
+           cr->Stop();
+           }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshZoomPopupL()
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshZoomPopupL()
+    {
+    CVtUiZoom* zm = static_cast< CVtUiZoom* >(
+            iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom ) );
+    if( zm && iUiStates->IsZoomModeOn())
+        zm->RefreshL();
+    }
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshMenuL()
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshMenuL()
+    {
+    
+    CVtUiMenus* menus = static_cast< CVtUiMenus* >(
+            iFeatureManager->GetFeatureById( EVtUiFeatureIdMenu ) );
+    if ( menus )
+    {
+        iUiStates->Update();
+        __VTPRINT( DEBUG_GEN, "VtUi.RefreshMenuL" )
+        menus->RefreshL();
+        CAknAppUi::ProcessCommandL( EEikCmdCanceled ); // does not leave
+        }
+    }
+              
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshSoftkeysL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshSoftkeysL()
+    {
+    if ( iUiStates->IsThisApplicationForeground() )
+        {
+        CVtUiSoftkeys* sk = static_cast< CVtUiSoftkeys* >(
+            iFeatureManager->GetFeatureById( EVtUiFeatureIdSoftkey ) );
+        if ( sk )
+            {
+            sk->RefreshL();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshBlind
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshBlind()
+    {
+    if ( iInstance && !iUiStates->IsDisableBlindSetting() )
+        {
+        __VTPRINTENTER( "VtUi.RefreshBlind" )
+        TInt avail;
+        MVtEngMedia& media = Model().Media();
+
+        // Update blind flags.for outgoing media:
+        VtUiUtility::GetOutgoingMediaState( media, avail );
+        avail = ~avail;
+        TBool noVideo( avail & MVtEngMedia::EMediaVideo );
+        const TBool isFrozen( VtUiUtility::GetFreezeState ( media ) );
+        MVtEngMedia::TMediaSource source( MVtEngMedia::EMediaNone );
+        media.GetSource( source );
+        if ( noVideo && !isFrozen &&
+            ( source != MVtEngMedia::EMediaStillImage ) )
+            {
+            iUplinkWindow->SetStreamBitmap( NULL );
+            }
+
+        iUplinkWindow->SetBlind( noVideo );
+        iUplinkWindow->SetWaiting( EFalse );
+
+        if ( iUiStates->IsThisApplicationForeground() )
+            {
+            // Update blind flags for incoming media:
+            VtUiUtility::GetIncomingMediaState( media, avail );
+            avail = ~avail;
+            noVideo = ( avail & MVtEngMedia::EMediaVideo );
+            if ( noVideo )
+                {
+                iDownlinkWindow->SetStreamBitmap( NULL );
+                }
+            iDownlinkWindow->SetBlind( noVideo );
+            }
+        iDownlinkWindow->SetWaiting( iUiStates->IsWaitingForFirstFrame() );
+        __VTPRINTEXIT( "VtUi.RefreshBlind" )
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::OpenNumberEntryL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::OpenNumberEntryL()
+    {
+    __VTPRINTENTER( "VtUi.OpenNumberEntryL" )
+
+    CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar();
+    if ( IsDisplayingDialog() || ( menuBar && menuBar->IsDisplayed() ) )
+        {
+        __VTPRINTEXIT( "VtUi.OpenNumberEntryL" )
+        return EFalse;
+        }
+
+    TInt error( KErrNotFound );
+
+    MVtUiFeature* numberEntry =
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdNumberEntry );
+
+    MVtUiFeature* dialer =
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer );
+
+    const TBool dialerActive( dialer &&
+        ( dialer->State() == MVtUiFeature::EActive ) );
+
+    if ( numberEntry && !dialerActive )
+        {
+        TRAP( error, numberEntry->StartL() );
+        }
+
+    const TBool result( !error );
+
+    if ( result )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.NumberEntry.StopZ" )
+        RefreshSoftkeysL();
+        }
+
+    __VTPRINTEXITR( "VtUi.OpenNumberEntryL %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandlePhoneSendKeyL
+// Handles EKeyPhoneSend key events.
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CVtUiAppUi::HandlePhoneSendKeyL( const TKeyEvent& /*aKeyEvent*/,
+    TEventCode aType )
+    {
+    __VTPRINTENTER( "VtUi.HandlePhoneSendKeyL" )
+    CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar();
+    if ( !( IsDisplayingDialog() || ( menuBar && menuBar->IsDisplayed() ) ) )
+        {
+        const TBool isNumberSource( iUiStates->IsNumberEntryOpen() ||
+            iUiStates->IsDialerOpen() );
+        if ( ( aType == EEventKey ) && isNumberSource )
+            {
+            ProcessCommandL( EVtUiCmdDialEmergency );
+            }
+        }
+    __VTPRINTEXIT( "VtUi.HandlePhoneSendKeyL" )
+    return EKeyWasConsumed;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::StartDtmfTone
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::StartDtmfTone( const TChar& aTone )
+    {
+    // should be called only through current application state
+    iDtmfTone = aTone;
+    __VTPRINT2( DEBUG_GEN, "VtUi.DTMF.Start.%d", iDtmfTone() )
+    if ( Execute( KVtEngStartDtmfTone, &iDtmfTone ) != KErrNone )
+        {
+        iDtmfTone = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::StopDtmfTone
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::StopDtmfTone()
+    {
+    // should be called only through current application state
+    if ( iDtmfTone() )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.DTMF.STOP" )
+        (void) Execute( KVtEngStopDtmfTone, NULL );
+        iDtmfTone = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleWsEventL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleWsEventL(
+        const TWsEvent& aEvent,
+        CCoeControl* aDestination )
+    {
+    __VTPRINTENTER( "VtUi.HandleWsEventL" )
+    const TInt type = aEvent.Type();
+    __VTPRINT2( DEBUG_GEN, "VtUi.HandleWsEventL type = %d", type );
+
+    // Zoom-in and Zoom-out keys need specific handling because keyup and
+    // keydown events cannot be checked from iCode field of TKeyEvent
+    if ( PreHandleKeyEventL( aEvent ) )
+        {
+        __VTPRINTEXIT( "VtUi.HandleWsEventL (PreHandleKeyEventL)" )
+        return;
+        }
+
+    // Zoom mode is dismissed if some interrupting event happens prior timeout.
+    // Zoom mode can be interrupted with a  keypress i.e. any keypress, except
+    // keys that are reserved for adjusting zoom dismiss zoom mode. Also any
+    // system event e.g. note or waiting call dismiss zoom mode.
+    if ( iUiStates->IsZoomModeOn() )
+        {
+        if ( ProcessWsEventIfZoomModeIsActiveL( aEvent ) )
+            {
+            __VTPRINTEXIT( "VtUi.HandleWsEventL (IsZoomModeOn)" )
+            return;
+            }
+        }
+    // Zoom mode can be also activated with up and down arrow keys.
+    switch ( type )
+        {
+        case EEventKey:
+        case EEventKeyUp:
+        case EEventKeyDown:
+            {
+            const TKeyEvent* keyEvent = aEvent.Key();
+            const TBool isHwZoomKey(
+                keyEvent->iCode == EKeyZoomIn ||
+                keyEvent->iCode == EKeyZoomOut );
+            const TBool isZoomKey(
+                keyEvent->iScanCode == EStdKeyUpArrow ||
+                keyEvent->iScanCode == EStdKeyDownArrow ||
+                isHwZoomKey );
+
+            // Zoom mode can be also activated with up and down arrow keys.
+            if ( isZoomKey )
+                {
+                const TBool isZoomAllowed(
+                    !iEikonEnv->AppUiFactory()->MenuBar()->IsDisplayed() &&
+                    !iUiStates->MediaState().IsSharing() &&
+                    !iUiStates->MediaState().IsFrozen() &&
+                    !iUiStates->IsSelectingShare() &&
+                    VtUiUtility::IsZoomAllowed( Model().Media() ) &&
+                    !( iUiStates->IsNumberEntryOpen() && ShowNumberEntry() ) &&
+                    //there must not be the command which may switch provider to None
+                    !IsActiveCommand( EVtUiCmdDisableVideo )&&
+                    !IsActiveCommand( EVtUiCmdDisableBoth )&&
+                    !IsActiveCommand( EVtUiCmdUsePrimaryCamera )&&
+                    !IsActiveCommand( EVtUiCmdUseSecondaryCamera) );
+
+                if ( isZoomAllowed )
+                    {
+                     // If menu is open, toolbar is available, video is frozen,
+                     // sharing is on or user is selecting a file to be shared
+                     // do not set zoom mode on. If HW zoom key was pressed,
+                     // then zoom mode is activated even if toolbar is present.
+                    if ( isHwZoomKey || !iUiStates->IsToolbarAvailable() )
+                        {
+                        SetZoomModeL( ETrue );
+                        }
+                    }
+                }
+            }
+            break;
+        default:
+            break;
+        }
+
+    TBool partialForeGroundlost( EFalse );
+    switch ( type )
+        {
+        // Enter new rendering mode
+        case EVtUiWsEventBeginRenderingMode:
+            {
+            const TVtUiWsEvent< TRenderingMode >& event(
+               static_cast< const TVtUiWsEvent< TRenderingMode >& >
+                ( aEvent ) );
+            MVtUiDialer* dialer =  static_cast< CVtUiDialer* > (
+                iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ) );
+            __ASSERT_ALWAYS( dialer,
+                VtUiPanic::Panic( EVtUiPanicRendererNotFound ) );
+            iInstance->iContextControl->MakeVisible( EFalse );
+            SetRenderingModeL( *event.Data(), &dialer->VideoWindow() );
+            }
+            break;
+
+        // End rendering mode -> revert to previous
+        case EVtUiWsEventEndRenderingMode:
+            {
+            SetRenderingModeL( ERenderingModeDefault, iStoredDownlinkWindow );
+            iInstance->iContextControl->MakeVisible( ETrue );
+            iStoredDownlinkWindow = NULL;
+            }
+            break;
+
+        // New number source have been activated
+        case EVtUiWsEventNumberSourceActivate:
+            {
+            const TVtUiWsEvent< MVtUiNumberSource >& event(
+               static_cast< const TVtUiWsEvent< MVtUiNumberSource >& >
+                ( aEvent ) );
+            iNumberSource = event.Data();
+            }
+            break;
+
+        case EVtUiWsEventNumberSourceDeactivate:
+            {
+            const TVtUiWsEvent< MVtUiNumberSource >& event(
+               static_cast< const TVtUiWsEvent< MVtUiNumberSource >& >
+                ( aEvent ) );
+            if ( iNumberSource == event.Data() )
+                {
+                iNumberSource = NULL;
+                }
+            }
+            break;
+
+
+        // VT goes background e.g. selected application from fastswap
+        case KAknFullOrPartialForegroundLost:
+            {
+            // If capture mode is on stop it
+            if ( iUiStates->IsCaptureModeOn() )
+                {
+                CmdCancelCaptureL();
+                }
+            SetIncallBubbleAllowedInUsualL( ETrue );
+            const TInt windowGroupId =
+                iCoeEnv->WsSession().GetFocusWindowGroup();
+
+            // In S60 5.0 we get PartialFocusLost also for some notes and
+            // overally items that are somehow overlapping screen instead of
+            // FocusLost. In those cases we should not put app to background.
+            if( ( windowGroupId != iThisApplicationWgId ) &&
+                ( windowGroupId != iEikonServerWgId ) &&
+                ( windowGroupId != iAknCapServerWgId ) &&
+                ( windowGroupId != iAknNfyServerWgId ) )
+                {
+                partialForeGroundlost = ETrue;
+                }
+
+            // Fall through to EEventFocusLost event
+            }
+        case EEventFocusLost:
+            {
+            // If focus window group is not this application nor window server,
+            // then this application can not be in focus.
+            const TInt windowGroupId =
+                iCoeEnv->WsSession().GetFocusWindowGroup();
+
+            if ( ( windowGroupId != iThisApplicationWgId ) &&
+                 ( windowGroupId != iEikonServerWgId ) &&
+                 ( windowGroupId != iAknCapServerWgId ) &&
+                 ( windowGroupId != iAknNfyServerWgId ) || partialForeGroundlost )
+                {
+                iCoeEnv->RootWin().DisableFocusChangeEvents();
+
+                TBool old = iUiStates->IsThisApplicationForeground();
+                if ( old )
+                    {
+                    TRAP_IGNORE( HandleForegroundChangedL( EFalse ) );
+                    }
+                }
+            }
+            break;
+
+        case KAknFullOrPartialForegroundGained:
+            {
+            SetIncallBubbleAllowedInUsualL( EFalse );
+            // Now this application is focused.
+            (void)iCoeEnv->RootWin().EnableFocusChangeEvents();
+            TBool old = iUiStates->IsThisApplicationForeground();
+
+            if ( !old )
+                {
+                (void) HandleLayoutChanged();
+                TRAP_IGNORE( HandleForegroundChangedL( ETrue ) );
+                }
+            }
+            break;
+
+        case EEventKey:
+        case EEventKeyUp:
+        case EEventKeyDown:
+            {
+            // Key events with EModifierSpecial are received via FEP.
+            const TKeyEvent* keyEvent = aEvent.Key();
+            if ( keyEvent->iModifiers & EModifierSpecial )
+                {
+                TChar dtmfTone;
+                if ( VtUiUtility::IsDTMFEvent( *keyEvent, dtmfTone ) )
+                    {
+                    if ( type == EEventKey )
+                        {
+                        StartDtmfTone( dtmfTone );
+                        }
+                    else if ( type == EEventKeyUp )
+                        {
+                        StopDtmfTone();
+                        }
+                    }
+                }
+            }
+            break;
+
+        default:
+            break;
+        }
+    // Offer event to component manager
+    iComponentManager->HandleWsEventL( aEvent, aDestination );
+
+    // All events are sent to base class.
+    CAknAppUi::HandleWsEventL( aEvent, aDestination );
+    __VTPRINTEXIT( "VtUi.HandleWsEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::PreHandleKeyEventL
+//
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::PreHandleKeyEventL( const TWsEvent& aEvent )
+    {
+    __VTPRINTENTER( "VtUi.PreHandleKeyEventL" )
+    TBool consumed( EFalse );
+    switch( aEvent.Type() )
+        {
+
+    case EEventKey:
+        {
+        // when both these are set, then it's our simulated key press
+        const TInt
+            modifiers( EModifierKeypad | EModifierSpecial );
+
+        const TKeyEvent* ptrKeyEventC =
+            aEvent.Key();
+
+        const TBool isHwZoomKey(
+            ptrKeyEventC->iCode == EKeyZoomIn ||
+            ptrKeyEventC->iCode == EKeyZoomOut );
+
+        if ( isHwZoomKey &&
+             ( ptrKeyEventC->iModifiers & modifiers ) != modifiers )
+            {
+            __VTPRINT3( DEBUG_GEN, "VtUi.PreHandleKeyEventL keyc=%d scanc=%d",
+                ptrKeyEventC->iCode, ptrKeyEventC->iScanCode )
+            consumed = ETrue;
+
+            // Send EEventKeyDown only when iRepeats is 0
+            if ( !ptrKeyEventC->iRepeats )
+                {
+                TKeyEvent keyDownEvent( *ptrKeyEventC );
+                keyDownEvent.iRepeats = 0;
+                iCoeEnv->SimulateKeyEventL( keyDownEvent, EEventKeyDown );
+                }
+
+            // Send EEventKey always
+            TKeyEvent keyEvent( *ptrKeyEventC );
+            keyEvent.iModifiers |= modifiers;
+            iCoeEnv->SimulateKeyEventL( keyEvent, EEventKey );
+
+            // Que EEventKeyUp
+            TKeyEvent keyUpEvent( *ptrKeyEventC );
+            keyUpEvent.iRepeats = 0;
+            StoreKeyEventL( keyUpEvent );
+            }
+        else if ( ( ptrKeyEventC->iModifiers & modifiers ) == modifiers )
+            {
+            __VTPRINT( DEBUG_GEN,
+                "VtUi.PreHandleKeyEventL own event spotted, removing mods" )
+            // event is generated by us, remove modifiers
+            TKeyEvent* ptrKeyEvent = const_cast< TKeyEvent* >( ptrKeyEventC );
+            ptrKeyEvent->iModifiers &= ~modifiers;
+            }
+        }
+        break;
+
+    case EEventKeyUp:
+        if ( iIsStoredKeyEvent )
+            {
+            if ( iStoredKeyEvent.iScanCode == aEvent.Key()->iScanCode )
+                {
+                consumed = ETrue;
+                SimulateStoredKeyEventL( EEventKeyUp );
+                }
+            }
+        break;
+
+    default:
+        break;
+
+        }
+
+    __VTPRINTEXITR( "VtUi.PreHandleKeyEventL %d", consumed )
+    return consumed;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SimulateStoredKeyEventL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SimulateStoredKeyEventL( const TEventCode aEventCode )
+    {
+    __VTPRINTENTER( "VtUi.SimulateStoredKeyEventL" )
+    if ( iIsStoredKeyEvent )
+        {
+        // Reset flag first because SimulateKeyEventL() is synchronous
+        iIsStoredKeyEvent = EFalse;
+        iCoeEnv->SimulateKeyEventL( iStoredKeyEvent, aEventCode );
+        }
+    __VTPRINTEXITR( "VtUi.SimulateStoredKeyEventL %d", iIsStoredKeyEvent )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::StoreKeyEventL
+//
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::StoreKeyEventL( const TKeyEvent& aKeyEvent )
+    {
+    __VTPRINTENTER( "VtUi.StoreKeyEventL" )
+    if ( iIsStoredKeyEvent && ( iStoredKeyEvent.iCode != aKeyEvent.iCode ) )
+        {
+        SimulateStoredKeyEventL( EEventKeyUp );
+        }
+
+    if ( !iIsStoredKeyEvent )
+        {
+        iIsStoredKeyEvent = ETrue;
+        iStoredKeyEvent = aKeyEvent;
+        }
+    __VTPRINTEXITR( "VtUi.StoreKeyEventL %d", iIsStoredKeyEvent )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DoTryToStartTb
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::DoTryToStartTbL( TAny* aAny )
+    {
+    CVtUiAppUi* self = static_cast< CVtUiAppUi* >( aAny );
+    self->TryToStartTbL();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::UpdateVBSettingL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::UpdateVBSettingL()
+    {
+    // If white balance or color tone setting
+    // feauture exists update setting
+    CVtUiWhiteBalance* wb = static_cast< CVtUiWhiteBalance* >(
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdWhiteBalance ) );
+
+    CVtUiColorTone* ct = static_cast< CVtUiColorTone* >(
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdColourTone ) );
+
+    // If brightness or contrast slider
+    // feauture exists update them
+    CVtUiBrightness* br = static_cast< CVtUiBrightness* >(
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdBrightness ) );
+    
+    CVtUiContrast* contr = static_cast< CVtUiContrast* >(
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdContrast ) );
+    
+
+    
+    if ( wb && iUiStates->IsWhiteBalanceSettingAvailable() )
+        {
+        __VTPRINT( DEBUG_GEN,"VtUi.UpdateVBSettingL WB update" )
+        wb->UpdateSettingL();
+        }
+
+    if ( ct && iUiStates->IsColorToneSettingAvailable() )
+        {
+        __VTPRINT( DEBUG_GEN,"VtUi.UpdateVBSettingL CT update" )
+        ct->UpdateSettingL();
+        }
+    
+    if ( br && iUiStates->IsBrightnessSettingAvailable() )
+        {
+        __VTPRINT( DEBUG_GEN,"VtUi.UpdateVBSettingL br update" )
+        br->UpdateSlider();
+        }
+    
+    if ( contr && iUiStates->IsContrastSettingAvailable() )
+        {
+        __VTPRINT( DEBUG_GEN,"VtUi.UpdateVBSettingL contract update" )
+        contr->UpdateSlider();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::TryToStartTb
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::TryToStartTbL()
+    {
+    __VTPRINTENTER( "VtUi.TryToStartTbL" )
+    CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >(
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) );
+    if ( tb )
+        {
+        // If menu, dialog or dialer is displayed do not start the toolbar,
+        // but let the timer run another round
+        CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar();
+        if ( !( menuBar && menuBar->IsDisplayed() ) &&
+             !IsDisplayingDialog() &&
+             !(
+                iUiStates->IsDialerActivating() ||
+                iUiStates->IsDialerOpen() ||
+                iUiStates->IsWhiteBalanceModeOn() ||
+                iUiStates->IsColorToneModeOn()  ||
+                iUiStates->IsBrightnessModeOn()  ||
+                iUiStates->IsContrastModeOn()  ||
+                iUiStates->IsZoomModeOn() ||
+                iUiStates->IsVolumeModeOn() ||
+                iUiStates->IsCaptureModeOn() )
+                )
+            {
+            if ( iTbPeriodic )
+                {
+                iTbPeriodic->Cancel();
+                }
+            tb->StartL();
+            }
+        }
+    __VTPRINTEXIT( "VtUi.TryToStartTbL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetRenderingModeL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetRenderingModeL( const TRenderingMode aMode,
+    MVtUiVideoWindow* aNewDownlink )
+    {
+    __VTPRINTENTER( "VtUi.SetRenderingModeL" )
+    __VTPRINT2( DEBUG_GEN, "VtUi.SetRenderingModeL=%d", aMode );
+    iRenderingMode = aMode;
+    if ( aNewDownlink )
+        {
+        if ( iDownlinkWindow != aNewDownlink )
+            {
+            iStoredDownlinkWindow = iDownlinkWindow;
+            iDownlinkWindow = aNewDownlink;
+            iStoredDownlinkWindow->SetRemoteVideoControl(NULL);
+            iDownlinkWindow->SetRemoteVideoControl(iInstance->iRemoteVideoControl);
+            iDownlinkWindow->LayoutRemoteVideo();
+            }
+        }
+    RefreshBlind();
+    UpdateRenderingParametersL();
+    __VTPRINTEXIT( "VtUi.SetRenderingModeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::UpdateRenderingParametersL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::UpdateRenderingParametersL()
+    {
+    __VTPRINTENTER( "VtUi.UpdateRenderingParametersL" )
+ 
+    MVtEngMedia& media = Model().Media();
+    const TBool viewFinderStarted =
+        media.RenderingStarted( MVtEngMedia::EMediaOutgoing );
+    const TBool remoteRenderStarted =
+        media.RenderingStarted( MVtEngMedia::EMediaIncoming );
+
+    // Clear bitmaps
+    iInstance->iContextControl->SetStreamBitmap( NULL );
+    iInstance->iMainControl->SetStreamBitmap( NULL );
+
+    // Stop viewfinder & remote render.
+    if( viewFinderStarted )
+        {
+        ExecuteCmdL( KVtEngStopViewFinder );
+        }
+    ExecuteCmdL( KVtEngStopRenderRemote );
+
+    const TBool uplinkWindowEqualsContextControl =
+        ( iUplinkWindow == iInstance->iContextControl );
+
+    // Prepare viewfinder.
+    TVtEngRenderingOptions configViewfinder(
+         uplinkWindowEqualsContextControl ?
+            DetermineContextControlOptions() :
+            DetermineMainControlOptions( EFalse ) );
+    ExecuteCmdL( KVtEngPrepareViewFinder, configViewfinder );
+
+    // Prepare remote render.
+    TRAPD ( err, {
+    TVtEngRenderingOptionsNGA configRemoteRenderNGA(
+            DetermineRemoteVideoControlOptionsNGA() );
+    ExecuteCmdL(
+            KVtEngPrepareRemoteRenderNGA,
+                configRemoteRenderNGA );
+    } );
+    if ( err != KErrNone )
+        {
+        if ( viewFinderStarted )
+            {
+            // Start viewfinder.
+            ExecuteCmdL( KVtEngStartViewFinder );
+            }
+        User::Leave ( err );
+        }
+        
+    // Start remote render.
+    TRAP_IGNORE( ExecuteCmdL( KVtEngStartRenderRemote ) );
+
+    if ( viewFinderStarted )
+        {
+        // Start viewfinder.
+        ExecuteCmdL( KVtEngStartViewFinder );
+        }
+
+    // Redraw remote video last frame to make sure that in layout change
+    // situation we still have something on screen.
+    iDownlinkWindow->Redraw();
+    __VTPRINTEXIT( "VtUi.UpdateRenderingParametersL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::MediaStateChangedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::MediaStateChangedL()
+    {
+    CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar();
+    // close menu if it is shown
+    if ( menuBar && menuBar->IsDisplayed() )
+        {
+        TKeyEvent keyEvent;
+        keyEvent.iCode =  EKeyEscape;
+        menuBar->OfferKeyEventL( keyEvent, EEventKey );
+        }
+    // Refresh toolbar
+    CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >(
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) );
+    if ( tb )
+        {
+        tb->RefreshL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ProcessCommandL
+// Processes commands.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ProcessCommandL(
+        TInt aCommand )
+    {
+    __VTPRINTENTER( "VtUi.ProcessCommandL" )
+    MVtEngCommandHandler& command = Model().CommandHandler();
+    command.ExecuteL( KVtEngRequestLastRemoteFrame, NULL );
+    
+    // only with fixed toolbar
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+        if ( iUiStates->IsFixedToolbarVisible())
+            {
+            // When option menu is opened fixed toolbar should
+            // be set hidden
+            iUiStates->SetIsFixedToolbarVisible( EFalse );
+            // Stop toolbar
+            MVtUiFeature* tb =
+            iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar );
+            if ( tb )
+                {
+                // timer could be active
+                if ( iTbPeriodic )
+                    {
+                    iTbPeriodic->Cancel();
+                    }
+                tb->Stop();
+                }
+            if ( !iTbPeriodic )
+                {
+                iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+                }
+            // Toolbar doesn't come visible until options menu is closed.
+            iTbPeriodic->Start( KStartTime, KPeriodTime, TCallBack( DoTryToStartTbL, this ) );
+            }
+        }
+    else
+        {
+        StopSliders(); 
+        }
+
+    iInstance->iMainControl->SetSize( iInstance->iMainControl->Size() );
+    iInstance->iMainControl->DrawNow();
+        
+    // Handle OK options menu.
+    const TInt menuResource =
+        iUiStates->IsLaunchOkOptionsMenu() ?
+            R_VIDEOTELUI_OK_MENUBAR :
+            R_VIDEOTELUI_MENUBAR;
+
+    iUiStates->SetLaunchOkOptionsMenu( EFalse );
+
+    CEikMenuBar* menu = iEikonEnv->AppUiFactory()->MenuBar();
+    if ( menu )
+        {
+        menu->SetMenuTitleResourceId( menuResource );
+        //Here we again set back the type of menu to "Options" when pressed LSK
+        menu->SetMenuType( CEikMenuBar::EMenuOptions );
+        }
+    CAknAppUi::ProcessCommandL( aCommand );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::IsActiveCommand
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::IsActiveCommand( TInt aCommand ) const
+    {
+    return ( iActiveCommands.FindInOrder( aCommand ) != KErrNotFound );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::State
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase& CVtUiAppUi::State()
+    {
+    return *iState;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::BitmapManager
+// -----------------------------------------------------------------------------
+//
+CVtUiBitmapManager& CVtUiAppUi::BitmapManager()
+    {
+    return *iInstance->iBitmapManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::TActiveCommand::TActiveCommand
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::TActiveCommand::TActiveCommand(  RArray< TInt >& aActiveCommands,
+    TInt aCommandId )
+    : iActiveCommands( aActiveCommands ), iCommandId( aCommandId )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::TActiveCommand::~TActiveCommand
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::TActiveCommand::~TActiveCommand()
+    {
+    Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::TActiveCommand::OpenL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::TActiveCommand::OpenL()
+    {
+    iActiveCommands.InsertInOrderL( iCommandId );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::TActiveCommand::Close
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::TActiveCommand::Close()
+    {
+    TInt index( iActiveCommands.FindInOrder( iCommandId ) );
+    if ( index != KErrNotFound )
+        {
+        iActiveCommands.Remove( index );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleCommandL
+// Handles commands.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleCommandL(
+        TInt aCommand )
+    {
+    __VTPRINTENTER( "VtUi.HandleCommand" )
+
+    // Check if same command is already being performed.
+    if ( IsActiveCommand( aCommand ) || ( iState &&
+         iState->HandleCommandL( aCommand ) ==
+         TVtUiAppStateBase::EEventHandled ) )
+        {
+        __VTPRINTEXIT( "VtUi.HandleCommand <silently ignoring> 0" )
+        return;
+        }
+
+    // Check if command is allowed to be performed.
+    if ( !IsCommandAllowedL( aCommand ) )
+        {
+        ShowNotAllowedNoteL();
+        __VTPRINTEXITR( "VtUi.HandleCommand %d", KErrAccessDenied )
+        return;
+        }
+
+    // delay mute cmd received during layout change (EGWG-7QQ3GZ)
+    if ( (aCommand == EVtUiCmdDisableAudio) || (aCommand == EVtUiCmdUsePrimaryCamera)
+            ||(aCommand == EVtUiCmdUseSecondaryCamera)
+            ||(aCommand == EVtUiCmdDisableVideo) )
+        {
+        if ( iLayoutChg )
+            {
+            iDelayedCmd = aCommand;
+            __VTPRINTEXIT( "VtUi.HandleCommand mute delayed due to LayoutChange" )
+            return;
+            }
+        }
+    
+    TActiveCommand activeCommand( iActiveCommands, aCommand );
+    // Close() will be called by the destructor, when instance goes out of
+    // scope
+    activeCommand.OpenL();
+
+    TBool refresh = EFalse;
+    CleanupPushRefreshL();
+
+    // Execute command
+    switch ( aCommand )
+        {
+        case EAknCmdHelp:
+            CmdHelpL();
+            break;
+
+        case EVtUiCmdOkOptions:
+            iUiStates->SetLaunchOkOptionsMenu( ETrue );
+            ProcessCommandL( EAknSoftkeyOptions );
+            break;
+
+        case EVtUiCmdEnableMain:
+        case EVtUiCmdDisableMain:
+            // Submenu is opened automatically.
+            break;
+
+        case EVtUiCmdEnableVideo:
+            {
+            MVtEngMedia::TShareObjectState shareObjectState;
+            VtUiUtility::GetObjectSharingState( Model().Media(),
+            		                            shareObjectState );
+            if( shareObjectState != MVtEngMedia::ESharingImage )
+                {
+                refresh = ETrue;
+                EnableCommandActivatingAndCleanupPushL();
+                CmdEnableVideoL();
+                CleanupStack::PopAndDestroy();
+                }
+            else
+                {
+                CmdStopShareImageL( refresh );
+                EnableCommandActivatingAndCleanupPushL();
+                CmdEnableVideoL();
+                CleanupStack::PopAndDestroy();
+                }
+            }
+            break;
+
+        case EVtUiCmdEnableAudio:
+            refresh = ETrue;
+            CmdEnableAudioL();
+            break;
+
+        case EVtUiCmdEnableBoth:
+            EnableCommandActivatingAndCleanupPushL();
+            CmdEnableAudioL();
+            MVtEngMedia::TShareObjectState shareObjectState;
+            VtUiUtility::GetObjectSharingState( Model().Media(),
+            									shareObjectState );
+            if( shareObjectState != MVtEngMedia::ESharingImage )
+                {
+                refresh = ETrue;
+                CmdEnableVideoL();
+                }
+            else
+                {
+                CmdStopShareImageL( refresh );
+                CmdEnableVideoL();
+                }
+            // EnableCommandActivatingAndCleanupPushL
+            CleanupStack::PopAndDestroy();
+            break;
+
+        case EVtUiCmdDisableVideo:
+            refresh = ETrue;
+            EnableCommandActivatingAndCleanupPushL();
+            CmdDisableVideoL();
+            CleanupStack::PopAndDestroy();
+            break;
+
+        case EVtUiCmdDisableAudio:
+            refresh = ETrue;
+            EnableCommandActivatingAndCleanupPushL();
+            CmdDisableAudioL();
+            CleanupStack::PopAndDestroy();
+            break;
+
+        case EVtUiCmdDisableBoth:
+            HandleCommandL( EVtUiCmdDisableAudio );
+            HandleCommandL( EVtUiCmdDisableVideo );
+            break;
+
+        case EVtUiCmdActivateBT:
+            refresh = ETrue;
+            EnableCommandActivatingAndCleanupPushL();
+            CmdActivateBtL();
+            CleanupStack::PopAndDestroy();
+            break;
+
+        case EVtUiCmdDeactivateBT:
+            refresh = ETrue;
+            EnableCommandActivatingAndCleanupPushL();
+            CmdDeactivateBtL();
+            CleanupStack::PopAndDestroy();
+            break;
+
+        case EVtUiCmdActivateLoudspeaker:
+        case EVtUiCmdSwitchFromBTToIHF:
+            refresh = ETrue;
+            EnableCommandActivatingAndCleanupPushL();
+            CmdActivateLoudspeakerL();
+            CleanupStack::PopAndDestroy();
+            break;
+
+        case EVtUiCmdDeactivateLoudspeaker:
+            refresh = ETrue;
+            EnableCommandActivatingAndCleanupPushL();
+            CmdDeactivateLoudspeakerL();
+            CleanupStack::PopAndDestroy();
+            break;
+
+        case EVtUiCmdUsePrimaryCamera:
+            refresh = ETrue;
+            CmdUseCameraL( ETrue );
+            break;
+
+        case EVtUiCmdUseSecondaryCamera:
+            refresh = ETrue;
+            CmdUseCameraL( EFalse );
+            break;
+
+        case EVtUiCmdSwapImagesPlaces:
+            refresh = ETrue;
+            CleanupPushEnableBlindL();
+            iUiStates->SetDisableBlindSetting( ETrue );
+            CmdSwapImagesPlacesL();
+            CleanupStack::PopAndDestroy(); // CleanupPushEnableBlindL
+            break;
+
+        case EVtUiCmdZoom:
+            refresh = ETrue;
+            // Toolbar uses this same command to set zoom on and off
+            // therefore this works as a toggle button
+            SetZoomModeL( !iUiStates->IsZoomModeOn() );
+
+            break;
+
+        case EAknSoftkeyBack:
+            {
+            refresh = ETrue;
+            MVtUiFeature* numberEntry =
+                iFeatureManager->GetFeatureById( EVtUiFeatureIdNumberEntry );
+            if ( numberEntry )
+                {
+                numberEntry->Stop();
+                }
+            }
+            break;
+
+        case EVtUiCmdSnapshot:
+            EnableCommandActivatingAndCleanupPushL();
+            CmdSnapshotL();
+            // EnableCommandActivatingAndCleanupPushL
+            CleanupStack::PopAndDestroy();
+            break;
+
+        case EVtUiCmdCapture:
+            CmdCaptureL();
+            break;
+
+        case EVtUiCmdCancelCapture:
+            CmdCancelCaptureL();
+            break;
+
+        case EVtUiCmdGoToIdle:
+            CmdGoToIdleL();
+            break;
+
+        // Object sharing related
+
+        case EVtUiCmdShareObjectImage:
+            CmdInitializeShareImageL( refresh );
+            break;
+
+        case EVtUiCmdStopSharingObjectImage:
+            EnableCommandActivatingAndCleanupPushL();
+            CmdStopShareImageL( refresh );
+            // EnableCommandActivatingAndCleanupPushL
+            CleanupStack::PopAndDestroy();
+            break;
+
+        case EVtUiCmdAdjustVideoVideoQuality:
+        case EVtUiCmdAdjustVideoWhiteBalance:
+        case EVtUiCmdAdjustVideoBrightness:
+        case EVtUiCmdAdjustVideoContrast:
+        case EVtUiCmdAdjustVideoColourTone:
+        __VTPRINT( DEBUG_GEN, "VtUiHandleCommand.CmdAdjustVideoL" );
+            CmdAdjustVideoL( aCommand );
+            break;
+
+        case EAknSoftkeyExit:
+        case EAknCmdExit:
+        case EEikCmdExit:
+            // handled by state
+            break;
+
+        default:
+            iCommandManager->HandleCommandL( aCommand );
+            break;
+        }
+
+    if ( refresh )
+        {
+        CleanupStack::PopAndDestroy(); // CleanupPushRefreshL
+        }
+    else
+        {
+        CleanupStack::Pop(); // CleanupPushRefreshL
+        }
+    __VTPRINTEXITR( "VtUi.HandleCommand %d", KErrNone )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DynInitMenuPaneL
+// Initialises menu pane dynamically.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::DynInitMenuPaneL(
+        TInt,
+        CEikMenuPane* aMenuPane )
+    {
+    __VTPRINTENTER( "VtUi.DynInitMenuPaneL" )
+	
+    CVtUiMenus* menus = static_cast< CVtUiMenus* >(
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdMenu ) );
+    if ( menus )
+        {
+        iUiStates->Update();
+        menus->SetMenuPane( aMenuPane );
+        menus->RefreshL();
+        }
+	__VTPRINTEXIT( "VtUi.DynInitMenuPaneL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleKeyEventL
+// Handles key events.
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CVtUiAppUi::HandleKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType )
+    {
+    __VTPRINTENTER( "VtUi.HandleKeyEventL" )
+
+    TKeyResponse resp( EKeyWasNotConsumed );
+
+    if ( !iUiStates->IsNumberEntryOpen() ||
+         ( iUiStates->IsNumberEntryOpen() && !ShowNumberEntry() ) )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.ToZoom" )
+
+        const TBool isHwZoomKey( aKeyEvent.iCode == EKeyZoomIn ||
+            aKeyEvent.iCode == EKeyZoomOut );
+
+        // if outgoing video is frozen disable zoom
+        MVtEngMedia& media = Model().Media();
+        if ( VtUiUtility::GetFreezeState ( media ) )
+            {
+             if ( aKeyEvent.iScanCode == EStdKeyUpArrow ||
+                 aKeyEvent.iScanCode == EStdKeyDownArrow ||
+                 isHwZoomKey )
+                {
+                __VTPRINTEXITR( "VtUi.HandleKeyEventL %d", EKeyWasConsumed )
+                return EKeyWasConsumed;
+                }
+            }
+
+        // Handle volume up & down
+
+        }
+
+    // If key event it not yet consumed, offer it to component manager
+    if ( resp == EKeyWasNotConsumed )
+        {
+        resp = iComponentManager->OfferKeyEventL( aKeyEvent, aType );
+        }
+
+    __VTPRINTEXITR( "VtUi.HandleKeyEventL %d", resp )
+    return resp;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleResourceChangeL
+// Handles change of a resource.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleResourceChangeL(
+        TInt aType )
+    {
+    __VTPRINTENTER( "VtUi.HandleResourceChangeL" )
+    const TBool layoutChange =
+        aType == KEikDynamicLayoutVariantSwitch ||
+        aType == KAknsMessageSkinChange;
+    if ( iInstance && layoutChange )
+        {
+        iInstance->iBitmapManager->InvalidateBitmaps();
+        }
+
+    CAknAppUi::HandleResourceChangeL( aType );
+
+    if ( iInstance )
+        {
+        if ( layoutChange )
+            {
+            CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >(
+                iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) );
+            if( tb )
+                {
+                tb->HandleLayoutChangeL();
+                }
+            // Relayout controls
+            iBlankControl->SetRect( ClientRect() );
+            iInstance->LayoutChanged();
+            }
+        if ( iInstance->iNaviPane )
+            {
+            iInstance->iNaviPane->HandleResourceChange( aType );
+            }
+        if ( layoutChange )
+            {
+            (void) HandleLayoutChanged();
+            }
+        }
+
+    iComponentManager->HandleResourceChangeL( aType );
+
+    __VTPRINTEXIT( "VtUi.HandleResourceChangeL");
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleForegroundEventL
+// Handles foreground status change.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleForegroundEventL( TBool aForeground )
+    {
+    CAknAppUi::HandleForegroundEventL( aForeground );
+
+    if ( !aForeground )
+        {
+        StopDtmfTone();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::GetEikonEnv
+// -----------------------------------------------------------------------------
+//
+CEikonEnv* CVtUiAppUi::GetEikonEnv()
+    {
+    return iEikonEnv;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::GetCba
+// -----------------------------------------------------------------------------
+//
+CEikButtonGroupContainer* CVtUiAppUi::GetCba()
+    {
+    return iCba;
+    }
+
+//
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetZoomModeL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetZoomModeL( const TBool aEnableZoomMode,
+    const TBool aIsPermanent )
+    {
+    __VTPRINTENTER( "VtUi.SetZoomModeL" )
+    __VTPRINT2( DEBUG_GEN, "VtUi.SetZoomMo=%d", aEnableZoomMode  );
+    // If capture mode is on zoom mode cannot be changed
+    if ( iUiStates->IsCaptureModeOn() )
+        {
+        __VTPRINTEXIT( "VtUi.SetZoomModeL.CaptureOn" )
+        return;
+        }
+    CVtUiZoom* zoom = static_cast< CVtUiZoom* >(
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom ) );
+    if ( zoom )
+        {
+        if ( aEnableZoomMode )
+            {
+            if( aIsPermanent )
+                {
+                zoom->SetPermanenVisibility( aEnableZoomMode );
+                }
+            zoom->StartL();
+            }
+        else
+            {
+            if( aIsPermanent )
+                {
+                zoom->SetPermanenVisibility( aEnableZoomMode );
+                }
+            zoom->Stop();
+            }
+        }
+    iUiStates->SetZoomModeOn( aEnableZoomMode );
+    CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >(
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) );
+      if ( tb )
+        {
+        tb->RefreshL();
+        }
+
+    __VTPRINTEXIT( "VtUi.SetZoomModeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HelpContextL
+// Returns help context array.
+// -----------------------------------------------------------------------------
+//
+CArrayFix<TCoeHelpContext>* CVtUiAppUi::HelpContextL() const
+    {
+    CArrayFix<TCoeHelpContext>* array =
+        new ( ELeave ) CArrayFixFlat<TCoeHelpContext>( KVtUiHelpContextAmount );
+    CleanupStack::PushL( array );
+
+    array->AppendL(
+        TCoeHelpContext(
+            KVtUiTelephoneUid,
+            KINCAL_HLP_VIDEO_CALL ) );
+
+    CleanupStack::Pop( array );
+    return array;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecExecuteL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::ActiveExecExecuteL(
+        CVtUiActiveExec& /*aActiveExec*/,
+        const TInt aState,
+        TInt& aNextState,
+        TRequestStatus& aRequest )
+    {
+    return ActiveExecInitExecuteL(
+            aState,
+            aNextState,
+            aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecContinue
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::ActiveExecContinue(
+        CVtUiActiveExec& /*aActiveExec*/,
+        TInt& aState,
+        const TInt aError )
+    {
+    return ActiveExecInitContinue( aState, aError );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecCancel
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecCancel(
+        CVtUiActiveExec& /*aActiveExec*/,
+        TInt aState )
+    {
+    ActiveExecInitCancel( aState );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecDone
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecDone(
+        CVtUiActiveExec& /*aActiveExec*/,
+        const TInt aInitialState )
+    {    
+    ActiveExecInitDone( aInitialState );
+    }
+
+// state object service handlers
+
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShutdownL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShutdownL()
+    {
+    __VTPRINTENTER( "VtUi.ShutdownL" )
+    
+    CVtUiWhiteBalance* wb = static_cast< CVtUiWhiteBalance* >(
+            iFeatureManager->GetFeatureById( EVtUiFeatureIdWhiteBalance ) );
+    CVtUiColorTone* ct = static_cast< CVtUiColorTone* >(
+            iFeatureManager->GetFeatureById( EVtUiFeatureIdColourTone ) );
+    
+    if ( wb->State() == MVtUiFeature::EActive )
+        {
+        __VTPRINT( DEBUG_GEN, "CVtUiWhiteBalance::DoDeactivateL" );
+        wb->DoDeactivateL ();
+        }
+    if ( ct->State() == MVtUiFeature::EActive )
+        {
+        __VTPRINT( DEBUG_GEN, "CVtUiColorTone::DoDeactivateL" );
+        ct->DoDeactivateL( );            
+        }
+    
+    // close volume slider
+    CVtUiVolume* volume = static_cast< CVtUiVolume* >(
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume ) );
+    if ( volume )
+         {
+         volume->Stop();
+         }
+    // if capture mode is on stop the zoom
+    if ( iUiStates->IsCaptureModeOn() )
+        {
+        CVtUiZoom* zoom = static_cast< CVtUiZoom* >(
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom ) );
+        if ( zoom )
+            {
+            zoom->Stop();
+            }
+        }
+
+    iActiveExec->Start( EVtUiAppUiShutdown, *this );
+    __VTPRINTEXIT( "VtUi.ShutdownL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::StartupPhase1L
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::StartupPhase1L()
+    {
+    __VTPRINTENTER( "VtUi.StartupPhase1L" )
+    iActiveExec->Start( EVtUiAppUiStartup, *this );
+    __VTPRINTEXIT( "VtUi.StartupPhase1L" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::StartupPhase2L
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::StartupPhase2L()
+    {
+    __VTPRINTENTER( "VtUi.StartupPhase2L" )
+    iActiveExec->Start( EVtUiAppUiAnswered, *this );
+    __VTPRINTEXIT( "VtUi.StartupPhase2L" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ChangeState
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ChangeState( TVtUiAppStateBase* aState )
+    {
+    __VTPRINTENTER( "VtUi.ChangeState" )
+    iState = aState;
+    __VTPRINTEXIT( "VtUi.ChangeState" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::IsCommandAllowedL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::IsCommandAllowedL( const TInt aCommand )
+    {
+    return iCommandManager->IsCommandAllowedL( aCommand );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshDisabledFlagsL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshDisabledFlagsL()
+    {
+    // Refresh iDisabledFlags according to the current state.
+    TInt avail;
+    MVtEngMedia& media = Model().Media();
+    VtUiUtility::GetOutgoingMediaState( media, avail );
+    avail = ~avail;
+
+    iDisabledFlags = 0;
+    if ( avail & MVtEngMedia::EMediaAudio )
+        {
+        iDisabledFlags |= EDisabledAudio;
+        }
+    if ( avail & MVtEngMedia::EMediaVideo )
+        {
+        iDisabledFlags |= EDisabledVideo;
+        }
+
+    // If there are not cameras, then video options should be disabled.
+    if ( !VtUiUtility::HasCameras( media ) )
+        {
+        iDisabledFlags |= EVideoOptionsDisabled;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshCameraOptionAvailability
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshCameraOptionAvailability(
+        TBool& aUsePrimaryCameraNotAllowed,
+        TBool& aUseSecondaryCameraNotAllowed )
+    {
+    aUsePrimaryCameraNotAllowed = ETrue;
+    aUseSecondaryCameraNotAllowed = ETrue;
+
+    // Check sources caps and current camera to see which
+    // items should be included to the menu.
+
+    TInt sourcesCaps = 0;
+    MVtEngMedia& media = Model().Media();
+    (void) media.GetSourcesCaps( sourcesCaps );
+
+    MVtEngMedia::TCameraId cameraId;
+    const TBool hasCameraId =
+        ( media.GetCurrentCameraId( cameraId ) == KErrNone );
+
+    if ( hasCameraId )
+        {
+        // Camera is in use. Now selected camera is not included
+        // to the menu.
+        switch ( cameraId )
+            {
+            case MVtEngMedia::EPrimaryCamera:
+                sourcesCaps &=
+                    ~MVtEngMedia::ESourceCapsPrimaryCamera;
+                break;
+
+            case MVtEngMedia::ESecondaryCamera:
+                sourcesCaps &=
+                    ~MVtEngMedia::ESourceCapsSecondaryCamera;
+                break;
+
+            default:
+                sourcesCaps = 0;
+                break;
+            }
+        }
+    else
+        {
+        // If camera is not in use, then the "enable video" option
+        // will automatically use one of the existing cameras.
+        // However, if there are two cameras, then we need
+        // to include secondary to the menu.
+
+        const TInt bothCameras =
+            ( MVtEngMedia::ESourceCapsPrimaryCamera |
+            MVtEngMedia::ESourceCapsSecondaryCamera );
+        sourcesCaps &= ~bothCameras;
+        if ( sourcesCaps == bothCameras )
+            {
+            sourcesCaps &=
+                ~MVtEngMedia::ESourceCapsPrimaryCamera;
+            }
+        else
+            {
+            sourcesCaps = 0;
+            }
+        }
+
+    sourcesCaps = ~sourcesCaps;
+    aUsePrimaryCameraNotAllowed =
+        ( sourcesCaps & MVtEngMedia::ESourceCapsPrimaryCamera );
+    aUseSecondaryCameraNotAllowed =
+        ( sourcesCaps & MVtEngMedia::ESourceCapsSecondaryCamera );
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiAppUi::CmdCaptureL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdCaptureL()
+    {
+    //firstly need to know if underlying provider supports KVtEngFreeze
+    MVtEngCommandHandler& command = Model().CommandHandler();
+    const TInt caps = command.GetCommandCaps( KVtEngFreeze );
+    if ( (caps & MVtEngCommandHandler::EAttribEnabled) == 0)
+        {
+        return;
+        }
+    // end capture mode, image captured
+    iUiStates->SetCaptureModeOn( EFalse );
+    // end zoom mode
+    SetZoomModeL( EFalse, ETrue );
+    // freeze outgoing video
+    ExecuteCmdL( KVtEngFreeze );
+    RefreshBlind();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiAppUi::CmdSnapshotL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdSnapshotL()
+	{
+	__VTPRINTENTER( "VtUi.CmdSnapshotL" )
+	
+	// zoom mode must be set on before capture mode is set on
+    SetZoomModeL( ETrue, ETrue );
+
+	// if outgoing video is already frozen
+    MVtEngMedia& media = Model().Media();
+    const TBool isFrozen( VtUiUtility::GetFreezeState( media ) );
+    if ( isFrozen )
+    	{
+    	ExecuteCmdL( KVtEngUnfreeze );
+	    }
+	if ( !IsViewFinderInMainPane() )
+	    {
+	    SwitchViewFinderToMainPaneL( !isFrozen );
+	    }
+	else if ( !isFrozen )
+	    {
+	    iUiStates->SetViewFindersInitialPlaceContextPane( EFalse );
+	    }
+  
+    // set capture mode on
+
+    iUiStates->SetCaptureModeOn( ETrue );
+    RefreshStatesL();
+    RefreshBlind();
+    __VTPRINTEXIT( "VtUi.CmdSnapshotL" )
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiAppUi::CmdCancelCaptureL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdCancelCaptureL()
+    {
+    __VTPRINTENTER( "VtUi.CmdCancelCaptureL" )
+    // end capture mode, image capture canceled
+    iUiStates->SetCaptureModeOn( EFalse );
+    SetZoomModeL( EFalse, ETrue );
+    RefreshStatesL();
+	RestoreViewFinderL();
+    RefreshBlind();
+    __VTPRINTEXIT( "VtUi.CmdCancelCaptureL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdEnableVideoL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdEnableVideoL()
+    {
+	// if outgoing video is frozen
+    MVtEngMedia& media = Model().Media();
+    if ( VtUiUtility::GetFreezeState( media ) )
+    	{
+    	ExecuteCmdL( KVtEngUnfreeze );
+    	// swap images if needed
+        RestoreViewFinderL();
+    	}
+    else
+        {
+        ExecuteCmdL( KVtEngStopViewFinder );
+        iUplinkWindow->SetStreamBitmap( NULL );
+        MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaCamera;
+        ExecuteCmdL( KVtEngSetSource, source );
+        MVtEngMedia::TCameraId id;
+        if ( Model().Media().GetCurrentCameraId( id ) == KErrInUse )
+            {
+            ShowCameraInUseNoteL();
+            }
+        ExecuteCmdL( KVtEngStartViewFinder );
+        }
+    // update VB settings
+    UpdateVBSettingL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdEnableAudioL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdEnableAudioL()
+    {
+    ExecuteCmdL( KVtEngUnmuteOutgoingAudio );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdDisableVideoL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdDisableVideoL()
+    {
+    	
+		if( iUiStates->IsZoomModeOn() )
+	        {
+	        // if zoom feature is active, stop that
+	        MVtUiFeature* zm = iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom );
+	        if ( zm )
+	            {
+	            if ( zm->State() ==  MVtUiFeature::EActive )
+	                {
+	                __VTPRINT( DEBUG_GEN, "VtUi.CmdDisableVideoL zm->STOP" )
+	                zm->Stop();
+	                }
+	            }
+	        }
+    	
+    ExecuteCmdL( KVtEngStopViewFinder );
+
+    iUplinkWindow->SetStreamBitmap( NULL );
+
+    TInt err = KErrNotFound;
+    if ( VtUiUtility::HasStillImage( Model().Media() ) )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.:CmdDisableVideoL.HasStill" )
+        MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaStillImage;
+        TRAP( err, ExecuteCmdL( KVtEngSetSource, source ) );
+        }
+    if ( ( err != KErrNone ) )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.:CmdDisableVideoL.MediaNone" )
+        MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaNone;
+        ExecuteCmdL( KVtEngSetSource, source );
+        }
+
+    ExecuteCmdL( KVtEngStartViewFinder );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdDisableAudioL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdDisableAudioL()
+    {
+    ExecuteCmdL( KVtEngMuteOutgoingAudio );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdActivateBtL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdActivateBtL()
+    {
+    TInt error = KErrNone;
+    CVtUiActivateBtHfDialog* dialog =
+        new ( ELeave ) CVtUiActivateBtHfDialog(
+            NULL,
+            &error,
+            Model().CommandHandler(),
+            *iEventObserver );
+    dialog->ExecuteDialogLD();
+
+    if ( error != KErrCancel )
+        {
+        switch ( error )
+            {
+            case KErrNone:
+                break;
+
+            case KErrNoMemory:
+            case KErrNotSupported:
+                // Clear failure - to be handled in active scheduler.
+                User::Leave( error );
+                break;
+
+            default:
+                // Failed - still show local information note in error situation.
+                {
+                HBufC* prompt =
+                    StringLoader::LoadLC(
+                        R_VIDEOTELUI_QTN_BT_DEVICE_NOT_AVAIL );
+                CAknInformationNote* note =
+                    new ( ELeave ) CAknInformationNote( ETrue );
+                note->ExecuteLD( *prompt );
+                CleanupStack::PopAndDestroy( prompt );
+                }
+                break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdDeactivateBtL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdDeactivateBtL()
+    {
+    // Command to Video tel engine
+    MVtEngAudio::TVtEngRoutingSetting audioSetting =
+        MVtEngAudio::EDeactivateBT;
+
+    ExecuteCmdL( KVtEngSetAudioRouting, audioSetting );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdActivateLoudspeakerL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdActivateLoudspeakerL()
+    {
+    MVtEngAudio::TVtEngRoutingSetting audioSetting =
+        MVtEngAudio::EActivateHandsfree;
+    ExecuteCmdL( KVtEngSetAudioRouting, audioSetting );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdDeactivateLoudspeakerL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdDeactivateLoudspeakerL()
+    {
+    MVtEngAudio::TVtEngRoutingSetting audioSetting =
+        MVtEngAudio::EDeactivateHansfree;
+    ExecuteCmdL( KVtEngSetAudioRouting, audioSetting );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdSwapImagesPlacesL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdSwapImagesPlacesL()
+    {
+    __VTPRINTENTER( "VtUi.Swap" )
+
+    MVtEngMedia& media = Model().Media();
+    const TBool viewFinderStarted =
+        media.RenderingStarted( MVtEngMedia::EMediaOutgoing );
+    const TBool remoteRenderStarted =
+        media.RenderingStarted( MVtEngMedia::EMediaIncoming );
+
+    if ( viewFinderStarted )
+        {
+        // Stop viewfinder.
+        __VTPRINT( DEBUG_GEN, "VtUi.Swap.VF.down" )
+        ExecuteCmdL( KVtEngStopViewFinder );
+        }
+    // Stop remote render.
+    __VTPRINT( DEBUG_GEN, "VtUi.Swap.RR.down" )
+    ExecuteCmdL( KVtEngStopRenderRemote );
+
+    // Clear windows.
+    iUplinkWindow->Reset();
+    iDownlinkWindow->Reset();
+
+    const TBool uplinkWindowEqualsContextControl =
+        ( iUplinkWindow == iInstance->iContextControl );
+
+    // Prepare viewfinder.
+    __VTPRINT( DEBUG_GEN, "VtUi.Swap.VF.upd" )
+    TVtEngRenderingOptions configViewfinder(
+         uplinkWindowEqualsContextControl ?
+             DetermineMainControlOptions( EFalse ) :
+             DetermineContextControlOptions() );
+    ExecuteCmdL( KVtEngPrepareViewFinder, configViewfinder );
+
+    // Swap windows.
+    if ( ERenderingModeDialer == iRenderingMode )
+        {
+        MVtUiVideoWindow* tmpWindow = iUplinkWindow;
+        iUplinkWindow = iStoredDownlinkWindow;
+        iStoredDownlinkWindow = tmpWindow;        
+        }
+    else
+        {
+        MVtUiVideoWindow* tmpWindow = iUplinkWindow;
+        iUplinkWindow = iDownlinkWindow;
+        iDownlinkWindow = tmpWindow;        
+        }
+    iUplinkWindow->SetRemoteVideoControl(NULL);
+    iDownlinkWindow->SetRemoteVideoControl(iInstance->iRemoteVideoControl);
+    iDownlinkWindow->LayoutRemoteVideo();    
+
+    // Prepare remote render.
+    __VTPRINT( DEBUG_GEN, "VtUi.Swap.RR.upd" )
+    TRAPD ( err, {
+    TVtEngRenderingOptionsNGA configRemoteRenderNGA(
+            DetermineRemoteVideoControlOptionsNGA() );
+    ExecuteCmdL(
+            KVtEngPrepareRemoteRenderNGA,
+                configRemoteRenderNGA );
+    } );
+    
+    if ( err != KErrNone )
+        {
+        if ( viewFinderStarted )
+            {
+            // Start viewfinder.
+            ExecuteCmdL( KVtEngStartViewFinder );
+            }
+        User::Leave ( err );	
+        }
+    // Start remote render.
+    __VTPRINT( DEBUG_GEN, "VtUi.Swap.RR.up" )
+    if ( remoteRenderStarted )
+        {
+        ExecuteCmdL( KVtEngStartRenderRemote );
+        }
+
+    __VTPRINT( DEBUG_GEN, "VtUi.Swap.VF.up" )
+    if ( viewFinderStarted )
+        {
+        // Start viewfinder.
+        ExecuteCmdL( KVtEngStartViewFinder );
+        }
+
+    iDownlinkWindow->Redraw();
+
+    // Refresh blind & waiting will be handled in HandleCommandL.
+    __VTPRINTEXIT( "VtUi.Swap" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdUseCameraL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdUseCameraL( const TBool aPrimaryCamera )
+    {
+    EnableCommandActivatingAndCleanupPushL();
+    MVtEngMedia& media = Model().Media();
+
+    MVtEngMedia::TMediaSource selectedSource =
+        ( aPrimaryCamera ) ?
+            MVtEngMedia::EMediaCameraPri : MVtEngMedia::EMediaCameraSec;
+
+    TInt available = 0;
+    VtUiUtility::GetOutgoingMediaState( media, available );
+    if ( available & MVtEngMedia::EMediaVideo )
+        {
+        ExecuteCmdL( KVtEngStopViewFinder );
+
+        iUplinkWindow->SetStreamBitmap( NULL );
+        TRAPD( err, ExecuteCmdL( KVtEngSetSource, selectedSource ) );
+
+        if ( err == KErrNone )
+            {
+            ExecuteCmdL( KVtEngStartViewFinder );
+            }
+        else
+            {
+            ShowOtherCameraNotUsableNoteL();
+            }
+        }
+    else
+        {
+        MVtEngMedia::TPrepareCameraParams params;
+        params.iMediaSource = selectedSource;
+        params.iInitialize = EFalse;
+        TRAPD( err, ExecuteCmdL( KVtEngPrepareCamera, params ) );
+        if ( err != KErrNone )
+            {
+            ShowOtherCameraNotUsableNoteL();
+            }
+        }
+    CleanupStack::PopAndDestroy(); // EnableCommandActivatingAndCleanupPushL
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdHelpL
+// Launches help application.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdHelpL()
+    {
+    HlpLauncher::LaunchHelpApplicationL(
+        iEikonEnv->WsSession(),
+        AppHelpContextL() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::PrepareExitL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::PrepareExitL()
+    {
+    __VTPRINTENTER( "VtUi.PrepareExitL" )
+    // Cancel progress dialog
+    HideProgressDialogL();
+    // Cancel menu.
+    CAknAppUi::ProcessCommandL( EEikCmdCanceled ); // does not leave
+
+    if ( !iExitTimer->IsActive() )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.Exit.Timer.Go" )
+        iExitTimer->Start(
+            KVtUiExitTimeout,
+            KVtUiExitTimeout,
+            TCallBack( DoHandleExitTimeout, this ) );
+        }
+
+    // Asynchronous shutdown - execute command.
+    iBlankControl->SetActive( ETrue );
+    __VTPRINTEXIT( "VtUi.PrepareExitL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdUpdateZoomL
+// This method is called to update zoom step to the Video Telephone engine
+// side from the HandleKeyEventL method.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdUpdateZoomL()
+    {
+    __VTPRINTENTER( "VtUi.UpdZm" )
+
+    __VTPRINTEXIT( "VtUi.UpdZm" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetZoomFactorL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetZoomFactorL( TInt aZoomStep )
+    {
+    __VTPRINTENTER( "VtUi.SetZoomFactorL" )
+    MVtEngMedia& media = Model().Media();
+    if ( VtUiUtility::IsZoomAllowed( media ) )
+        {
+        ExecuteCmdL( KVtEngSetZoomStep, aZoomStep );
+        }
+    __VTPRINTEXIT( "VtUi.SetZoomFactorL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdUpdateVolumeL
+// This method is called to update volume to the Video Telephone engine
+// side
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdUpdateVolumeL( MVtEngAudio::TVtEngOutputVolume aVolume )
+    {
+    __VTPRINTENTER( "VtUi.CmdUpdateVolumeL" )
+    iVolCtrl->AdjustVolumeL( aVolume );
+    __VTPRINTEXIT( "VtUi.CmdUpdateVolumeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdGoToIdleL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdGoToIdleL()
+    {
+	__VTPRINTENTER( "VtUi.CmdGoToIdleL" )
+    TInt idleUid = 0;
+    if ( RProperty::Get(
+             KPSUidAiInformation,
+             KActiveIdleUid,
+             idleUid ) == KErrNone )
+        {
+		__VTPRINT2( DEBUG_GEN, "Idle UID: %d", idleUid )
+        TApaTaskList taskList( iEikonEnv->WsSession() );
+        TApaTask task = taskList.FindApp( TUid::Uid( idleUid ) );
+        if ( task.Exists() )
+            {
+			__VTPRINT( DEBUG_GEN, "Idle task found")
+            RProperty::Set( KPSUidUikon, KUikVideoCallTopApp, KVtUiAppUid.iUid );
+            task.BringToForeground();
+            }
+        }
+	__VTPRINTEXIT( "VtUi.CmdGoToIdleL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdInitializeShareImageL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdInitializeShareImageL( TBool& aNeedRefresh )
+    {
+    __VTPRINTENTER( "VtUi.CmdInitializeShareImageL" )
+    EnableCommandActivatingAndCleanupPushL();
+
+    MVtUiFeature* tb =
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar );
+      if ( tb )
+        {
+        // timer could be active
+        if ( iTbPeriodic )
+            {
+            iTbPeriodic->Cancel();
+            }
+        tb->Stop();
+        }
+    CDesCArray* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 );
+    CleanupStack::PushL( selectedFiles );
+    CVtUiAppUi::CVtUiAppUiMGVerifier* verifier =
+        CVtUiAppUi::CVtUiAppUiMGVerifier::NewLC( *this, *iCoeEnv );
+
+     // number erntry is not availabe while media gallery is open
+    iInstance->iNumberEntryActivation->SetActive( EFalse );
+    iUiStates->SetSelectingShare( ETrue );
+
+    TBool result( EFalse );
+    TRAPD( err, result =
+        MGFetch::RunL( *selectedFiles, EImageFile, EFalse, verifier ) );
+
+   // leave occured
+   if ( err != KErrNone )
+       {
+       if ( iUiStates->ExecState() == TVtUiStates::EExecStateRunning )
+           {
+           ShowUnableToOpenNoteL();
+           }
+       else
+           {
+           __VTPRINTEXIT( "VtUi.CmdInitializeShareImageL 1" )
+           Exit();
+           }
+       }
+
+    if ( result && ( selectedFiles->Count() > 0 ) )
+        {
+        MVtEngMedia::TShareObjectState shareObjectState;
+        VtUiUtility::GetObjectSharingState( Model().Media(), shareObjectState );
+        iUiStates->SetViewFinderToMainPane(
+            shareObjectState == MVtEngMedia::ENotSharing );
+        MVtEngMedia::TShareObjectImageParameters
+            parameters( selectedFiles->operator[]( 0 ) );
+        ExecuteCmdL( KVtEngInitializeShareImage, parameters );
+        aNeedRefresh = ETrue;
+        }
+    else  // selection canceled start toolbar timer
+        {
+        if ( !iTbPeriodic )
+            {
+            iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+            }
+        iTbPeriodic->Cancel();
+        iTbPeriodic->Start( KStartTime, KPeriodTime, TCallBack( DoTryToStartTbL, this ) );
+        }
+    CleanupStack::PopAndDestroy( 2 ); // selectedFiles, verifier
+    // number entry is availabe again
+    iInstance->iNumberEntryActivation->SetActive( ETrue );
+    iUiStates->SetSelectingShare( EFalse );
+    CleanupStack::PopAndDestroy(); // EnableCommandActivatingAndCleanupPushL();
+    
+    __VTPRINTEXIT( "VtUi.CmdInitializeShareImageL 0" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdShareImageL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdShareImageL()
+    {
+    ExecuteCmdL( KVtEngStartShareImage );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdStopShareImageL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CmdStopShareImageL( TBool& aNeedRefresh )
+    {
+    ExecuteCmdL( KVtEngStopShareImage );
+	RestoreViewFinderL();
+    aNeedRefresh = ETrue;
+    // update VB settings
+    UpdateVBSettingL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleWaitingStateChange
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleWaitingStateChange( TBool aIsWaiting )
+	{
+    // Dialer must be closed in case of waiting call
+    MVtUiFeature* dialer =
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer );
+    if ( dialer )
+        {
+        dialer->Stop();
+        }
+    iUiStates->SetWaitingCall( aIsWaiting );
+    if (aIsWaiting == EFalse && 
+        iIsWaitingCallState != EFalse && 
+        !iUiStates->IsThisApplicationForeground() )
+        {
+        iIsWaitingCallState = EFalse;
+        ChangeApplicationFocus( ETrue );
+        TRAP_IGNORE ( SetHiddenL( EFalse ) );
+        }
+	}
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitExecuteL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::ActiveExecInitExecuteL(
+        const TInt aState,
+        TInt& aNextState,
+        TRequestStatus& aRequest )
+    {
+    __VTPRINTENTER( "VtUi.InitExec" )
+    __VTPRINT2( DEBUG_GEN, "VtUi.InitExec.st=%d", aState )
+
+    TBool synch = EFalse;
+
+    switch ( aState )
+        {
+        // Startup chain:
+        case EVtUiAppUiStartupCloseDialogs:
+            // Close all dialogs.
+            iBlankControl->SetActive( EFalse );
+            AknDialogShutter::ShutDialogsL( *iEikonEnv );
+            iBlankControl->SetActive( ETrue );
+
+            synch = ETrue;
+            aNextState = EVtUiAppUiStartupInitEngine;
+            break;
+
+        case EVtUiAppUiStartupInitEngine:
+            iUplinkWindow = iInstance->iContextControl;
+            iDownlinkWindow = iInstance->iMainControl;
+            ActiveExecInitExecuteCommandL( KVtEngInitializeEngine, aRequest );
+            aNextState = EVtUiAppUiStartupPrepareViewfinder;
+            break;
+
+        case EVtUiAppUiStartupPrepareViewfinder:
+            ActiveExecInitPrepareViewFinderL( aRequest );
+            iUplinkWindow->SetStreamBitmap( NULL );
+            aNextState = EVtUiAppUiStartupPrepareRemoteRender;
+            break;
+
+        case EVtUiAppUiStartupPrepareRemoteRender:
+        
+            iInstance->CreateRemoteVideoControl();
+            ActiveExecInitPrepareRemoteRenderL( aRequest );
+            iDownlinkWindow->SetStreamBitmap( NULL );
+            aNextState = EVtUiAppUiStartupRemoveBlank;
+            break;
+
+        case EVtUiAppUiStartupRemoveBlank:
+             // Finally remove blank control.
+            iBlankControl->SetActive( EFalse );
+            aNextState = EVtUiAppUiNone;
+            synch = ETrue;
+            break;
+
+        // Shutdown chain:
+        case EVtUiAppUiShutdownCloseDialogs:
+            {
+            // Close all dialogs.
+            iBlankControl->SetActive( EFalse );
+            AknDialogShutter::ShutDialogsL( *iEikonEnv );
+            iBlankControl->SetActive( ETrue );
+
+            MVtUiFeature* numberEntry = iFeatureManager->GetFeatureById(
+                EVtUiFeatureIdNumberEntry );
+            // Number entry may be active if its deactivation timer is still
+            // pending. Stop performs some cleanup which is needed before AppUi
+            // cleanup.
+            if ( numberEntry )
+                {
+                numberEntry->Stop();
+                }
+
+            synch = ETrue;
+            aNextState = EVtUiAppUiShutdownHideApplication;
+            }
+            break;
+
+        case EVtUiAppUiShutdownHideApplication:
+            if ( iUiStates->IsThisApplicationForeground() )
+                {
+                BringTelephoneToForeground();
+                }
+            else
+                {
+                ChangeApplicationFocus( EFalse );
+                }
+            iDownlinkWindow->SetStreamBitmap( NULL );
+            iUplinkWindow->SetStreamBitmap( NULL );
+            SetHiddenL( ETrue );
+            iEventObserver->DeleteRemConSession();
+
+            synch = ETrue;
+            aNextState = EVtUiAppUiShutdownResetEngine;
+            break;
+
+        case EVtUiAppUiShutdownResetEngine:
+            {
+            aRequest = KRequestPending;
+
+            MVtEngCommandHandler& command = Model().CommandHandler();
+            // There should not be any commands ongoing because
+            // we have canceled all dialogs (and this should
+            // be the only command without dialog).
+            command.CancelCommand( command.PendingCommand() ); // ignore error
+            command.ExecuteL( KVtEngResetEngine, NULL );
+            iShutdownRequest = &aRequest;
+
+            aNextState = EVtUiAppUiShutdownRemoveBlank;
+            }
+            break;
+
+        case EVtUiAppUiShutdownRemoveBlank:
+            // Finally remove blank control.
+            iBlankControl->SetActive( EFalse );
+
+            synch = ETrue;
+            aNextState = EVtUiAppUiNone;
+            break;
+
+        // Answered chain:
+        case EVtUiAppUiAnsweredStart:
+            {
+            CVtUiBlankDialog* dialog =
+                new ( ELeave ) CVtUiBlankDialog( &iExecBlankDialog );
+            dialog->ExecuteDialogNoWaitLD();
+            iExecBlankDialog = dialog;
+
+            synch = ETrue;
+            if ( iUiStates->IsLayoutChangeNeeded() )
+                {
+                (void) HandleLayoutChanged();
+                }
+            aNextState = EVtUiAppUiAnsweredRefreshNavi;
+            }
+            break;
+
+        case EVtUiAppUiAnsweredRefreshNavi:
+            RefreshNaviPaneL();
+            iEventObserver->CreateRemConSessionL();
+
+            synch = ETrue;
+            aNextState = EVtUiAppUiAnsweredRefreshSoftkeys;
+            break;
+
+        case EVtUiAppUiAnsweredRefreshSoftkeys:
+            RefreshSoftkeysL();
+
+            synch = ETrue;
+            aNextState = EVtUiAppUiAnsweredStartRemoteRender;
+            break;
+
+        case EVtUiAppUiAnsweredStartRemoteRender:
+            {
+            // Set waiting text to main control and start remote rendering.
+            // Video Telephone application should get KVtEngRemoteVideoStarted
+            // event when the first frame is received.
+            iDownlinkWindow->SetWaiting( ETrue );
+            iUiStates->SetWaitingForFirstFrame( ETrue );
+            //Must check if orientation changed between prepare remote render and start remote render
+            //If changed, update render parameter firstly
+            if ( iIsLandScapeOrientation != VtUiLayout::IsLandscapeOrientation() )
+                {
+                 __VTPRINT( DEBUG_GEN, "layout has been changed before start RemoteRender" )
+                 UpdateRenderingParametersL();
+                }
+
+            ActiveExecInitExecuteCommandL( KVtEngStartRenderRemote,
+                aRequest );
+
+            aNextState = EVtUiAppUiAnsweredCheckCamera;            
+            }
+            break;
+
+        case EVtUiAppUiAnsweredCheckCamera:
+            {
+            MVtEngMedia& media = Model().Media();
+            if ( VtUiUtility::HasCameras( media ) )
+                {
+                aNextState = EVtUiAppUiAnsweredChoose;
+                synch = ETrue;
+                }
+            else
+                {
+                if ( VtUiUtility::HasStillImage( media ) )
+                    {
+                    aNextState = EVtUiAppUiAnsweredSelectStill;
+                    }
+                else
+                    {
+                    aNextState = EVtUiAppUiAnsweredSelectNone;
+                    }
+
+                synch = ETrue;
+                }
+            }
+            break;
+
+        case EVtUiAppUiAnsweredChoose:
+            {
+            // If camera is in use, then show note,
+            // select still image, stop.
+            //
+            // If call is mobile terminated, then show query.
+            //      If user answers 'yes' to the query,
+            //      then activate camera.
+            //      If user answers 'no' to the query,
+            //      then choose still image.
+            //
+            // If call is mobile originated, then select camera.
+            //
+            // If selecting a camera fails, then select still image.
+            // If selecting still image fails, then select none.
+            //
+            CVtEngModel& model = Model();
+            MVtEngSessionInfo& session = model.Session();
+            MVtEngMedia& media = model.Media();
+
+            MVtEngMedia::TCameraId id;
+            TInt cameraErr = model.Media().GetCurrentCameraId( id );
+            if ( cameraErr == KErrInUse )
+                {
+                // Camera is in use.
+                iUiStates->SetExecShowCameraInUse( ETrue );
+
+                if ( VtUiUtility::HasStillImage( media ) )
+                    {
+                    aNextState = EVtUiAppUiAnsweredSelectStill;
+                    }
+                else
+                    {
+                    aNextState = EVtUiAppUiAnsweredSelectNone;
+                    }
+                }
+            else
+                {
+                // Check the direction of the call.
+                iUiStates->SetExecShowCameraInUse( EFalse );
+                MVtEngSessionInfo::TDirection direction;
+                if ( session.GetDirection( direction ) != KErrNone )
+                    {
+                    direction = MVtEngSessionInfo::EDirectionMT;
+                    }
+
+                if ( direction == MVtEngSessionInfo::EDirectionMT )
+                    {
+                    // Start steps towards the "Allow video" query.
+                    if ( VtUiUtility::HasStillImage( media ) )
+                        {
+                        aNextState = EVtUiAppUiAnsweredQuerySetupStill;
+                        }
+                    else
+                        {
+                        aNextState = EVtUiAppUiAnsweredQuerySetupNone;
+                        }
+                    }
+                else
+                    {                    
+                    aNextState = EVtUiAppUiAnsweredDoPrepareCamera;
+                    }
+                }
+            synch = ETrue;
+            }
+            break;
+
+        case EVtUiAppUiAnsweredQuerySetupStill:
+            ActiveExecInitSetSourceL( MVtEngMedia::EMediaStillImage, aRequest );
+            aNextState = EVtUiAppUiAnsweredQuerySetupStart;
+            break;
+
+        case EVtUiAppUiAnsweredQuerySetupNone:
+            ActiveExecInitSetSourceL( MVtEngMedia::EMediaNone, aRequest );
+            aNextState = EVtUiAppUiAnsweredQuerySetupStart;
+            break;
+
+        case EVtUiAppUiAnsweredQuerySetupStart:
+            ActiveExecInitExecuteCommandL( KVtEngStartViewFinder, aRequest );
+            aNextState = EVtUiAppUiAnsweredQueryShow;
+            break;
+
+        case EVtUiAppUiAnsweredQueryShow:
+            {
+            RefreshL();
+            TInt state = EPSCTsyCallStateUninitialized;
+            TInt err = RProperty::Get(
+                KPSUidCtsyCallInformation,
+                KCTsyCallState,
+                state );
+            __VTPRINT3( DEBUG_GEN, "VtUi.InitExec WaitingCall State=%d, err=%d",
+            state, err )
+            if ( EPSCTsyCallStateRinging != state )
+                {
+                ChangeApplicationFocus( ETrue );
+                SetHiddenL( EFalse );
+                }
+            else
+                {
+                iIsWaitingCallState = ETrue;
+                }
+
+			// User selectable call answer mute.
+			// In GS one can set call ansewer status
+			// eighter to query user, allways show, allways mute.
+			// GS values are checked from CR key ( KSettingsVTVideoSending )
+			// (default value is 0 = allways query).
+			TVtUiGsMuteVariation camute;
+    		__VTPRINT2( DEBUG_GEN, "VtUi.InitExe GS CR key KSettingsVTVideoSending querystate=%d", camute.GsMuteState() )
+			if ( camute.GsMuteState() == KAllwaysQuery && !iUiStates->IsDeviceLockOn() && EPSCTsyCallStateRinging != state)
+				{
+            	CVtUiAllowVideoDialog* dialog =
+                	new ( ELeave ) CVtUiAllowVideoDialog(
+                    	&iExecDialog,
+                    	CAknQueryDialog::ENoTone );
+            	dialog->ExecuteDialogLD( aRequest );
+            	iExecDialog = dialog;
+            	aNextState = EVtUiAppUiAnsweredQueryDecide;
+				}
+			else if ( camute.GsMuteState() == KAllwaysAllow )
+				{
+                aNextState = EVtUiAppUiAnsweredDoPrepareCamera;
+				synch = ETrue;
+				}
+			else
+				{
+				aNextState = EVtUiAppUiNone;
+				synch = ETrue;
+				}
+
+            }
+            break;
+
+        case EVtUiAppUiAnsweredQueryDecide:
+            {
+            delete iExecDialog;
+            iExecDialog = NULL;
+
+            if ( iActiveExec->RequestStatus() ==
+                 CVtUiAllowVideoDialog::EUserAllowed )
+                {
+                aNextState = EVtUiAppUiAnsweredDoPrepareCamera;
+                }
+            else
+                {
+                aNextState = EVtUiAppUiNone;
+                }
+
+            synch = ETrue;
+            }
+            break;
+
+        case EVtUiAppUiAnsweredDoPrepareCamera:
+            {
+            MVtEngMedia& media = Model().Media();
+            MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaCamera;
+            ActiveExecInitPrepareCameraL( source, aRequest );
+            aNextState = EVtUiAppUiAnsweredSelectCamera;
+            }
+            break;
+
+        case EVtUiAppUiAnsweredQuerySelectCamera:
+        case EVtUiAppUiAnsweredSelectCamera:
+            ActiveExecInitSetSourceL( MVtEngMedia::EMediaCamera, aRequest );
+            if ( aState == EVtUiAppUiAnsweredSelectCamera )
+                {
+                aNextState = EVtUiAppUiAnsweredStartViewfinder;
+                }
+            else
+                {
+                aNextState = EVtUiAppUiAnsweredQueryStartViewfinder;
+                }
+            break;
+
+        case EVtUiAppUiAnsweredQuerySelectStill:
+        case EVtUiAppUiAnsweredSelectStill:
+            ActiveExecInitSetSourceL( MVtEngMedia::EMediaStillImage, aRequest );
+
+            if ( aState == EVtUiAppUiAnsweredSelectStill )
+                {
+                aNextState = EVtUiAppUiAnsweredStartViewfinder;
+                }
+            else
+                {
+                aNextState = EVtUiAppUiAnsweredQueryStartViewfinder;
+                }
+            break;
+
+        case EVtUiAppUiAnsweredQuerySelectNone:
+        case EVtUiAppUiAnsweredSelectNone:
+            ActiveExecInitSetSourceL( MVtEngMedia::EMediaNone, aRequest );
+
+            if ( aState == EVtUiAppUiAnsweredSelectNone )
+                {
+                aNextState = EVtUiAppUiAnsweredStartViewfinder;
+                }
+            else
+                {
+                aNextState = EVtUiAppUiAnsweredQueryStartViewfinder;
+                }
+            break;
+
+        case EVtUiAppUiAnsweredQueryStartViewfinder:
+        case EVtUiAppUiAnsweredStartViewfinder:
+            ActiveExecInitExecuteCommandL( KVtEngStartViewFinder, aRequest );
+
+            if ( aState == EVtUiAppUiAnsweredStartViewfinder )
+                {
+                aNextState = EVtUiAppUiAnsweredFinish;
+                }
+            else
+                {
+                aNextState = EVtUiAppUiAnsweredQueryFinish;
+                }
+            break;
+
+        case EVtUiAppUiAnsweredQueryFinish:
+        case EVtUiAppUiAnsweredFinish:
+            RefreshL();
+            if ( iUiStates->IsExecShowCameraInUse() )
+                {
+                ShowCameraInUseNoteL();
+                }
+
+            if ( aState != EVtUiAppUiAnsweredQueryFinish )
+                {
+                ChangeApplicationFocus( ETrue );
+                }
+            SetHiddenL( EFalse );
+
+            synch = ETrue;
+            aNextState = EVtUiAppUiNone;
+            break;
+
+        default:
+            User::Leave( KErrNotSupported );
+            break;
+        }
+
+    __VTPRINT2( DEBUG_GEN, "VtUi.InitExec.sync=%d", synch )
+    __VTPRINT2( DEBUG_GEN, "VtUi.InitExec.next=%d", aNextState )
+    __VTPRINTEXITR( "VtUi.InitExec %d", synch )
+    return synch;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitContinue
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::ActiveExecInitContinue(
+        TInt& aState,
+        const TInt aError )
+    {
+    __VTPRINTENTER( "VtUi.InitExecCont" )
+    __VTPRINT2( DEBUG_GEN, "VtUi.InitExecCont.st=%d", aState )
+    //__VTPRINT2( DEBUG_GEN, "VtUi.InitExecCont.err=%d", aError )
+
+    const TInt state = aState;
+    switch ( state )
+        {
+        case EVtUiAppUiStartupCloseDialogs:
+        case EVtUiAppUiStartupInitEngine:
+        case EVtUiAppUiStartupPrepareViewfinder:
+        case EVtUiAppUiStartupPrepareRemoteRender:
+        case EVtUiAppUiStartupRemoveBlank:
+            // Prepare failed.
+            break;
+
+        case EVtUiAppUiShutdownCloseDialogs:
+            if( KErrNotReady == aError )
+                {
+                aState = EVtUiAppUiShutdownHideApplication;
+                break;
+                }
+        case EVtUiAppUiShutdownResetEngine:            
+        case EVtUiAppUiShutdownRemoveBlank:
+            // shutdown failed
+            break;            
+
+        case EVtUiAppUiShutdownHideApplication:
+            aState = EVtUiAppUiShutdownResetEngine;
+            break;
+            
+
+        case EVtUiAppUiAnsweredStart:
+            aState = EVtUiAppUiAnsweredRefreshNavi;
+            break;
+
+        case EVtUiAppUiAnsweredRefreshNavi:
+            aState = EVtUiAppUiAnsweredRefreshSoftkeys;
+            break;
+
+        case EVtUiAppUiAnsweredRefreshSoftkeys:
+            aState = EVtUiAppUiAnsweredStartRemoteRender;
+            break;
+
+        case EVtUiAppUiAnsweredStartRemoteRender:
+        case EVtUiAppUiAnsweredStartViewfinder:
+        case EVtUiAppUiAnsweredSelectNone:
+        case EVtUiAppUiAnsweredFinish:
+        case EVtUiAppUiAnsweredQueryStartViewfinder:
+        case EVtUiAppUiAnsweredQuerySelectNone:
+        case EVtUiAppUiAnsweredQueryFinish:
+            // Answered failed.
+            break;
+
+        case EVtUiAppUiAnsweredCheckCamera:
+            aState = EVtUiAppUiAnsweredChoose;
+            break;
+
+        case EVtUiAppUiAnsweredChoose:
+            aState = EVtUiAppUiAnsweredQuerySetupStill;
+            break;
+
+        case EVtUiAppUiAnsweredQuerySetupStill:
+            aState = EVtUiAppUiAnsweredQuerySetupNone;
+            break;
+
+        case EVtUiAppUiAnsweredQuerySetupStart:
+        case EVtUiAppUiAnsweredQuerySetupNone:
+            aState = EVtUiAppUiAnsweredQueryShow;
+            break;
+
+        case EVtUiAppUiAnsweredQueryShow:
+        case EVtUiAppUiAnsweredQueryDecide:
+        case EVtUiAppUiAnsweredSelectCamera:
+            aState = EVtUiAppUiAnsweredSelectStill;
+            break;
+
+        case EVtUiAppUiAnsweredQuerySelectCamera:
+            aState = EVtUiAppUiAnsweredQuerySelectStill;
+            break;
+
+        case EVtUiAppUiAnsweredQuerySelectStill:
+            aState = EVtUiAppUiAnsweredQuerySelectNone;
+            break;
+
+        case EVtUiAppUiAnsweredSelectStill:
+            aState = EVtUiAppUiAnsweredSelectNone;
+            break;
+
+        default:
+            break;
+        }
+
+    const TBool cont = ( aState != state );
+    __VTPRINT2( DEBUG_GEN, "VtUi.InitExecCont.cont=%d", cont )
+
+    if ( !cont )
+        {
+        delete iExecBlankDialog;
+        iExecBlankDialog = NULL;
+        // Operation failed.
+        if ( iState )
+            {
+            TRAP_IGNORE( iState->AppUiStartupFailedL() );
+            }
+        }
+    __VTPRINTEXITR( "VtUi.InitExecCont %d", cont )
+    return cont;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitCancel
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecInitCancel(
+        const TInt /*aState*/ )
+    {
+    __VTPRINTENTER( "VtUi.InitExecCancel" )
+
+    iBlankControl->SetActive( EFalse );
+    delete iExecDialog;
+    delete iExecBlankDialog;
+
+    if ( iShutdownRequest )
+        {
+        User::RequestComplete( iShutdownRequest, KErrCancel );
+        iShutdownRequest = NULL;
+        }
+    __VTPRINTEXIT( "VtUi.InitExecCancel" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitDone
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecInitDone(
+        const TInt aInitialState )
+    {
+    __VTPRINTENTER( "VtUi.ExecInitDone" )
+    __VTPRINT2( DEBUG_GEN, "VtUi.InitExecDone.ini=%d", aInitialState )
+    delete iExecBlankDialog;
+    iExecBlankDialog = NULL;
+    // Operation succeeded
+
+    // Now we have finished.
+    if ( iState )
+        {
+        if ( aInitialState == EVtUiAppUiAnswered )
+            {
+            TRAP_IGNORE( iState->AppUiStartupPhase2DoneL() );
+            TRAP_IGNORE( AppUiInitDoneDoPostInitL() );
+            }
+        else if ( aInitialState == EVtUiAppUiShutdown )
+            {
+            TRAP_IGNORE( iState->ShutdownDoneL() );
+            }
+        else // EVtUiAppUiStartup
+            {
+            TRAP_IGNORE( iState->AppUiStartupPhase1DoneL() );
+            }
+        }
+    __VTPRINTEXIT( "VtUi.ExecInitDone" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitExecuteCommandL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecInitExecuteCommandL(
+        const TVtEngCommandId aCommand,
+        TRequestStatus& aRequest )
+    {
+    iExecDialog =
+        ExecuteCmdAsyncL(
+        &iExecDialog,
+        aCommand,
+        aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitExecuteCommandL
+// -----------------------------------------------------------------------------
+//
+template < class T >
+void CVtUiAppUi::ActiveExecInitExecuteCommandL(
+        const TVtEngCommandId aCommand,
+        T& aParam,
+        TRequestStatus& aRequest )
+    {
+    iExecDialog =
+        ExecuteCmdAsyncL(
+        &iExecDialog,
+        aCommand,
+        aParam,
+        aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitPrepareCameraL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecInitPrepareCameraL(
+        const MVtEngMedia::TMediaSource aSource,
+        TRequestStatus& aRequest )
+    {
+    MVtEngMedia::TPrepareCameraParams params;
+    params.iMediaSource = aSource;
+    params.iInitialize = ETrue;
+    iExecDialog =
+        ExecuteCmdAsyncL(
+            &iExecDialog,
+            KVtEngPrepareCamera,
+            params,
+            aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitSetSourceL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecInitSetSourceL(
+        const MVtEngMedia::TMediaSource aSource,
+        TRequestStatus& aRequest )
+    {
+    MVtEngMedia::TMediaSource source =
+        aSource;
+    iExecDialog =
+        ExecuteCmdAsyncL(
+            &iExecDialog,
+            KVtEngSetSource,
+            source,
+            aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitPrepareViewFinderL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecInitPrepareViewFinderL(
+        TRequestStatus& aRequest )
+    {
+    // Configure view finder to context pane.
+    if ( iEventObserver->CommandSupported( KVtEngPrepareViewFinder ) )
+        {
+        TVtEngRenderingOptions configViewfinder(
+            DetermineContextControlOptions() );
+
+        iExecDialog =
+            ExecuteCmdAsyncL(
+                &iExecDialog,
+                KVtEngPrepareViewFinder,
+                configViewfinder,
+                aRequest );
+        }
+    else
+        {
+        // Viewfinder does not support DSA - panic.
+        VtUiPanic::Panic( EVtUiPanicPrepareViewFinderNotSupported );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecInitPrepareRemoteRenderL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecInitPrepareRemoteRenderL(
+        TRequestStatus& aRequest )
+    {
+    if ( iEventObserver->CommandSupported( KVtEngPrepareRemoteRenderNGA ) )
+        {
+        // Cropping is performed when we draw the picture.
+        TVtEngRenderingOptionsNGA configRemoteRenderNGA(
+                DetermineRemoteVideoControlOptionsNGA() );
+
+        iExecDialog =
+            ExecuteCmdAsyncL(
+                &iExecDialog,
+                KVtEngPrepareRemoteRenderNGA,
+                configRemoteRenderNGA,
+                aRequest );
+        }
+    else
+        {
+        // Neither supported - panic.
+        VtUiPanic::Panic( EVtUiPanicPrepareRemoteRenderNotSupported );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecCmdExecuteCommandL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecCmdExecuteCommandL(
+        const TVtEngCommandId aCommand,
+        TRequestStatus& aRequest )
+    {
+    iCmdExecDialog =
+        ExecuteCmdAsyncL(
+            &iCmdExecDialog,
+            aCommand,
+            aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecCmdSetSourceL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecCmdSetSourceL(
+        const MVtEngMedia::TMediaSource aSource,
+        TRequestStatus& aRequest )
+    {
+    MVtEngMedia::TMediaSource source = aSource;
+    iCmdExecDialog =
+        ExecuteCmdAsyncL(
+            &iCmdExecDialog,
+            KVtEngSetSource,
+            source,
+            aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ActiveExecCmdPrepareCameraL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ActiveExecCmdPrepareCameraL(
+        const MVtEngMedia::TMediaSource aSource,
+        TRequestStatus& aRequest )
+    {
+    MVtEngMedia::TPrepareCameraParams params;
+    params.iMediaSource = aSource;
+    params.iInitialize = ETrue;
+    iCmdExecDialog =
+        ExecuteCmdAsyncL(
+            &iCmdExecDialog,
+            KVtEngPrepareCamera,
+            params,
+            aRequest );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineMainControlOptions
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptions
+    CVtUiAppUi::DetermineMainControlOptions( TBool aRemoteVideo )
+    {
+    // Determine main pane options.
+    TRect screen;
+    TAknWindowLineLayout stream;
+    TAknLayoutRect rect;
+
+    screen = iInstance->iMainControl->Rect();
+    VtUiLayout::GetSecondWindowStreamWholeLayout(
+        stream, aRemoteVideo && iUiStates->IsUseSQCif() );
+
+    rect.LayoutRect( screen, stream );
+    screen = rect.Rect();
+
+    return TVtEngRenderingOptions( *iEventObserver, screen.Size() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineContextControlOptions
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptions CVtUiAppUi::DetermineContextControlOptions()
+    {
+    // Determine context pane options.
+    TRect screen;
+    TRect clip;
+    TAknWindowLineLayout stream;
+    TAknLayoutRect rect;
+
+    VtUiLayout::GetApplicationParentRect( screen );
+    VtUiLayout::GetFirstWindowBackgroundLayout( stream );
+    rect.LayoutRect( screen, stream );
+    TRect background = rect.Rect();
+
+    VtUiLayout::GetFirstWindowStreamLayout( stream );
+    rect.LayoutRect( screen, stream );
+
+    // No cropping is performed, thus clip == screen.
+    clip = rect.Rect();
+    clip.iTl -= background.iTl;
+    clip.iBr -= background.iTl;
+
+    screen = clip;
+
+    return
+        TVtEngRenderingOptions(
+            *iEventObserver,
+            screen.Size() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineDialerControlOptions
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptions CVtUiAppUi::DetermineDialerControlOptions()
+    {
+    MVtUiDialer* dialer =  static_cast< CVtUiDialer* > (
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ) );
+
+    __ASSERT_ALWAYS( dialer, VtUiPanic::Panic( EVtUiPanicRendererNotFound ) );
+
+    return
+        TVtEngRenderingOptions(
+            *iEventObserver,
+            dialer->VideoControl().Size() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineMainControlOptions
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptionsDSA
+    CVtUiAppUi::DetermineMainControlOptionsDSA( TBool aRemoteVideo )
+    {
+    // Determine main pane options.
+    TRect screen;
+    TRect clip;
+    TAknWindowLineLayout stream;
+    TAknLayoutRect rect;
+    const TBool usesSQCif( aRemoteVideo && iUiStates->IsUseSQCif() );
+    screen = iInstance->iMainControl->Rect();
+    VtUiLayout::GetSecondWindowStreamLayout( stream,
+        iUiStates->IsToolbarAvailable(), usesSQCif );
+    rect.LayoutRect( screen, stream );
+    clip = rect.Rect();
+
+    VtUiLayout::GetSecondWindowStreamWholeLayout( stream,
+        iUiStates->IsToolbarAvailable(), usesSQCif );
+    rect.LayoutRect( screen, stream );
+    screen = rect.Rect();
+
+    return
+        TVtEngRenderingOptionsDSA(
+            *iEventObserver,
+            iEikonEnv->WsSession(),
+            *( iEikonEnv->ScreenDevice() ),
+            *( iInstance->iMainControl->DrawableWindow() ),
+            clip,
+            screen );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineContextControlOptionsDSA
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptionsDSA CVtUiAppUi::DetermineContextControlOptionsDSA()
+    {
+    // Determine context pane options.
+    TRect screen;
+    TRect clip;
+    TAknWindowLineLayout stream;
+    TAknLayoutRect rect;
+
+    VtUiLayout::GetApplicationParentRect( screen );
+    VtUiLayout::GetFirstWindowBackgroundLayout( stream );
+    rect.LayoutRect( screen, stream );
+    TRect background = rect.Rect();
+
+    VtUiLayout::GetFirstWindowStreamLayout( stream );
+    rect.LayoutRect( screen, stream );
+
+    // No cropping is performed, thus clip == screen.
+    clip = rect.Rect();
+    clip.iTl -= background.iTl;
+    clip.iBr -= background.iTl;
+
+    screen = clip;
+
+    return
+        TVtEngRenderingOptionsDSA(
+            *iEventObserver,
+            iEikonEnv->WsSession(),
+            *( iEikonEnv->ScreenDevice() ),
+            *( iInstance->iContextControl->DrawableWindow() ),
+            screen,
+            clip );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineDialerControlOptionsDSA
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptionsDSA CVtUiAppUi::DetermineDialerControlOptionsDSA()
+    {
+    MVtUiDialer* dialer =  static_cast< CVtUiDialer* > (
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ) );
+
+    __ASSERT_ALWAYS( dialer, VtUiPanic::Panic( EVtUiPanicRendererNotFound ) );
+
+    CCoeControl& videoWindow( dialer->VideoControl() );
+
+    return
+        TVtEngRenderingOptionsDSA(
+            *iEventObserver,
+            iEikonEnv->WsSession(),
+            *( iEikonEnv->ScreenDevice() ),
+            *( videoWindow.DrawableWindow() ),
+            videoWindow.Rect(),
+            videoWindow.Rect() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineMainControlOptionsDP
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptionsDP
+    CVtUiAppUi::DetermineMainControlOptionsDP( TBool aRemoteVideo )
+    {
+    // Determine main pane options.
+    const TRect screen( iInstance->iMainControl->Rect() );
+    TAknWindowLineLayout stream;
+    const TBool usesSQCif( aRemoteVideo && iUiStates->IsUseSQCif() );
+
+    // Even if the name is whole layout, this layout is (due to problem
+    // in layouts) video stream layout
+    TAknLayoutRect whole;
+    VtUiLayout::GetSecondWindowStreamWholeLayout( stream,
+        iUiStates->IsToolbarAvailable(), usesSQCif );
+    whole.LayoutRect( screen, stream );
+
+    // Even if the name is actual layout, this layout is (due to problem
+    // in layouts) whole == clipping layout
+    TAknLayoutRect actual;
+    VtUiLayout::GetSecondWindowStreamLayout( stream,
+        iUiStates->IsToolbarAvailable(), usesSQCif );
+    actual.LayoutRect( screen, stream );
+
+    return
+        TVtEngRenderingOptionsDP(
+            *iEventObserver,
+            iEikonEnv->WsSession(),
+            *( iEikonEnv->ScreenDevice() ),
+            *( iInstance->iMainControl->DrawableWindow() ),
+            actual.Rect(),
+            whole.Rect(),
+            iInstance->iMainControl->PositionRelativeToScreen() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineContextControlOptionsDP
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptionsDP CVtUiAppUi::DetermineContextControlOptionsDP()
+    {
+    // Determine context pane options.
+    TAknWindowLineLayout stream;
+    TAknLayoutRect rect;
+
+    TRect screen;
+    VtUiLayout::GetApplicationParentRect( screen );
+    VtUiLayout::GetFirstWindowBackgroundLayout( stream );
+    rect.LayoutRect( screen, stream );
+    const TRect background( rect.Rect() );
+
+    VtUiLayout::GetFirstWindowStreamLayout( stream );
+    rect.LayoutRect( screen, stream );
+
+    // No cropping is performed, thus clip == screen.
+    TRect clip( rect.Rect() );
+    clip.iTl -= background.iTl;
+    clip.iBr -= background.iTl;
+
+    return
+        TVtEngRenderingOptionsDP(
+            *iEventObserver,
+            iEikonEnv->WsSession(),
+            *( iEikonEnv->ScreenDevice() ),
+            *( iInstance->iContextControl->DrawableWindow() ),
+            clip,
+            clip,
+            iInstance->iContextControl->PositionRelativeToScreen() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineDialerControlOptionsDP
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptionsDP CVtUiAppUi::DetermineDialerControlOptionsDP()
+    {
+    MVtUiDialer* dialer =  static_cast< CVtUiDialer* > (
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ) );
+
+    __ASSERT_ALWAYS( dialer, VtUiPanic::Panic( EVtUiPanicRendererNotFound ) );
+
+    CCoeControl& videoWindow( dialer->VideoControl() );
+
+    TPoint offs( videoWindow.DrawableWindow()->AbsPosition() );
+    TRect rect( videoWindow.Rect() );
+    return
+        TVtEngRenderingOptionsDP(
+            *iEventObserver,
+            iEikonEnv->WsSession(),
+            *( iEikonEnv->ScreenDevice() ),
+            *( videoWindow.DrawableWindow() ),
+            rect,
+            rect,
+            offs );
+    }
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DetermineRemoteVideoControlOptionsNGA
+// -----------------------------------------------------------------------------
+//
+TVtEngRenderingOptionsNGA
+    CVtUiAppUi::DetermineRemoteVideoControlOptionsNGA()
+    {
+        return TVtEngRenderingOptionsNGA( *iEventObserver,
+                iInstance->iRemoteVideoControl ->GetRWindow() , iEikonEnv->WsSession());
+    }
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ExecuteCmdL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ExecuteCmdL( const TVtEngCommandId aCommand )
+    {
+    DoExecuteCmdL( aCommand, NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ExecuteCmdL
+// -----------------------------------------------------------------------------
+//
+template< class T >
+void CVtUiAppUi::ExecuteCmdL(
+        const TVtEngCommandId aCommand,
+        T& aParam )
+    {
+    TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ), sizeof( T ) );
+    DoExecuteCmdL( aCommand, &params );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DoExecuteCmdL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::DoExecuteCmdL(
+        const TVtEngCommandId aCommand,
+        TDesC8* aParams )
+    {
+    __VTPRINT2( DEBUG_GEN, "VtUi.DoExec.cmd=%d", aCommand )
+    MVtEngCommandHandler& command = Model().CommandHandler();
+    const TInt caps = command.GetCommandCaps( aCommand );
+
+    if ( caps >= KErrNone )
+        {
+        const TBool asynchronous =
+            ( caps & MVtEngCommandHandler::EAttribAsync );
+
+        if ( asynchronous  )
+            {
+            if ( aCommand == KVtEngHandleLayoutChange )
+                {
+                CVtEngCmdExec* cmdExec = CVtEngCmdExec::NewL(
+                    Model().CommandHandler(), *iEventObserver, *GetCba() );
+                cmdExec->ExecuteCmdLD( aCommand );
+                }
+            else
+                {
+                CVtUiExecuteCmdDialog* dlg =
+                    new ( ELeave ) CVtUiExecuteCmdDialog(
+                        NULL,
+                        Model().CommandHandler(),
+                        *iEventObserver );
+                dlg->ExecuteCmdLD( aCommand, aParams, NULL );
+                }
+            }
+        else
+            {
+            command.ExecuteL( aCommand, aParams );
+            RefreshStatesL();
+            }
+        }
+    else
+        {
+        // Failed.
+        User::Leave( caps );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleShutdownReady
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleShutdownReady()
+    {
+    __VTPRINTENTER( "VtUi.HandleShutdownReady" )
+
+    if(iAsyncCallback->IsActive())
+	    {
+		iAsyncCallback->Cancel();
+	    }
+
+    iAsyncCallback->Set(
+        TCallBack( &DoExit, this ) );
+    iAsyncCallback->CallBack();
+    __VTPRINTEXIT( "VtUi.HandleShutdownReady" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ContextControl
+// -----------------------------------------------------------------------------
+//
+CVtUiContextControl& CVtUiAppUi::ContextControl()
+   {
+    __VTPRINTENTER( "VtUi.ContextControl" )
+   __VTPRINTEXIT( "VtUi.ContextControl" )
+   return *iInstance->iContextControl;
+   }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::MainControl
+// -----------------------------------------------------------------------------
+//
+CVtUiMainControl& CVtUiAppUi::MainControl()
+   {
+   __VTPRINTENTER( "VtUi.MainControl" )
+   __VTPRINTEXIT( "VtUi.MainControl" )
+   return *iInstance->iMainControl;
+   }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RemoteVideoControl
+// -----------------------------------------------------------------------------
+//
+CVtUiRemoteVideoControl& CVtUiAppUi::RemoteVideoControl()
+   {
+   __VTPRINTENTER( "VtUi.RemoteVideoControl" )
+   __VTPRINTEXIT( "VtUi.RemoteVideoControl" )
+   return *iInstance->iRemoteVideoControl;
+   }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DoExit
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::DoExit( TAny* aAppUi )
+    {
+    __VTPRINTENTER( "VtUi.DoExit" )
+    CVtUiAppUi* self = static_cast< CVtUiAppUi* >( aAppUi );
+    self->iAsyncCallback->Cancel();
+    // Before exiting ensure there are no pending actions.
+    self->ActiveExecInitCancel( 0 );
+    self->Exit();
+    __VTPRINTEXIT( "VtUi.DoExit" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ExecuteCmdAsyncL
+// -----------------------------------------------------------------------------
+//
+CEikDialog* CVtUiAppUi::ExecuteCmdAsyncL(
+        CEikDialog** aDialogPtr,
+        const TVtEngCommandId aCommand,
+        TRequestStatus& aStatus )
+    {
+    return DoExecuteCmdAsyncL( aDialogPtr, aCommand, NULL, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ExecuteCmdAsyncL
+// -----------------------------------------------------------------------------
+//
+template< class T >
+CEikDialog* CVtUiAppUi::ExecuteCmdAsyncL(
+        CEikDialog** aDialogPtr,
+        const TVtEngCommandId aCommand,
+        T& aParam,
+        TRequestStatus& aStatus )
+    {
+    TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ), sizeof( T ) );
+    return DoExecuteCmdAsyncL( aDialogPtr, aCommand, &params, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DoExecuteCmdAsyncL
+// -----------------------------------------------------------------------------
+//
+CEikDialog* CVtUiAppUi::DoExecuteCmdAsyncL(
+        CEikDialog** aDialogPtr,
+        const TVtEngCommandId aCommand,
+        TDesC8* aParams,
+        TRequestStatus& aStatus )
+    {
+    __VTPRINT2( DEBUG_GEN, "VtUi.DoExecAsync.cmd=%d", aCommand )
+    MVtEngCommandHandler& command = Model().CommandHandler();
+    const TInt caps = command.GetCommandCaps( aCommand );
+
+    if ( caps >= KErrNone )
+        {
+        const TBool asynchronous =
+            ( caps & MVtEngCommandHandler::EAttribAsync );
+
+        if ( asynchronous  )
+            {
+            CVtUiExecuteCmdDialog* dlg =
+                new ( ELeave ) CVtUiExecuteCmdDialog(
+                    aDialogPtr,
+                    Model().CommandHandler(),
+                    *iEventObserver );
+            dlg->ExecuteCmdLD( aCommand, aParams, &aStatus );
+            return dlg;
+            }
+        else
+            {
+            command.ExecuteL( aCommand, aParams );
+            RefreshStatesL();
+            TRequestStatus* status = &aStatus;
+            User::RequestComplete( status, KErrNone );
+            }
+        }
+    else
+        {
+        // Failed.
+        User::Leave( caps );
+        }
+
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::Execute
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::Execute( const TVtEngCommandId aCommand, TDesC8* aParam )
+    {
+    MVtEngCommandHandler& command = Model().CommandHandler();
+    TRAPD( err, command.ExecuteL( aCommand, aParam ) );
+#ifdef VTDEBUG
+    if ( err != KErrNone )
+        {
+        __VTPRINT3( DEBUG_GEN, "VtUi.Execute.Nok.cmd=%d,err=%d", aCommand, err )
+        }
+#endif // VTDEBUG
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleForegroundChangedL(
+        TBool aIsForeground )
+    {
+    __VTPRINTENTER( "VtUi.HandleForegroundChangedL" )
+    __VTPRINT2( DEBUG_GEN, "VtUi.foreground=%d", (TInt) aIsForeground )
+
+
+    // Let the Engine know that Application's foregorund
+    // has changed. Then Engine can do some initalize/uninitalize
+    // before rendering due to the foreground state.
+    iState->PreHandleForegroundChangedL(aIsForeground);
+
+    // These operations must be done before
+    // sending KVtEngSetUIForeground command to engine i.e. calling
+    // iState->HandleForegroundChangedL( aIsForeground )
+    if ( !aIsForeground  )
+        {
+        // if capture mode is on stop it
+        if ( iUiStates->IsCaptureModeOn() )
+            {
+            CmdCancelCaptureL();
+            }
+        // if brightness or contrast feature is active stop those
+        MVtUiFeature* br = iFeatureManager->GetFeatureById( EVtUiFeatureIdBrightness );
+        if ( br )
+            {
+            __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL br" )
+            if ( br->State() ==  MVtUiFeature::EActive )
+                {
+                __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL br->STOP" )
+                br->Stop();
+                }
+            }
+
+        MVtUiFeature* cr = iFeatureManager->GetFeatureById( EVtUiFeatureIdContrast );
+        if ( cr )
+            {
+            __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL cr" )
+            if ( cr->State() ==  MVtUiFeature::EActive )
+               {
+               __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL cr->STOP" )
+               cr->Stop();
+               }
+            }
+
+        }
+
+    TBool foregroundAndReady = EFalse;
+    if ( iState )
+        {
+        foregroundAndReady = iState->HandleForegroundChangedL( aIsForeground );
+        iUiStates->SetThisApplicationForeground( aIsForeground );
+        }
+    if ( foregroundAndReady )
+        {
+        // Refresh navi pane. This will start call duration updating
+        // if necessary.
+        RefreshNaviPaneL();
+        }
+    else if ( !aIsForeground )
+        {
+
+
+        iEventObserver->StopBeat();
+        }
+    SetIncallBubbleAllowedInUsualL( !foregroundAndReady );
+    __VTPRINTEXIT( "VtUi.HandleForegroundChangedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshL( const TInt aRefreshFlags )
+    {
+    if ( aRefreshFlags & EUiStates )
+        {
+        RefreshNaviPaneL();
+        }
+    if ( aRefreshFlags & EBlind )
+        {
+        RefreshBlind();
+        }
+    if ( aRefreshFlags & ENaviPane )
+        {
+        RefreshNaviPaneL();
+        }
+    if ( aRefreshFlags & ESoftkeys )
+        {
+        RefreshSoftkeysL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleEngineResetL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleEngineResetL()
+    {
+    __VTPRINTENTER( "VtUi.HandleEngineResetL" )
+    if ( iShutdownRequest )
+        {
+        __VTPRINT( DEBUG_GEN, "  VtUi.HandleEngineResetL shutdown" )
+        User::RequestComplete( iShutdownRequest, KErrNone );
+        iShutdownRequest = NULL;
+        }
+    __VTPRINTEXIT( "VtUi.HandleEngineResetL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::StopWaitingImage
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::StopWaitingImage()
+    {
+    if ( iInstance )
+        {
+        iDownlinkWindow->SetWaiting( EFalse );
+        iUiStates->SetWaitingForFirstFrame( EFalse );
+        RemoteVideoControl().MakeVisible(ETrue);
+        }
+    }
+
+void CVtUiAppUi::StopWhiteBalanceOrColortone()
+    {
+    if( iEventObserver )
+        {
+        MVtEngMedia::TCameraId currentCamId;
+        //CVtEngMediaHandler& mediaHandler = iEventObserver->Model().Media();
+        ///mediaHandler.GetCurrentCameraId( currentCamId );
+        iEventObserver->Model().Media().GetCurrentCameraId( currentCamId );
+        __VTPRINT2( DEBUG_GEN, "  CVtUiAppUi::StopWhiteBalance currentCamId is %d", currentCamId);
+        
+        CVtUiWhiteBalance* wb = static_cast< CVtUiWhiteBalance* >(
+                                iFeatureManager->GetFeatureById( EVtUiFeatureIdWhiteBalance ) );
+        CVtUiColorTone* ct = static_cast< CVtUiColorTone* >(
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdColourTone ) );
+        
+        // only when the current camera switch to the Primary to stop the wb
+        if( currentCamId == MVtEngMedia::EPrimaryCamera )
+            {
+            
+            if( wb && ( wb->State() == MVtUiFeature::EActive ) )
+                {
+                	
+                wb->Stop();
+                }
+            
+            if( ct && ( ct->State() == MVtUiFeature::EActive ) )
+                {                    
+                ct->Stop();
+                }
+            
+            return;
+            }
+        if( currentCamId == MVtEngMedia::ESecondaryCamera )
+            {
+            if( wb->IsPendingCmd() )
+                wb->HandlePendingCmdL();
+            if( ct->IsPendingCmd() )
+                ct->HandlePendingCmdL();
+            }
+        }
+    }
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleLayoutChanged
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::HandleLayoutChanged()
+    {
+    iLayoutChangeCallback->CallBack();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DelayedHandleLayoutChanged
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::DelayedHandleLayoutChanged( TAny* aPtr )
+    {
+    CVtUiAppUi* self = reinterpret_cast< CVtUiAppUi* > ( aPtr );
+    self->iUiStates->SetDisableBlindSetting( ETrue );
+    TRAPD( err, self->HandleLayoutChangedL() );
+    self->iUiStates->SetDisableBlindSetting( EFalse );
+    self->RefreshBlind();
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleLayoutChangedL()
+    {
+    __VTPRINTENTER( "VtUi.LayoutChg" )
+    if ( iState )
+        {
+        iState->HandleLayoutChangedL();
+        }
+    __VTPRINTEXIT( "VtUi.LayoutChg" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DoHandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::DoHandleLayoutChangedL()
+    {
+    __VTPRINTENTER( "VtUi.DoLayoutChg" )
+    // Fully update rendering parameters
+    UpdateRenderingParametersL();
+    // Notify engine about layout change
+    iLayoutChg = ETrue;
+    TRAPD( error, ExecuteCmdL( KVtEngHandleLayoutChange ) );
+    iLayoutChg = EFalse;
+
+    // Not ready error is allowed to happen (e.g. when sharing)
+    if ( error && ( error != KErrNotReady ) )
+        {
+        User::Leave( error );
+        }
+    else
+        {
+        __VTPRINT( DEBUG_GEN,
+            "VtUi.DoLayoutChg KVtEngHandleLayoutChange == KErrNotReady (ok)" )
+        TVtEngCommandId pendingCommand = Model().CommandHandler().PendingCommand();
+        if ( pendingCommand  == KVtEngMuteOutgoingAudio || 
+                pendingCommand  == KVtEngUnmuteOutgoingAudio ||
+                pendingCommand  == KVtEngSetAudioRouting ||
+                pendingCommand  == KVtEngSetAudioVolume ||
+                pendingCommand  == KVtEngSetSource ||
+                pendingCommand  == KVtEngPrepareCamera ||
+                pendingCommand  == KVtEngUnfreeze )
+            {
+            iUiStates->SetLayoutChangeNeeded( ETrue );
+            }
+        }
+    // Notify component manager
+    iComponentManager->HandleLayoutChangeL();
+    MVtUiFeature* dialer =
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer );
+    const TBool dialerActive( dialer &&
+        ( dialer->State() == MVtUiFeature::EActive ) );
+    SwitchLayoutToFlatStatusPaneL( dialerActive );
+    
+    // Update the cam's whiteBalance and colorTone cause layoutchange will renew the camera,so
+    // restore the last user setting
+    UpdateVBSettingL();
+    
+
+    if ( iDelayedCmd != 0 )
+        {
+        __VTPRINT2( DEBUG_GEN, "VtUi.DoLayoutChg reexecute the delayed cmd=%d", iDelayedCmd);
+        HandleCommandL( iDelayedCmd );
+        iDelayedCmd = 0;
+        }
+    __VTPRINTEXIT( "VtUi.DoLayoutChg" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleVideoFrameL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleVideoFrameL(
+        const TBool aLocal,
+        CFbsBitmap* aBitmap )
+    {
+    if ( aLocal )
+        {
+        iUplinkWindow->SetStreamBitmap( aBitmap );
+
+        if ( aBitmap )
+            {
+            // If white balance or color tone setting feauture is
+            // active update feature's setting page's background.
+            CVtUiWhiteBalance* wb = static_cast< CVtUiWhiteBalance* >(
+            iFeatureManager->GetFeatureById( EVtUiFeatureIdWhiteBalance ) );
+
+            CVtUiColorTone* ct = static_cast< CVtUiColorTone* >(
+            iFeatureManager->GetFeatureById( EVtUiFeatureIdColourTone ) );
+
+            if ( wb )
+                {
+                  __VTPRINT( DEBUG_GEN,"VtUi.HandleVideoFrameL WB" )
+                if ( wb->State() == MVtUiFeature::EActive )
+                    {
+                    __VTPRINT( DEBUG_GEN,"VtUi.HandleVideoFrameL WB update" )
+                    wb->UpdateBackground( aBitmap );
+                    }
+                }
+            if ( ct )
+                {
+                 __VTPRINT( DEBUG_GEN,"VtUi.HandleVideoFrameL CT" )
+                if (ct->State() == MVtUiFeature::EActive)
+                    {
+                     __VTPRINT( DEBUG_GEN,"VtUi.HandleVideoFrameL CT update" )
+                    ct->UpdateBackground( aBitmap );
+                    }
+                }
+            }
+        }
+    else
+        {
+        iDownlinkWindow->SetStreamBitmap( aBitmap );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetVideoFrame
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetVideoFrame(
+        const TBool aLocal,
+        CFbsBitmap* aBitmap )
+    {
+    if ( aLocal )
+        {
+        }
+    else
+        {
+        iDownlinkWindow->SetStreamBitmapReserve( aBitmap );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleVideoFrameRemoteProblemL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleVideoFrameRemoteProblemL()
+    {
+    __VTPRINTENTER( "VtUi.HandleRemote" )
+    HandleVideoFrameL( EFalse, NULL );
+    __VTPRINTEXIT( "VtUi.HandleRemote" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleVideoFrameLocalProblemL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleVideoFrameLocalProblemL()
+    {
+    __VTPRINTENTER( "VtUi.HandleLocal" )
+    // Camera might have changed - better to stop zoom.
+    HandleVideoFrameL( ETrue, NULL );
+    __VTPRINTEXIT( "VtUi.HandleLocal" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RemoteVideoIsSQCif
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RemoteVideoIsSQCif( TBool aIsSQCif )
+    {
+    iUiStates->SetUseSQCif( aIsSQCif );
+    if ( iDownlinkWindow == iInstance->iMainControl )
+        {
+        ControlUsesSQCif( aIsSQCif );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ControlUsesSQCif
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ControlUsesSQCif( TBool aIsSQCif )
+    {
+    iInstance->iMainControl->SupportSQCif( aIsSQCif );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ChangeRemoteVideoLayoutL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ChangeRemoteVideoLayoutL()
+    {
+    HandleLayoutChanged();
+    if ( iDownlinkWindow == iInstance->iMainControl )
+        {
+        iDownlinkWindow->SetBlind( EFalse );
+        StopWaitingImage();
+        iInstance->iMainControl->DrawNow();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShowImageInitializeProgressL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShowImageInitializeProgressL()
+    {
+    __VTPRINTENTER( "VtUi.ShowImageInitializeProgressL" )
+    ShowProgressDialogL( R_PROGRESS_DECODING_IMAGE_WAIT_NOTE, this );
+    __VTPRINTEXIT( "VtUi.ShowImageInitializeProgressL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HideImageInitializeProgressL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HideImageInitializeProgressL()
+    {
+    __VTPRINTENTER( "VtUi.HideImageInitializeProgressL" )
+    // if volume slider is visible hide it
+    CVtUiVolume* volume = static_cast< CVtUiVolume* >(
+    iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume ) );
+    if ( volume )
+         {
+         volume->Stop();
+         }
+    HideProgressDialogL();
+    __VTPRINTEXIT( "VtUi.HideImageInitializeProgressL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CheckBeatL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CheckBeatL( const TBool aCallDurationEnabled )
+    {
+    // Update call duration periodically if necessary.
+    const MVtEngSessionInfo::TSessionState state = Model().Session().State( EFalse );
+    const TBool timerEnable =
+        ( aCallDurationEnabled ) &&
+        ( ( state == MVtEngSessionInfo::EConnected ) ||
+          ( state == MVtEngSessionInfo::ENegotiating ) ||
+          ( state == MVtEngSessionInfo::EOpen ) );
+
+    if ( timerEnable && iUiStates->IsThisApplicationForeground() )
+        {
+        iEventObserver->StartBeatL();
+        }
+    else
+        {
+        iEventObserver->StopBeat();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleBeat
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleBeat()
+    {
+    TRAP_IGNORE( RefreshNaviPaneL(); );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShowCameraInUseNoteL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShowCameraInUseNoteL() const
+    {
+    // The note must not be blocking.
+
+    CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( NULL );
+
+    dlg->PrepareLC( R_VIDEOTELUI_INFORMATION_NOTE );
+    dlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY );
+
+    HBufC* buf = StringLoader::LoadLC( R_VIDEOTELUI_QTN_INCAL_CLOSE_CAMCORDER );
+    dlg->SetTextL( *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    dlg->SetTone( CAknNoteDialog::EConfirmationTone );
+    dlg->SetTimeout( CAknNoteDialog::EUndefinedTimeout );
+    dlg->RunLD();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShowNotAllowedNoteL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShowNotAllowedNoteL() const
+    {
+    HBufC* prompt =
+        StringLoader::LoadLC(
+            R_VIDEOTELUI_TEXT_NOT_ALLOWED );
+
+    CAknInformationNote* note =
+        new ( ELeave ) CAknInformationNote( ETrue );
+    note->ExecuteLD( *prompt );
+    CleanupStack::PopAndDestroy( prompt );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShowCallNotAllowedNoteL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShowCallNotAllowedNoteL() const
+    {
+    HBufC* prompt =
+        StringLoader::LoadLC(
+            R_VIDEOTELUI_TEXT_CALL_NOT_ALLOWED );
+
+    CAknInformationNote* note =
+        new ( ELeave ) CAknInformationNote( ETrue );
+    note->ExecuteLD( *prompt );
+    CleanupStack::PopAndDestroy( prompt );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShowOtherCameraNotUsableNoteL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShowOtherCameraNotUsableNoteL() const
+    {
+    HBufC* prompt =
+        StringLoader::LoadLC(
+            R_VIDEOTELUI_QTN_ERR_CAM_SWAP );
+
+    CAknInformationNote* note =
+        new ( ELeave ) CAknInformationNote( ETrue );
+    note->ExecuteLD( *prompt );
+    CleanupStack::PopAndDestroy( prompt );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShowUnableToOpenNoteL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShowUnableToOpenNoteL() const
+    {
+    HBufC* prompt =
+        StringLoader::LoadLC(
+            R_VIDEOTELUI_QTN_ERR_UNABLE_TO_OPEN_IMAGE );
+    CAknInformationNote* note =
+        new ( ELeave ) CAknInformationNote( ETrue );
+    note->ExecuteLD( *prompt );
+    CleanupStack::PopAndDestroy( prompt );
+    }
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShowImageDecodingErrorNoteL()
+    {
+    HBufC* prompt =
+        StringLoader::LoadLC(
+            R_VIDEOTELUI_QTN_INCAL_NOTE_DECODING_FAILED );
+    CAknInformationNote* note =
+        new ( ELeave ) CAknInformationNote( ETrue );
+    note->ExecuteLD( *prompt );
+    CleanupStack::PopAndDestroy( prompt );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShowDRMNotAllowedNoteL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShowDRMNotAllowedNoteL() const
+    {
+    HBufC* prompt =
+        StringLoader::LoadLC(
+            R_VIDEOTELUI_QTN_ERR_DRM_NOT_ALLOWED );
+    CAknInformationNote* note =
+        new ( ELeave ) CAknInformationNote( ETrue );
+    note->ExecuteLD( *prompt );
+    CleanupStack::PopAndDestroy( prompt );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetSoftkeysL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetSoftkeysL( const TInt aSoftkeyResourceId )
+    {
+    if ( iCurrentSoftkeys != aSoftkeyResourceId )
+        {
+        if ( iCba )
+            {
+            iCba->SetCommandSetL( aSoftkeyResourceId );
+            iCba->DrawNow();
+            }
+        iCurrentSoftkeys = aSoftkeyResourceId;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetHiddenL
+// Makes application visible / invisible in fast swap window.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetHiddenL(
+        const TBool aHidden )
+    {
+    CEikonEnv* eikonEnv = iEikonEnv;
+    CApaWindowGroupName* windowGroupName =
+        CApaWindowGroupName::NewLC(
+            eikonEnv->WsSession(),
+            iThisApplicationWgId );
+    windowGroupName->SetHidden( aHidden );
+    User::LeaveIfError(
+        windowGroupName->SetWindowGroupName(
+            eikonEnv->RootWin() ) );
+    CleanupStack::PopAndDestroy( windowGroupName );
+
+    // Update application UID.
+    TUid applicationUid = KVtUiAppUid;
+    if ( aHidden )
+        {
+        applicationUid.iUid = KVtUiTelephoneUid.iUid;
+        }
+    __VTPRINT2( DEBUG_GEN, "VtUi.SetHiddenL applicationUid.iUid=%x",
+        applicationUid.iUid )
+    // Set application that is "default top application"
+    TInt originalTopAppUid = 0;
+    TInt err = RProperty::Get(
+        KPSUidUikon,
+        KUikVideoCallTopApp,
+        originalTopAppUid );
+    __VTPRINT3( DEBUG_GEN, "VtUi.SetHiddenL orig. topApp=%x, err=%d",
+    originalTopAppUid, err )
+    if ( originalTopAppUid != applicationUid.iUid &&
+         iUiStates->IsDetailsReceived() )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.SetHiddenL Do write KUikVideoCallTopApp" )
+        // Update key only if differs from original value and call
+        // has been answered
+        RProperty::Set(
+            KPSUidUikon,
+            KUikVideoCallTopApp,
+            applicationUid.iUid );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetCallIdL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetCallIdL( const TInt aCallId )
+    {
+    HBufC* titlePane =
+        StringLoader::LoadLC( R_VIDEOTELUI_QTN_CALL_NUMBER_VIDEO, aCallId );
+    TPtr ptr = titlePane->Des();
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+    TitlePaneL()->SetText( titlePane );
+    CleanupStack::Pop( titlePane );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetCallNameL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::SetCallNameL( const TDesC& aName )
+    {
+    HBufC* nameBuf = aName.Alloc();
+    if ( nameBuf )
+        {
+        TPtr ptr = nameBuf->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
+        TitlePaneL()->SetText( nameBuf );
+        }
+
+    return ( nameBuf != NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::BringTelephoneForeground
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::BringTelephoneToForeground()
+    {
+    __VTPRINTENTER( "VtUi.BringTelephoneToForeground" )
+    // If Telephone application is running, then
+    // bring it to the foreground.
+    const TInt windowGroupId = TelephoneApplicationWgId();
+    if ( windowGroupId )
+        {
+        CEikonEnv* eikonEnv = iEikonEnv;
+        TApaTask task( eikonEnv->WsSession() );
+        task.SetWgId( windowGroupId );
+        task.BringToForeground();
+        }
+
+    // In any case, send this application to the background.
+    ChangeApplicationFocus( EFalse );
+    __VTPRINTEXIT( "VtUi.BringTelephoneToForeground" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ChangeApplicationFocus
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ChangeApplicationFocus( const TBool aForeground )
+    {
+    __VTPRINTENTER( "VtUi.ChangeApplicationFocus" )
+    CEikonEnv* eikonEnv = iEikonEnv;
+    TApaTask task( eikonEnv->WsSession() );
+    task.SetWgId( iThisApplicationWgId );
+    if ( !aForeground )
+        {
+        task.SendToBackground();
+        }
+    else if ( !iUiStates->IsDeviceLockOn() )
+        {
+        task.BringToForeground();
+        }
+    __VTPRINTEXIT( "VtUi.ChangeApplicationFocus" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::TelephoneApplicationWgId
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::TelephoneApplicationWgId()
+    {
+    TInt resultWgId = 0;
+
+    TApaTaskList taskList( iEikonEnv->WsSession() );
+    TInt appUid = 0;
+
+    // Try first Telephone application.
+    if ( RProperty::Get(
+             KPSUidTelInformation,
+             KTelPhoneUid,
+             appUid ) == KErrNone )
+        {
+        TApaTask task = taskList.FindApp( TUid::Uid( appUid ) );
+        if ( task.Exists() )
+            {
+            resultWgId = task.WgId();
+            }
+        }
+
+    // Then Idle application.
+    if ( !resultWgId &&
+         ( RProperty::Get(
+               KPSUidAiInformation,
+               KActiveIdleUid,
+               appUid ) == KErrNone ) )
+        {
+        TApaTask task = taskList.FindApp( TUid::Uid( appUid ) );
+        if ( task.Exists() )
+            {
+            resultWgId = task.WgId();
+            }
+        }
+
+    return resultWgId;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShowNumberEntry
+// -----------------------------------------------------------------------------
+//
+inline TBool CVtUiAppUi::ShowNumberEntry() const
+    {
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::IsActiveIdleEnabledL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::IsActiveIdleEnabledL() const
+    {
+    TVtUiActiveIdleVariation activeIdleVariation;
+    return activeIdleVariation.IsActiveIdleEnabled();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CheckEngineFunctionality
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CheckEngineFunctionality()
+    {
+    const TBool prepareViewFinder =
+        iEventObserver->CommandSupportedAndSynchronous(
+             KVtEngPrepareViewFinder );
+    const TBool prepareRemoteRender =
+        iEventObserver->CommandSupportedAndSynchronous(
+            KVtEngPrepareRemoteRender );
+    const TBool prepareRemoteRenderDSA =
+        iEventObserver->CommandSupportedAndSynchronous(
+            KVtEngPrepareRemoteRenderDSA );
+    const TBool prepareRemoteRenderDP =
+        iEventObserver->CommandSupportedAndSynchronous(
+            KVtEngPrepareRemoteRenderDP );
+    const TBool stopViewFinder =
+        iEventObserver->CommandSupportedAndSynchronous(
+            KVtEngStopViewFinder );
+    const TBool startViewFinder =
+        iEventObserver->CommandSupportedAndSynchronous(
+            KVtEngStartViewFinder );
+    const TBool stopRemoteRender =
+        iEventObserver->CommandSupportedAndSynchronous(
+            KVtEngStopRenderRemote );
+    const TBool startRemoteRender =
+        iEventObserver->CommandSupportedAndSynchronous(
+            KVtEngStartRenderRemote );
+    const TBool setUIForeground =
+    	iEventObserver->CommandSupportedAndSynchronous(
+			KVtEngSetUIForeground );
+
+	TVtUiDPVariation dpvariation;
+    TBool dpSupported( dpvariation.IsDPSupported() );
+
+    if ( !prepareViewFinder ||
+         ( !prepareRemoteRender && !prepareRemoteRenderDSA && !dpSupported ) ||
+         ( !prepareRemoteRender && !prepareRemoteRenderDP && dpSupported ) ||
+         !stopViewFinder ||
+         !startViewFinder ||
+         !stopRemoteRender ||
+         !startRemoteRender ||
+         !setUIForeground )
+        {
+        // Not supported - should never occur.
+        __VTPRINT( DEBUG_GEN, "VtUi.EngineFunc.ASSERT" )
+        VtUiPanic::Panic( EVtUiPanicEngineFunctionalityAssert );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::Model
+// -----------------------------------------------------------------------------
+//
+CVtEngModel& CVtUiAppUi::Model()
+    {
+    return iEventObserver->Model();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::VideoTelephonyVariation
+// -----------------------------------------------------------------------------
+//
+const TVtUiVideoTelephonyVariation& CVtUiAppUi::VideoTelephonyVariation() const
+    {
+    return iVTVariation;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::NumberSource
+// -----------------------------------------------------------------------------
+//
+MVtUiNumberSource* CVtUiAppUi::NumberSource() const
+    {
+    return iNumberSource;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::NaviPaneL
+// -----------------------------------------------------------------------------
+//
+inline CAknNavigationControlContainer* CVtUiAppUi::NaviPaneL()
+    {
+    return
+        static_cast< CAknNavigationControlContainer* >
+            ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::TitlePaneL
+// -----------------------------------------------------------------------------
+//
+inline CAknTitlePane* CVtUiAppUi::TitlePaneL()
+    {
+    return
+        static_cast< CAknTitlePane* >
+            ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CleanupPushRefreshL
+// -----------------------------------------------------------------------------
+//
+inline void CVtUiAppUi::CleanupPushRefreshL()
+    {
+    CleanupStack::PushL(
+        TCleanupItem( DoRefresh, this ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CleanupPushEnableBlindL
+// -----------------------------------------------------------------------------
+//
+inline void CVtUiAppUi::CleanupPushEnableBlindL()
+    {
+    CleanupStack::PushL(
+        TCleanupItem( DoEnableBlindSetting, this ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::EnableCommandActivatingAndCleanupPushL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::EnableCommandActivatingAndCleanupPushL()
+    {
+    __VTPRINTENTER( "VtUi.EnableCommandActivatingAndCleanupPushL" )
+    // add anyway to cleanup stack to avoid caring about stack balance
+    CleanupStack::PushL(
+        TCleanupItem( DoDisableCommandActivating, this ) );
+    // but in case of consecutive calls on this don't refresh (avoid flicker)
+    const TBool alreadyActivating( iUiStates->IsCommandActivating() );
+    // increases ref.count if alread set as activating
+    iUiStates->SetIsCommandActivating( ETrue );
+    if ( !alreadyActivating )
+        {
+        // refresh only when ref.count incremented from zero.
+        iCommandManager->RefreshL();
+        }
+    __VTPRINTEXIT( "VtUi.EnableCommandActivatingAndCleanupPushL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DoDisableCommandActivating
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::DoDisableCommandActivating( TAny* aAny )
+    {
+    CVtUiAppUi* self =
+        reinterpret_cast< CVtUiAppUi* >( aAny );
+    TRAP_IGNORE( self->HandleCommandDeactivationL() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HandleCommandDeactivationL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HandleCommandDeactivationL()
+    {
+    __VTPRINTENTER( "VtUi.HandleCommandDeactivationL" )
+    iUiStates->SetIsCommandActivating( EFalse );
+    if ( !iUiStates->IsCommandActivating() )
+        {
+        RefreshStatesL();
+        }
+    __VTPRINTEXIT( "VtUi.HandleCommandDeactivationL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DoEnableBlindSetting
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::DoEnableBlindSetting( TAny* aAny )
+    {
+    CVtUiAppUi* self =
+        reinterpret_cast< CVtUiAppUi* >( aAny );
+    self->iUiStates->SetDisableBlindSetting( EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DoRefresh
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::DoRefresh( TAny* aAny )
+    {
+    CVtUiAppUi* self =
+        reinterpret_cast< CVtUiAppUi* >( aAny );
+    TRAP_IGNORE( self->RefreshL() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DoHandleExitTimeout
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::DoHandleExitTimeout( TAny* /*aAny*/ )
+    {
+    __VTPRINT( DEBUG_GEN, "VtUi.Exit.Timer.EXPIRED!" )
+    VtUiPanic::Panic( EVtUiPanicApplicationShutdownTimeout );
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiAppUi::IsViewFinderInMainPane
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::IsViewFinderInMainPane() const
+    {
+    return !( IsViewFinderInContextPane() );
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiAppUi::IsViewFinderInContextPane
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::IsViewFinderInContextPane() const
+    {
+    return ( iUplinkWindow == iInstance->iContextControl );
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiAppUi::SwitchViewFinderToMainPaneL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SwitchViewFinderToMainPaneL( TBool aUpdateState )
+    {
+    __VTPRINTENTER( "VtUi.SwitchViewFinderToMainPaneL" )
+    //change local video in to main pane
+    if( IsViewFinderInContextPane() )
+        {
+        //flag indicates the initial position of uplink window before freeze
+        if ( aUpdateState )
+            {
+            iUiStates->SetViewFindersInitialPlaceContextPane( ETrue );
+            }
+        HandleCommandL( EVtUiCmdSwapImagesPlaces );
+        }
+    else
+        {
+        if ( aUpdateState )
+            {
+            iUiStates->SetViewFindersInitialPlaceContextPane( EFalse );
+            }
+        }
+    __VTPRINTEXIT( "VtUi.SwitchViewFinderToMainPaneL" )
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiAppUi::SwitchViewFinderToContextPaneL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SwitchViewFinderToContextPaneL( TBool aUpdateState )
+    {
+    __VTPRINTENTER( "VtUi.SwitchViewFinderToContextPaneL" )
+    //change local video in to context pane
+    if( !IsViewFinderInContextPane() )
+        {
+        //flag indicates the initial position of uplink window before freeze
+        if ( aUpdateState )
+            {
+            iUiStates->SetViewFindersInitialPlaceContextPane( EFalse );
+            }
+        HandleCommandL( EVtUiCmdSwapImagesPlaces );
+        }
+    else
+        {
+        if ( aUpdateState )
+            {
+            iUiStates->SetViewFindersInitialPlaceContextPane( ETrue );
+            }
+        }
+    __VTPRINTEXIT( "VtUi.SwitchViewFinderToContextPaneL" )
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiAppUi::RestoreViewFinderL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RestoreViewFinderL()
+    {
+    __VTPRINTENTER( "VtUi.RestoreViewFinderL" )
+    if( IsViewFinderInContextPane() )
+        {
+        if( !iUiStates->IsViewFindersInitialPlaceContextPane() )
+            {
+            SwitchViewFinderToMainPaneL( EFalse );
+            }
+        }
+    else
+        {
+        if( iUiStates->IsViewFindersInitialPlaceContextPane() )
+            {
+            SwitchViewFinderToContextPaneL( EFalse );
+            }
+        }
+    __VTPRINTEXIT( "VtUi.RestoreViewFinderL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::DialogDismissedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::DialogDismissedL( TInt )
+    {
+    __VTPRINTENTER( "VtUi.DialogDismissedL" )
+    MVtUiFeature* tb =
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar );
+    if ( tb )
+        {
+        if ( !iTbPeriodic )
+            {
+            iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+            }
+        iTbPeriodic->Cancel();
+        // try to strat toolbar feature immediately
+        iTbPeriodic->Start( 0, KPeriodTime, TCallBack( DoTryToStartTbL, this ) );
+        }
+     __VTPRINTEXIT( "VtUi.DialogDismissedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::UpdateContextPaneIconL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::UpdateContextPaneIconL()
+    {
+    CEikStatusPane* statusPane = StatusPane();
+
+    if ( statusPane )
+        {
+        if ( statusPane->PaneCapabilities(
+            TUid::Uid( EEikStatusPaneUidContext ) ).IsPresent() )
+            {
+            CAknContextPane* contextPane = NULL;
+            TRAPD ( err, contextPane = static_cast<CAknContextPane*> (
+                statusPane->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) ) );
+            if ( err != KErrNone || ! contextPane )
+                {
+                return;
+                }
+
+            // Set a new context pane icon
+            CFbsBitmap* newBitmap = new(ELeave) CFbsBitmap;
+            CleanupStack::PushL( newBitmap );
+            User::LeaveIfError( newBitmap->Create( TSize( 1, 1 ), EGray2 ) );
+
+            CFbsBitmap* newMask = new(ELeave) CFbsBitmap;
+            CleanupStack::PushL( newMask );
+            User::LeaveIfError( newMask->Create( TSize( 1, 1 ), EGray2 ) );
+
+            // create an off-screen device and context
+            CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( newMask );
+            CleanupStack::PushL( bitmapDevice );
+            CFbsBitGc* maskGc = NULL;
+            User::LeaveIfError( bitmapDevice->CreateContext( maskGc ) );
+            User::LeaveIfNull( maskGc );
+            CleanupStack::PushL( maskGc );
+            maskGc->SetPenStyle( CGraphicsContext::ENullPen );
+            maskGc->SetBrushColor( TRgb::Gray2( 1 ) ); // transparency
+            maskGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
+            maskGc->Clear();
+            CleanupStack::PopAndDestroy( 2 ); // maskGc, bitmapDevice
+
+            // newBitmap, new Mask ownership transfer
+            contextPane->SetPicture( newBitmap, newMask );
+            CleanupStack::Pop( 2 ); // newBitmap, newMask
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetIncallBubbleAllowedInUsualL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetIncallBubbleAllowedInUsualL( TBool aAllowed )
+    {
+    __VTPRINT2( DEBUG_GEN, "Ui.SetIncallBubbleAllowedInUsualL: %d", aAllowed )
+
+    // If call is being disconnected, we do not want to show in-call bubble
+    // anymore but dismiss it.
+    if( iUiStates->ExecState() == TVtUiStates::EExecStateResetting ||
+        iUiStates->ExecState() == TVtUiStates:: EExecStateFinalized )
+        {
+        __VTPRINT2( DEBUG_GEN, "Ui.SetIncallBubbleAllowedInUsualL forced to false: %d", aAllowed )
+        aAllowed = EFalse;
+        }
+
+    if ( iIncallBubble )
+        {
+        iIncallBubble->SetIncallBubbleAllowedInUsualL( aAllowed );
+        }
+    __VTPRINT( DEBUG_GEN, "Ui.SetIncallBubbleAllowedInUsualL>" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ShowProgressDialogL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::ShowProgressDialogL( TInt aResourceId,
+    MProgressDialogCallback* aCallback )
+    {
+    __VTPRINTENTER( "VtUi.ShowProgressDialogL" )
+    if( iProgressDlg )
+        {
+        User::Leave( KErrNotReady );
+        }
+    iProgressDlg = new ( ELeave ) CAknProgressDialog(
+        reinterpret_cast<  CEikDialog** >( &iProgressDlg ), ETrue );
+    iProgressDlg->SetCallback( aCallback );
+    iProgressDlg->ExecuteLD( aResourceId );
+    __VTPRINTEXIT( "VtUi.ShowProgressDialogL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::HideProgressDialogL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::HideProgressDialogL()
+    {
+    __VTPRINTENTER( "VtUi.HideProgressDialogL" )
+    if( iProgressDlg )
+        {
+        iProgressDlg->ProcessFinishedL();
+        }
+    __VTPRINTEXIT( "VtUi.HideProgressDialogL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::AsyncViewFinderToMainPaneAndShare
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::AsyncViewFinderToMainPaneAndShare( TAny* aPtr )
+    {
+    __VTPRINTENTER( "VtUi.AsyncViewFinderToMainPaneAndShare" )
+    CVtUiAppUi* self = reinterpret_cast< CVtUiAppUi* >( aPtr );
+
+    TRAPD( result, { self->SwitchViewFinderToMainPaneL();
+    								 self->CmdShareImageL();} );
+    __VTPRINTEXITR( "VtUi.AsyncViewFinderToMainPaneAndShare %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::AsyncShare
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::AsyncShare( TAny* aPtr )
+    {
+    __VTPRINTENTER( "VtUi.AsyncShare" )
+    CVtUiAppUi* self = reinterpret_cast< CVtUiAppUi* >( aPtr );
+    TRAPD( result, self->CmdShareImageL() );
+    __VTPRINTEXITR( "VtUi.AsyncShare %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::AsyncShowErrorAndRestartShare
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::AsyncShowErrorAndRestartShare( TAny* aPtr )
+    {
+    __VTPRINTENTER( "VtUi.AsyncShowErrorAndRestartShare" )
+    CVtUiAppUi* self = reinterpret_cast< CVtUiAppUi* >( aPtr );
+    TRAPD( result, { self->ShowUnableToOpenNoteL();
+                    self->HandleCommandL( EVtUiCmdShareObjectImage ); } );
+    __VTPRINTEXITR( "VtUi.AsyncShowErrorAndRestartShare %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::GetCameraOrientations
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::GetCameraOrientations()
+    {
+    __VTPRINTENTER( "VtUi.GetCameraOrientations" )
+    MVtEngMedia& media = Model().Media();
+ 	media.GetCameraOrientations( iPrimaryCameraOrientation,
+ 	     iSecondaryCameraOrientation );
+    __VTPRINTEXIT( "VtUi.GetCameraOrientations" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetInitialCameraOrientationL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetInitialCameraOrientationL()
+    {
+    __VTPRINTENTER( "VtUi.SetInitialCameraOrientationL" )
+    MVtEngMedia::TCameraId cameraId;
+    MVtEngMedia& media( Model().Media() );
+    media.GetCurrentCameraId( cameraId );
+    MVtEngMedia::TCameraOrientation targetOrientation(
+        cameraId == MVtEngMedia::EPrimaryCamera ?
+            iPrimaryCameraOrientation :
+            ( cameraId == MVtEngMedia::ESecondaryCamera ?
+                iSecondaryCameraOrientation :
+                iCurrentCameraOrientation ) );
+    if ( iCurrentCameraOrientation != targetOrientation )
+        {
+        __VTPRINT3( DEBUG_GEN,
+            "VtUi.SetInitialCameraOrientationL Old=%d New=%d",
+                iCurrentCameraOrientation,
+                targetOrientation )
+        SetOrientationL( engToAppOrientation[ targetOrientation ] );
+        iCurrentCameraOrientation = targetOrientation;
+        }
+    __VTPRINTEXIT( "VtUi.SetInitialCameraOrientationL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::SetCameraOrientationL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::SetCameraOrientationL()
+    {
+    __VTPRINTENTER( "VtUi.SetCameraOrientationL" )
+    MVtEngMedia::TCameraOrientation newOrientation = iCurrentCameraOrientation;
+    MVtEngMedia::TCameraId cameraId;
+    MVtEngMedia& media = Model().Media();
+    if ( media.GetCurrentCameraId( cameraId ) == KErrNone )
+        {
+        switch ( cameraId )
+            {
+            case MVtEngMedia::EPrimaryCamera:
+                __VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient.Primary")
+                if( iCurrentCameraOrientation != iPrimaryCameraOrientation )
+                	{
+                	newOrientation = iPrimaryCameraOrientation;
+                	}
+                break;
+
+            case MVtEngMedia::ESecondaryCamera:
+            	__VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient.Secondary")
+            	if ( iCurrentCameraOrientation != iSecondaryCameraOrientation )
+                    {
+                	newOrientation = iSecondaryCameraOrientation;
+                	}
+                    break;
+
+            default:
+                break;
+            }
+        }
+
+    __VTPRINT2( DEBUG_GEN, "VtUi.SetCameraOrient.Cur=%d",
+        iCurrentCameraOrientation )
+    __VTPRINT2( DEBUG_GEN, "VtUi.SetCameraOrient.New=%d",
+        newOrientation )
+
+    if ( iCurrentCameraOrientation != newOrientation )
+        	{
+        	// map camera orientation to appui layout orientation
+        	TAppUiOrientation newAppUiOrientation;
+        	if ( newOrientation == MVtEngMedia::EOrientationLandscape )
+        	    {
+        	    __VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient=LS")
+        	    newAppUiOrientation = EAppUiOrientationLandscape;
+        	    }
+        	else if ( newOrientation == MVtEngMedia::EOrientationPortrait )
+        	    {
+        	    __VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient=PR")
+        	    newAppUiOrientation = EAppUiOrientationPortrait;
+        	    }
+        	else
+        	    {
+        	    __VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient=OL")
+        	    newAppUiOrientation = EAppUiOrientationUnspecified;
+        	    }
+        	SetOrientationL( newAppUiOrientation );
+        	}
+    __VTPRINTEXIT( "VtUi.SetCameraOrientationL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshStatesL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshStatesL()
+    {
+    __VTPRINTENTER( "VtUi.RefreshStatesL" )
+    // If transaction (set of commands) is pending refresh in delayed until
+    // all of them are processed.
+    if ( !iUiStates->IsCommandActivating() )
+        {
+        iUiStates->Update();
+        if ( iUiStates->IsThisApplicationForeground() )
+            {
+            iCommandManager->RefreshL();
+            }
+        }
+    __VTPRINTEXIT( "VtUi.RefreshStatesL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CmdAdjustVideoL
+// -----------------------------------------------------------------------------
+//
+ void CVtUiAppUi::CmdAdjustVideoL( TInt aCommand )
+    {
+        __VTPRINTENTER( "VtUi.CmdAdjustVideoL" )
+    TInt featureId( -1 );
+    switch ( aCommand )
+        {
+    case EVtUiCmdAdjustVideoVideoQuality:
+        featureId = EVtUiFeatureIdVideoQuality;
+        break;
+    case EVtUiCmdAdjustVideoWhiteBalance:
+        featureId = EVtUiFeatureIdWhiteBalance;
+        break;
+    case EVtUiCmdAdjustVideoBrightness:
+        featureId = EVtUiFeatureIdBrightness;
+        break;
+    case EVtUiCmdAdjustVideoContrast:
+        featureId = EVtUiFeatureIdContrast;
+        break;
+    case EVtUiCmdAdjustVideoColourTone:
+        featureId = EVtUiFeatureIdColourTone;
+        break;
+    default:
+        break;
+        }
+   MVtUiFeature* vb = iFeatureManager->GetFeatureById( featureId );
+   if ( vb )
+      {
+      __VTPRINT( DEBUG_GEN, "VtUi.CmdAdjustVideoL.StartL" );
+      vb->StartL();
+      }
+    __VTPRINTEXIT( "VtUi.CmdAdjustVideoL" )
+   }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::AppUiInitDoneDoPostInitL
+// -----------------------------------------------------------------------------
+//
+ void CVtUiAppUi::AppUiInitDoneDoPostInitL()
+    {
+    MVtUiFeature* tb = iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar );
+    if ( tb )
+        {
+        if ( !iTbPeriodic )
+            {
+            iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+            }
+        iTbPeriodic->Cancel();
+        // try to strat toolbar feature immediately
+        iTbPeriodic->Start( 0, KPeriodTime, TCallBack( DoTryToStartTbL, this ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::ProcessWsEventIfZoomModeIsActiveL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::ProcessWsEventIfZoomModeIsActiveL( const TWsEvent& aEvent )
+    {
+    __VTPRINTENTER( "VtUi.ProWsEvtIfZoomActivedL" )
+    const TInt type = aEvent.Type();
+    switch( type )
+        {
+        case EEventKey:
+        case EEventKeyUp:
+        case EEventKeyDown:
+            {
+            const TKeyEvent* keyEvent = aEvent.Key();
+
+
+            // Up and down arrow key events does the zooming,
+            // and should be forwarded to appui's key event handler.
+            // Also ETrue must be returned, so that other controls
+            // would not get these key events.
+            TEventCode eventCode = (TEventCode)aEvent.Type();
+            if ( keyEvent->iScanCode == EStdKeyUpArrow ||
+                keyEvent->iScanCode == EStdKeyDownArrow ||
+                keyEvent->iCode == EKeyZoomIn ||
+                keyEvent->iCode == EKeyZoomOut )
+                {
+                HandleKeyEventL( *keyEvent, eventCode );
+                __VTPRINTEXIT( "VtUi.ProWsEvtIfZoomActivedL" )
+                return ETrue;
+                }
+            __VTPRINT( DEBUG_GEN, "VtUi.HandleWsEventL zoom mode set" );
+            // If user selects zoom mode from options menu EEventKeyUp
+            // will be generated after that. Therefore this event must be
+            // ignored. Also EEventKeyDown are ignored. This means that
+            // only EEventKey events can dismiss the zoom mode.
+            if ( type != EEventKeyUp && type != EEventKeyDown )
+                {
+                 // If zoom mode is on only zoom mode button is available in
+                 // toolbar. Pressing the zoom mode button in toolbar
+                 // should not dismiss the zoom mode, that is why this events
+                 // are ignored. If toolbar is not available and
+                 // also EKeyDevice3 (selection key) event should dismiss
+                 // the zoom mode.
+                 if ( keyEvent->iCode != EKeyDevice3 ||
+                     ( keyEvent->iCode == EKeyDevice3 &&
+                     !iUiStates->IsToolbarAvailable() ) )
+                    {
+                    __VTPRINT( DEBUG_GEN, "VtUi.ProWsEvtIfZoomActivedL.EKeyDevice3" );
+                    SetZoomModeL( EFalse );
+                    }
+                }
+            }
+            break;
+
+        case EEventPointer:
+            __VTPRINT( DEBUG_GEN, "VtUi.ProWsEvtIfZoomActivedL.EEventPointer" );
+            break;
+
+        case KAknHardwareLayoutSwitch:
+            // Window server event used when layout changes
+            __VTPRINT( DEBUG_GEN, "VtUi.ProcessWsEventIfZoomModeIsActiveL.LayoutSwitch" );
+            break;
+
+        case EEventScreenDeviceChanged:
+            // The screen size mode has changed, for instance when  the cover on a phone 
+            // that supports screen flipping is opened or closed. 
+            __VTPRINT( DEBUG_GEN, "VtUi.ProcessWsEventIfZoomModeIsActiveL.ScreenChanged" );
+            break;
+
+		case EVtUiWsEventNumberSourceDeactivate:
+            // Number source deactivated
+            __VTPRINT( DEBUG_GEN, "VtUi.ProWsEvtIfZoomActivedL.NumberDeactivate" );
+            break;
+
+        default:
+            __VTPRINT( DEBUG_GEN, "VtUi.ProWsEvtIfZoomActivedL.default" );
+            // EVtUiWsEventNumberSourceActivate could be generated through number buttons
+            // and execution runs to default statement
+            SetZoomModeL( EFalse );
+            break;
+            }
+    __VTPRINTEXIT( "VtUi.ProWsEvtIfZoomActivedL2" )
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::StopSliders()
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::StopSliders()
+    {
+    __VTPRINTENTER( "VtUi.StopSliders" )
+    if( iUiStates->IsBrightnessModeOn() )
+        {
+        // if brightness feature is active, stop that
+        MVtUiFeature* br = iFeatureManager->GetFeatureById( EVtUiFeatureIdBrightness );
+        if ( br )
+            {
+            if ( br->State() ==  MVtUiFeature::EActive )
+                {
+                __VTPRINT( DEBUG_GEN, "VtUi.StopSliders br->STOP" )
+                br->Stop();
+                }
+            }	
+        }
+    // if contrast feature is active, stop that
+    if( iUiStates->IsContrastModeOn() )
+        {
+        // if contrast feature is active, stop that
+        MVtUiFeature* cr = iFeatureManager->GetFeatureById( EVtUiFeatureIdContrast );
+        if ( cr )
+            {
+            if ( cr->State() ==  MVtUiFeature::EActive )
+                {
+                __VTPRINT( DEBUG_GEN, "VtUi.StopSliders cr->STOP" )
+                cr->Stop();
+                }
+            }
+        }
+    // if volume feature is active, stop that
+    if( iUiStates->IsVolumeModeOn() )
+        {
+        // if volume feature is active, stop that
+        MVtUiFeature* vl = iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume );
+        if ( vl )
+            {
+            if ( vl->State() ==  MVtUiFeature::EActive )
+                {
+                __VTPRINT( DEBUG_GEN, "VtUi.StopSliders vl->STOP" )
+                vl->Stop();
+                }
+            }
+        }
+    // if zoom feature is active, stop that
+    if( iUiStates->IsZoomModeOn() )
+        {
+        // if zoom feature is active, stop that
+        MVtUiFeature* zm = iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom );
+        if ( zm )
+            {
+            if ( zm->State() ==  MVtUiFeature::EActive )
+                {
+                __VTPRINT( DEBUG_GEN, "VtUi.StopSliders zm->STOP" )
+                zm->Stop();
+                }
+            }
+        }   
+    __VTPRINTEXIT( "VtUi.StopSliders" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CanSwapImagePlaces()
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::CanSwapImagePlaces()
+    {
+    __VTPRINTENTER( "VtUi.CanSwapImagePlaces" )
+    TTime now; 
+    now.HomeTime();
+    // User can swap image places if the frequency is lower than maximum frequency. 
+    if ( now.MicroSecondsFrom( iLastSwapTime ).Int64() >= KVtUiMaxSwapImagesFreq ) 
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.Swap can swap image" )
+        iLastSwapTime = now;  
+        return ETrue;
+        }
+    else
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.Swap can not swap image" )
+        return EFalse;
+        }
+    __VTPRINTEXIT( "VtUi.CanSwapImagePlaces" )
+    }
+
+// Implementation of CVtUiAppUi::CInstance
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CInstance::CInstance
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CInstance::CInstance( CVtUiAppUi& aAppUi )
+    : iAppUi( aAppUi )
+    {
+    }
+
+void CVtUiAppUi::CInstance::CreateRemoteVideoControl()
+    {    
+    iRemoteVideoControl = CVtUiRemoteVideoControl::NewL( iAppUi );
+    iRemoteVideoControl->MakeVisible(EFalse);
+    iMainControl->SetRemoteVideoControl( iRemoteVideoControl );
+    iMainControl->LayoutRemoteVideo();
+    
+    iAppUi.AddToStackL( iRemoteVideoControl );
+    
+    iRemoteVideoControlInStack = ETrue;
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CInstance::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CInstance::ConstructL()
+    {
+    iBitmapManager = new ( ELeave ) CVtUiBitmapManager;
+
+    TRect parent;
+    TAknWindowLineLayout control;
+
+    VtUiLayout::GetApplicationParentRect( parent );
+    iMainControl = CVtUiMainControl::NewL( *iBitmapManager,
+         *iAppUi.iUiStates  );
+
+    VtUiLayout::GetMainPaneLayout( control );
+    AknLayoutUtils::LayoutControl( iMainControl, parent, control );
+
+    iAppUi.AddToStackL( iMainControl );
+    iMainControlInStack = ETrue;
+
+    TAknLayoutRect layout;
+    layout.LayoutRect( parent, control );
+    iNumberEntryActivation =
+        new ( ELeave ) CVtUiNumberEntryActivationControl( iAppUi );
+    iNumberEntryActivation->ConstructL( layout.Rect() );
+
+    iContextControl = CVtUiContextControl::NewL(
+            *iBitmapManager,
+            iAppUi,
+            *iAppUi.iUiStates );
+
+    VtUiLayout::GetFirstWindowBackgroundLayout(
+        control );
+    AknLayoutUtils::LayoutControl( iContextControl, parent, control );
+    iAppUi.AddToStackL( iContextControl );
+    iContextControlInStack = ETrue;
+
+    iNaviPane =
+        CVtUiNaviPane::NewL(
+            *( iAppUi.NaviPaneL() ),
+            iAppUi );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CInstance::LayoutChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CInstance::LayoutChanged()
+    {
+    // Layout controls.
+    TRect parent;
+    TAknWindowLineLayout control;
+    VtUiLayout::GetApplicationParentRect( parent );
+    VtUiLayout::GetMainPaneLayout( control );
+    AknLayoutUtils::LayoutControl( iMainControl, parent, control );
+    if(iMainControl)
+        iMainControl->LayoutRemoteVideo();
+    AknLayoutUtils::LayoutControl( iNumberEntryActivation, parent, control );
+    VtUiLayout::GetFirstWindowBackgroundLayout( control );
+    AknLayoutUtils::LayoutControl( iContextControl, parent, control );
+    if(iContextControl)
+        iContextControl->LayoutRemoteVideo();
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CInstance::VolumeKeyPressedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CInstance::VolumeKeyPressedL()
+    {
+    __VTPRINTENTER( "CVtUiAppUi.VolumeKeyPressedL" )
+    // if the application is in foreground show volume sliders
+    if ( iAppUi.IsForeground() )
+        {
+        // If application is shutting down, no need to show volume popup
+        if ( iAppUi.iState == NULL ||
+             iAppUi.iState ==
+                TVtUiStateResetting::InstanceL( iAppUi, *iAppUi.iUiStates ) )
+            {
+            return;
+            }
+
+        CVtUiVolume* volume = static_cast< CVtUiVolume* >(
+            iAppUi.iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume ) );
+        if ( volume )
+            {
+            // If the capture mode is on we should
+            // end the capture mode
+            if( iAppUi.iUiStates->IsCaptureModeOn() )
+                {
+                iAppUi.CmdCancelCaptureL();
+                }
+            volume->StartL();
+            }
+        }
+    __VTPRINTEXIT( "CVtUiAppUi.VolumeKeyPressedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CInstance::NewL
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CInstance* CVtUiAppUi::CInstance::NewL( CVtUiAppUi& aAppUi )
+    {
+    CInstance* self = new ( ELeave ) CInstance( aAppUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CInstance::~CInstance
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CInstance::~CInstance()
+    {
+    if ( iMainControl && iMainControlInStack )
+        {
+        iAppUi.RemoveFromStack( iMainControl );
+        }
+    if ( iContextControl && iContextControlInStack )
+        {
+        iAppUi.RemoveFromStack( iContextControl );
+        }
+    if(iRemoteVideoControl &&iRemoteVideoControlInStack)
+        {
+        iAppUi.RemoveFromStack( iRemoteVideoControl );
+        }
+    delete iMainControl;
+    delete iContextControl;
+    delete iRemoteVideoControl;
+    delete iNumberEntryActivation;
+    delete iNaviPane;
+    delete iBitmapManager;
+    }
+
+// Implementation of CVtUiAppUi::CEventObserver
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::CEventObserver
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CEventObserver::CEventObserver( CVtUiAppUi& aAppUi )
+    : iAppUi( aAppUi ),
+      iCommandObservers( KVtUiCommandObserverArrayGranularity )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::ConstructL()
+    {
+    iModel = CVtEngModel::NewL( *this, *this );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::NewL
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CEventObserver* CVtUiAppUi::CEventObserver::NewL(
+        CVtUiAppUi& aAppUi )
+    {
+    CEventObserver* self = new ( ELeave ) CEventObserver( aAppUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::~CEventObserver
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CEventObserver::~CEventObserver()
+    {
+    iCommandObservers.Close();
+
+    delete iModel;
+    delete iBeat;
+
+    delete iRemConInterfaceSelector;
+    iRemConCoreApiTarget = NULL; // not owned.
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::Model
+// -----------------------------------------------------------------------------
+//
+inline CVtEngModel& CVtUiAppUi::CEventObserver::Model()
+    {
+    return *iModel;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::CreateRemConSessionL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::CreateRemConSessionL()
+    {
+    __VTPRINTENTER( "VtUiComms.CreateRemCon" )
+    // If one of the iRemCon* pointers equals to NULL, then all of them are
+    // NULL.
+    if ( !iRemConInterfaceSelector )
+        {
+        CRemConInterfaceSelector* interfaceSelector =
+            CRemConInterfaceSelector::NewL();
+        CleanupStack::PushL( interfaceSelector );
+
+        CRemConCoreApiTarget* coreApiTarget =
+            CRemConCoreApiTarget::NewL( *interfaceSelector, *this );
+        // The coreApiTarget instance is owned by interfaceSelector instance.
+        // This instance must implement MRemConCoreApiTargetObserver interface.
+        CleanupStack::PushL( coreApiTarget );
+        interfaceSelector->OpenTargetL();
+
+        iRemConVolumeRepeatTimer = CPeriodic::NewL( CActive::EPriorityHigh );
+
+        CleanupStack::Pop( coreApiTarget );
+        CleanupStack::Pop( interfaceSelector );
+
+        iRemConInterfaceSelector = interfaceSelector;
+        iRemConCoreApiTarget = coreApiTarget;
+        }
+    __VTPRINTEXIT( "VtUiComms.CreateRemCon" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::DeleteRemConSession
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::DeleteRemConSession()
+    {
+    delete iRemConVolumeRepeatTimer;
+    iRemConVolumeRepeatTimer = NULL;
+
+    delete iRemConInterfaceSelector;
+    iRemConInterfaceSelector = NULL;
+
+    iRemConCoreApiTarget = NULL; // not owned.
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::CommandSupported
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::CEventObserver::CommandSupported(
+        const TInt aCommandId ) const
+    {
+    const TInt caps = iModel->CommandHandler().GetCommandCaps( aCommandId );
+    return
+        ( caps >= KErrNone ) &&
+        ( caps & MVtEngCommandHandler::EAttribSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::CommandSupportedAndSynchronous
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::CEventObserver::CommandSupportedAndSynchronous(
+        const TInt aCommandId ) const
+    {
+    const TInt caps = iModel->CommandHandler().GetCommandCaps( aCommandId );
+    return
+        ( caps >= KErrNone ) &&
+        ( caps & MVtEngCommandHandler::EAttribSupported ) &&
+        ( ~caps & MVtEngCommandHandler::EAttribAsync );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::AddObserverL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::AddObserverL(
+        MVtEngCommandObserver& aObserver )
+    {
+    User::LeaveIfError(
+        iCommandObservers.Append( &aObserver ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::RemoveObserver
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::RemoveObserver(
+        MVtEngCommandObserver& aObserver )
+    {
+    const TInt pos = iCommandObservers.Find( &aObserver );
+    if ( pos != KErrNotFound )
+        {
+        if ( !iInCommandPerformed )
+            {
+            iCommandObservers.Remove( pos );
+            }
+        else
+            {
+            iCommandObservers[ pos ] = NULL;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::StartBeatL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::StartBeatL()
+    {
+    if ( !iBeat )
+        {
+        iBeat = CHeartbeat::NewL( CActive::EPriorityStandard );
+        }
+
+    if ( !iBeat->IsActive() )
+        {
+        iBeat->Start( ETwelveOClock, this );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::StopBeat
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::StopBeat()
+    {
+    delete iBeat;
+    iBeat = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::StopVolumeRepeatTimer
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::StopVolumeRepeatTimer()
+    {
+    iRemConVolumeRepeatTimer->Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::HandleVtEventL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::HandleVtEventL(
+        TInt aEvent )
+    {
+    __VTPRINTENTER( "VtUiComms.HandleVtEventL" )
+    __VTPRINT2( DEBUG_GEN, "VtUi.HandleEvt=%d", aEvent )
+
+    /** Allow application state to handle event first. It may also deny further
+      * handling by indicating the event was handled */
+    if ( iAppUi.iState &&
+        iAppUi.iState->HandleVtEventL( aEvent )
+            == TVtUiAppStateBase::EEventHandled )
+        {
+        __VTPRINTEXITR( "VtUiComms.HandleVtEventL %d", 0 )
+        return;
+        }
+
+    TInt callBits = EVtUiRefreshStates;
+
+    // New camera orientation
+    switch( aEvent )
+        {
+        case KVtEngSourceChanged:
+            callBits |= EVtUiSetOrientation;
+            break;
+        default:
+            break;
+        }
+        
+    switch( aEvent )
+        {
+        case KVtEngSourceChanged:
+            callBits |= EVtUiStopWBOrColortone;
+            break;
+        default:
+            break;
+        }
+    
+    switch( aEvent )
+        {
+        case KVtEngSessionWaitingCallActive:
+        case KVtEngSessionWaitingCallInactive:
+        	iAppUi.HandleWaitingStateChange(
+        		aEvent == KVtEngSessionWaitingCallActive );
+	        break;
+        default:
+            break;
+        }
+    switch( aEvent )
+        {
+        case KVtEngShareImageInitializeBegin:
+            callBits |= EVtUiShowImageInitializingProgress;
+            break;
+
+        case KVtEngShareImageInitializeEnd:
+            callBits |= EVtUiHideImageInitializingProgress;
+            break;
+
+        case KVtEngShareImageDecodingError:
+            callBits |= EVtUiShowDecodingError;
+            break;
+
+        default:
+            break;
+        }
+
+    // Handle rendering problems.
+    switch ( aEvent )
+        {
+        case KVtEngRemoteRenderingProblem:
+            callBits |= EVtUiHandleVideoFrameRemoteProblem;
+            break;
+
+        case KVtEngViewFinderStopped:
+        case KVtEngLocalRenderingProblem:
+            callBits |= EVtUiHandleVideoFrameLocalProblem;
+            break;
+
+        default:
+            break;
+        }
+
+    // Refresh navipane.
+    switch ( aEvent )
+        {
+        case KVtEngSourceChanged:
+        case KVtEngCameraChanged:
+        case KVtEngSessionStateChanged:
+        case KVtEngDurationSettingChanged:
+        case KVtEngAudioOutputVolumeChanged:
+        case KVtEngAudioRoutingChanged:
+        case KVtEngAudioMuted:
+        case KVtEngAudioUnmuted:
+            callBits |= EVtUiRefreshNaviPane;
+            break;
+
+        default:
+            break;
+        }
+
+    // Refresh softkeys.
+    switch ( aEvent )
+        {
+        case KVtEngSourceChanged:
+        case KVtEngSourceCapsChanged:
+        case KVtEngSessionAnswerPossible:
+        case KVtEngSessionStateChanged:
+        case KVtEngAudioRoutingChanged:
+        case KVtEngAudioRoutingAvailabilityChanged:
+        case KVtEngAudioMuted:
+        case KVtEngAudioUnmuted:
+        case KVtEngLCHProviderSwitchDone:
+            callBits |= EVtUiRefreshSoftkeys;
+            break;
+
+        default:
+            break;
+        }
+
+    // Refresh blind status
+    switch ( aEvent )
+        {
+        case KVtEngSourceChanged:
+        case KVtEngRemoteVideoPaused:
+        case KVtEngRemoteVideoResumed:
+        case KVtEngRemoteVideoStarted:
+        case KVtEngRemoteVideoStopped:
+        case KVtEngLCHProviderSwitchDone:
+            callBits |= EVtUiRefreshBlind;
+            break;
+
+        default:
+            break;
+        }
+
+    // Check if it's required to stop "waiting image" display.
+    switch ( aEvent )
+        {
+        case KVtEngRemoteVideoResumed:
+        case KVtEngRemoteVideoStarted:
+            callBits |= EVtUiStopWaitingImage;
+            break;
+
+        default:
+            break;
+        }
+
+    // Check if it is needed to set a new layout for remote renderer.
+    switch ( aEvent )
+        {
+        case KVtEngResolutionToQCIF:
+            callBits |= EVtUiChangeRemoteVideoLayout;
+            iAppUi.RemoteVideoIsSQCif( EFalse );
+            break;
+        case KVtEngResolutionToSQCIF:
+            callBits |= EVtUiChangeRemoteVideoLayout;
+            iAppUi.RemoteVideoIsSQCif( ETrue );
+            break;
+        default:
+            break;
+        }
+
+    switch ( aEvent )
+        {
+        case KVtEngAudioRoutingChanged:
+        case KVtEngAudioRoutingAvailabilityChanged:
+        case KVtEngMediaOutgoingVideoChannelStatusChanged:
+        case KVtEngMediaOutgoingAudioChannelStatusChanged:
+             callBits |= EVtUiMediaStateChanged;
+            break;
+
+        case KVtEngAudioVolumeMin:
+            iAppUi.KeySounds()->PlaySound( EAvkonSIDVolumeMinTone );
+            break;
+
+       case KVtEngAudioVolumeMax:
+            iAppUi.KeySounds()->PlaySound( EAvkonSIDVolumeMaxTone );
+            break;
+
+        default:
+            break;
+        }
+    
+    // Refresh Menu.
+    switch ( aEvent )
+        {
+        case KVtEngSourceChanged:
+            callBits |= EVtUiRefreshMenu;
+            callBits |= EVtUiStopBrightnessOrContrast;
+            callBits |= EVtUiRefreshZoomPopup;
+            break;
+        default:
+            break;
+        }
+
+    TRAP_IGNORE ( DoExecuteL( callBits ) );
+    __VTPRINTEXITR( "VtUiComms.HandleVtEventL %d", 1 )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::HandleVTCommandPerformedL(
+        TVtEngCommandId aCommand,
+        const TInt aError )
+    {
+    __VTPRINTENTER( "VtUiComms.HandleVTCommandPerformedL" )
+
+    if ( iAppUi.iState &&
+         iAppUi.iState->HandleVTCommandPerformedL( aCommand, aError ) ==
+         TVtUiAppStateBase::EEventHandled )
+        {
+        // state didn't allow further processing of command completion
+        __VTPRINTEXITR( "VtUiComms.HandleVTCommandPerformedL %d", 0 )
+        return;
+        }
+    iAppUi.RefreshStatesL();
+
+    if ( aCommand == KVtEngMuteOutgoingAudio ||
+         aCommand == KVtEngUnmuteOutgoingAudio )
+         {
+         iAppUi.RefreshL();
+         }
+
+    const TInt count = iCommandObservers.Count();
+    TInt nullPosition = KErrNotFound;
+
+    iInCommandPerformed = ETrue;
+
+    // iInCommandPerformed equals ETrue while inside the following loop;
+    // Exceptions must not be raised.
+    for ( TInt index = 0; index < count; index++ )
+        {
+        MVtEngCommandObserver* obs = iCommandObservers[ index ];
+        if ( obs )
+            {
+            TRAP_IGNORE( obs->HandleVTCommandPerformedL( aCommand, aError ) );
+            }
+        else
+            {
+            // We store only one position; eventually all NULL elements of the
+            // array will be removed.
+            nullPosition = index;
+            }
+        }
+    iInCommandPerformed = EFalse;
+
+    if ( nullPosition != KErrNotFound )
+        {
+        iCommandObservers.Remove( nullPosition );
+        }
+
+    // Specific handling of some commands:
+    if ( aCommand == KVtEngResetEngine ) // Engine has been reset
+        {
+        __ASSERT_ALWAYS( !aError, VtUiPanic::Panic( EVtUiPanicResetFailed ) );
+        iAppUi.HandleEngineResetL();
+        }
+    else if ( ( aCommand == KVtEngInitializeShareImage ) ||
+              ( aCommand == KVtEngStartShareImage ) )
+        {
+        __VTPRINT3( DEBUG_GEN,
+            "VtUi.HandleVTCommandPerformedL cmd=%d err=%d", aCommand, aError );
+        if( aError != KErrNone )
+            {
+            // stop toolbar feature to prevent drawing over error dialog
+           MVtUiFeature* tb = iAppUi.iFeatureManager->
+           GetFeatureById( EVtUiFeatureIdToolbar );
+            if ( tb )
+                {
+                tb->Stop();
+                }
+            iAppUi.iAsyncCallback->Set(
+                TCallBack( &AsyncShowErrorAndRestartShare, &iAppUi ) );
+            iAppUi.iAsyncCallback->CallBack();
+            }
+        else if( aCommand == KVtEngInitializeShareImage )
+            {
+            if ( iAppUi.iUiStates->IsViewFinderToMainPane()  )
+                {
+                iAppUi.iAsyncCallback->Set(
+                    TCallBack( &AsyncViewFinderToMainPaneAndShare, &iAppUi ) );
+                }
+            else
+                {
+                iAppUi.iAsyncCallback->Set(
+                    TCallBack( &AsyncShare, &iAppUi ) );
+                }
+            iAppUi.iAsyncCallback->CallBack();
+            }
+        }
+    else if ( iAppUi.iUiStates->IsLayoutChangeNeeded() && 
+            ( aCommand  == KVtEngMuteOutgoingAudio || 
+            aCommand  == KVtEngUnmuteOutgoingAudio ||
+            aCommand  == KVtEngSetAudioRouting ||
+            aCommand  == KVtEngSetAudioVolume ||
+            aCommand  == KVtEngSetSource ||
+            aCommand  == KVtEngPrepareCamera ||
+            aCommand  == KVtEngUnfreeze ) )
+        {
+        iAppUi.iUiStates->SetLayoutChangeNeeded( EFalse );
+        iAppUi.DoHandleLayoutChangedL();
+        }
+    __VTPRINTEXITR( "VtUiComms.HandleVTCommandPerformedL %d", 1 )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::vtHandleFrameL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::vtHandleFrameL(
+        TFrameType aType,
+        CFbsBitmap* aBitmap )
+    {
+    static TUint32 lastTick = 0;
+    static TBool flag = EFalse;
+            
+        
+    CEikMenuBar* menuBar = (STATIC_CAST(CEikonEnv*, this->iAppUi.iCoeEnv))->AppUiFactory()->MenuBar();
+    if ( menuBar && menuBar->IsDisplayed() )
+         {
+         if ( !flag )
+            {
+            flag = ETrue;
+            lastTick = User::NTickCount();
+            }
+         else
+            {
+            TUint32 newTick = User::NTickCount();
+
+            //don't consider time wrap
+            //one frame per 200ms
+            if ( newTick - lastTick < 400 )
+                {
+                __VTPRINTEXITR( "CVtUiAppUi::CEventObserver::vtSetFrame %d", 0 )
+                return;
+                }
+            else
+                {
+                lastTick = newTick;
+                }
+            }
+         }
+    else
+        {
+        flag = EFalse;
+        }
+    	
+    TBool local = EFalse;
+    switch ( aType )
+        {
+        case ELocalVideoFrame:
+            local = ETrue;
+            break;
+
+        case ERemoteVideoFrame:
+        default:
+            break;
+        }
+
+    iAppUi.HandleVideoFrameL( local, aBitmap );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::vtSetFrame
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::vtSetFrame(
+        TFrameType aType,
+        CFbsBitmap* aBitmap )
+    {
+    TBool local = EFalse;
+    switch ( aType )
+        {
+        case ELocalVideoFrame:
+            local = ETrue;
+            break;
+
+        case ERemoteVideoFrame:
+        default:
+            break;
+        }
+
+    iAppUi.SetVideoFrame( local, aBitmap );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::Beat
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::Beat()
+    {
+    iAppUi.HandleBeat();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::Synchronize
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::Synchronize()
+    {
+    iAppUi.HandleBeat();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::DoExecuteL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::DoExecuteL( TInt aBits )
+    {
+    __VTPRINT2( DEBUG_GEN, "VtUi.DoExec.bits=%d", aBits )
+
+    // Array of methods - leaving methods are allowed.
+    const TMethodL methodArray[] =
+        {
+        &CVtUiAppUi::RefreshStatesL,
+        &CVtUiAppUi::HandleVideoFrameRemoteProblemL,
+        &CVtUiAppUi::HandleVideoFrameLocalProblemL,
+        &CVtUiAppUi::RefreshNaviPaneL,
+        &CVtUiAppUi::RefreshSoftkeysL,
+        &CVtUiAppUi::RefreshBlind,
+        &CVtUiAppUi::StopWaitingImage,
+        &CVtUiAppUi::ChangeRemoteVideoLayoutL,
+        &CVtUiAppUi::ShowImageInitializeProgressL,
+        &CVtUiAppUi::HideImageInitializeProgressL,
+        &CVtUiAppUi::SetCameraOrientationL,
+        &CVtUiAppUi::MediaStateChangedL,
+        &CVtUiAppUi::ShowImageDecodingErrorNoteL,
+        &CVtUiAppUi::StopWhiteBalanceOrColortone,
+        &CVtUiAppUi::RefreshMenuL,
+        &CVtUiAppUi::StopBrightnessOrContrast,
+        &CVtUiAppUi::RefreshZoomPopupL
+        };
+    const TInt count = ( sizeof( methodArray ) / sizeof ( TMethodL ) );
+
+    // Execute selected methods.
+    while ( aBits )
+        {
+        for ( TInt index = 0; ( index < count ) && aBits; index++ )
+            {
+            const TInt mask = ( 1 << index );
+            if ( aBits & mask )
+                {
+                // Bit is set if corresponding method
+                // is wanted to be executed.
+
+                aBits &= ~mask;
+                TMethodL method = methodArray[ index ];
+                ( iAppUi.*method )(); // may leave
+                }
+            }
+        aBits = 0; // for loop executed successfully.
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::HandleVolumeChange
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::HandleVolumeChange(
+        TRemConCoreApiButtonAction aButtonAct )
+    {
+   __VTPRINTENTER( "VtUi.HandleVolumeChange" )
+    // Order of the events is as follows:
+    //      Click - Immediately when key is pressed down
+    //      Press - After 0.6 seconds
+    //      Release - When key is released after 0.6 seconds
+    //
+    // Thus, the following sequences are possible from single keypress:
+    //      <Click>
+    //      <Click> <0.6 sec pause> <Press> <indefinite pause> <Release>
+
+    switch ( aButtonAct )
+        {
+        case ERemConCoreApiButtonPress:
+        	__VTPRINT( DEBUG_GEN, "VtUi.HandleVolumeChange.ButtonPress" )
+        	TRAP_IGNORE( iAppUi.AdjustVolumeL( iRCCAOperationId ) );
+			TRAP_IGNORE( iAppUi.RefreshVolumeL() );
+            TRAP_IGNORE( iAppUi.iInstance->VolumeKeyPressedL() );
+             
+            iRemConVolumeRepeatTimer->Start(
+                KVtUiVolumeRepeatLongDelay,
+                KVtUiVolumeRepeatDelay,
+                TCallBack( DoHandleVolumeRepeat, this ) );
+          
+            break;
+
+        case ERemConCoreApiButtonRelease:
+            __VTPRINT( DEBUG_GEN, "VtUi.HandleVolumeChange.ButtonRelease" )
+            iRCCAOperationId = ENop;
+            TRAP_IGNORE( iAppUi.iInstance->VolumeKeyPressedL() );
+            break;
+
+        case ERemConCoreApiButtonClick:
+            __VTPRINT( DEBUG_GEN, "VtUi.HandleVolumeChange.ButtonClick" )
+             TRAP_IGNORE( iAppUi.AdjustVolumeL( iRCCAOperationId ) );
+             TRAP_IGNORE( iAppUi.RefreshVolumeL() );
+             TRAP_IGNORE( iAppUi.iInstance->VolumeKeyPressedL() );
+            break;
+
+        default:
+            break;
+        }
+    __VTPRINTEXIT( "VtUi.HandleVolumeChange" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::HandleRemMuteChange
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::HandleRemMuteChange(
+        TRemConCoreApiButtonAction aButtonAct )
+    {
+    __VTPRINTENTER( "VtUi.EventObserver.HandleRemMuteChange" )
+    TBool AudioEn (EFalse );
+    AudioEn = iAppUi.iUiStates->AudioState().IsAudio();
+    if( AudioEn )
+        iAppUi.HandleCommandL( EVtUiCmdDisableAudio );
+    else
+        iAppUi.HandleCommandL( EVtUiCmdEnableAudio );
+    __VTPRINTEXIT( "VtUi.EventObserver.HandleRemMuteChange" )
+    }
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::DoHandleVolumeRepeat
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppUi::CEventObserver::DoHandleVolumeRepeat( TAny* aAny )
+    {
+    __VTPRINTENTER( "VtUi.SvkRpt" )
+    CEventObserver* self = reinterpret_cast< CEventObserver* >( aAny );
+    TRAP_IGNORE( self->iAppUi.AdjustVolumeL( self->iRCCAOperationId ) );
+    TRAP_IGNORE( self->iAppUi.RefreshVolumeL() );
+    __VTPRINTEXIT( "VtUi.SvkRpt" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::RefreshVolumeL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::RefreshVolumeL()
+    {
+    __VTPRINTENTER( "VtUi.RefreshVolumeL" )
+    // Refresh volume
+    CVtUiVolume* volume = static_cast< CVtUiVolume* >(
+        iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume ) );
+    if ( volume )
+        {
+        volume->RefreshL();
+        }
+    __VTPRINTEXIT( "VtUi.RefreshVolumeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::AdjustVolumeL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::AdjustVolumeL( TRemConCoreApiOperationId aOperationId )
+    {
+    __VTPRINTENTER( "VtUi.AdjustVolumeL" )
+    __VTPRINT2( DEBUG_GEN,
+        "VtUi.AdjustVolumeL aOperationId = %d", aOperationId )
+    TInt command( KVtEngCommandNone );
+    switch ( aOperationId )
+        {
+    case ERemConCoreApiVolumeDown:
+        command = KVtEngDecreaseAudioVolume;
+        break;
+
+    case ERemConCoreApiVolumeUp:
+        command = KVtEngIncreaseAudioVolume;
+        break;
+
+    default:
+        break;
+        }
+
+    if ( command != KVtEngCommandNone )
+        {
+        ExecuteCmdL( command );
+        }
+    __VTPRINTEXIT( "VtUi.AdjustVolumeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CEventObserver::MrccatoCommand
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CEventObserver::MrccatoCommand(
+        TRemConCoreApiOperationId aOperationId,
+        TRemConCoreApiButtonAction aButtonAct )
+    {
+     __VTPRINTENTER( "VtUi.MrccatoCommand" )
+    // Side volume keys will also dismiss zoom mode if zoom mode is active
+    if ( iAppUi.iUiStates->IsZoomModeOn() )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.MrccatoCommand1" )
+        TRAP_IGNORE( iAppUi.SetZoomModeL( EFalse ));
+        }
+
+    iRemConVolumeRepeatTimer->Cancel();
+    iRCCAOperationId = aOperationId;
+    switch ( aOperationId )
+        {
+        case ERemConCoreApiVolumeUp:
+            // if volume in maximum value and volume up is pressed
+            // volume indicator must still be shown for a while if
+            //  muted or call duration is shown in navipane
+            __VTPRINT( DEBUG_GEN, "VtUi.MrccatoCommand ERemConCoreApiVolumeUp" )
+            HandleVolumeChange( aButtonAct );
+            break;
+
+        case ERemConCoreApiVolumeDown:
+            // if volume in minimun value and volume down is pressed
+            // volume indicator must still be shown for a while if
+            //  muted or call duration is shown in navipane
+            __VTPRINT( DEBUG_GEN, "VtUi.MrccatoCommand ERemConCoreApiVolumeDown" )
+            HandleVolumeChange( aButtonAct );
+            break;
+        case ERemConCoreApiMute:
+            __VTPRINT( DEBUG_GEN, "VtUi.MrccatoCommand ERemConCoreApiMute" )
+            HandleRemMuteChange( aButtonAct );
+        default:
+            // Other commands ignored.
+            break;
+        }
+ __VTPRINTEXIT( "VtUi.MrccatoCommand" )
+    }
+
+// Implementation of CVtUiAppUi::CVtUiAppUiMGVerifier
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CVtUiAppUiMGVerifier::NewLC
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CVtUiAppUiMGVerifier* CVtUiAppUi::CVtUiAppUiMGVerifier::NewLC(
+    CVtUiAppUi& aAppUi, CCoeEnv& aCoeEnv )
+    {
+    CVtUiAppUiMGVerifier* self = new ( ELeave )
+        CVtUiAppUiMGVerifier( aAppUi, aCoeEnv );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CVtUiAppUiMGVerifier::~CVtUiAppUiMGVerifier
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CVtUiAppUiMGVerifier::~CVtUiAppUiMGVerifier()
+    {
+    delete iManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CVtUiAppUiMGVerifier::VerifySelectionL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiAppUi::CVtUiAppUiMGVerifier::VerifySelectionL(
+    const MDesCArray* aSelectedFiles )
+    {
+    TBool isOk( EFalse );
+    if ( aSelectedFiles->MdcaCount() > 0 )
+        {
+        TVirtualPathPtr virtualPath(
+            aSelectedFiles->MdcaPoint( 0 ), KDefaultContentObject );
+
+        // not ptotected by default
+        TInt isProtected = 0;
+
+        TInt err = iManager->GetAttribute( EIsProtected,
+            isProtected, virtualPath );
+        if ( isProtected )
+            {
+            iAppUi.ShowDRMNotAllowedNoteL();
+            }
+        if ( err == KErrNone )
+            {
+            isOk = !isProtected;
+            }
+        }
+    return isOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CVtUiAppUiMGVerifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppUi::CVtUiAppUiMGVerifier::ConstructL()
+    {
+    iManager = CManager::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppUi::CVtUiAppUiMGVerifier::CVtUiAppUiMGVerifier
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi::CVtUiAppUiMGVerifier::CVtUiAppUiMGVerifier(
+    CVtUiAppUi& aAppUi, CCoeEnv& aCoeEnv )
+    : iAppUi( aAppUi ), iCoeEnv( &aCoeEnv )
+    {
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiBitmapManager.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,662 @@
+/*
+* 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 of the CVtUiBitmapManager class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiBitmapManager.h"
+#include    "VtUiLayout.h"
+#include    "VtUiPanic.h"
+
+#include    <aknsutils.h>
+#include    <akniconutils.h>
+#include    <fbs.h>
+
+// CONSTANTS
+
+// Granularity of bitmap manager array.
+const TInt KVtUiBitmapManagerGranularity = 16;
+
+// MODULE DATA STRUCTURES
+
+/**
+* CBitmapInfo instances hold information of a bitmap and its mask.
+* @since Series 60 2.8
+*/
+class CVtUiBitmapManager::CBitmapInfo 
+    : public CBase
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        inline CBitmapInfo(
+            TVtUiBitmapPoolId aId );
+
+        /**
+        * Destructor.
+        */
+        ~CBitmapInfo();
+
+        /**
+        * Sets bitmap identifiers.
+        * @param aBitmapId bitmap identifier.
+        * @param aBitmapMaskId bitmap mask identifier.
+        */
+        inline void SetBitmaps( 
+            TVtUiBitmapId aBitmapId, 
+            TVtUiBitmapId aBitmapMaskId );
+
+        /**
+        * Sets bitmap identifier.
+        * @param aBitmapId bitmap identifier.
+        */
+        inline void SetBitmap( 
+            TVtUiBitmapId aBitmapId );
+
+        /**
+        * Sets size.
+        * @param aSize size of the bitmaps.
+        */
+        inline void SetSize( const TSize& aSize );
+
+        /**
+        * Sets aspect ratio preservation.
+        * @param aPreserve ETrue if aspect ratio preserved.
+        */
+        inline void SetAspectRatio( TBool aPreserve );
+
+        /**
+        * Sets default color required / not required for this bitmap.
+        * By default, default color is not required.
+        * @param aRequireDefaultColor ETrue if default color is required, 
+        *        EFalse otherwise.
+        */
+        inline void SetDefaultColorRequired( 
+            TBool aRequireDefaultColor );
+
+        /**
+        * Sets default color.
+        * @param aDefaultColor default color.
+        */
+        inline void SetDefaultColor( const TRgb& aDefaultColor );
+
+        /**
+        * Returns bitmap pool identifier.
+        * @return bitmap pool identifier.
+        */
+        inline TVtUiBitmapPoolId BitmapPoolId() const;
+
+        /**
+        * Gets a bitmap and its mask.
+        * @param aBitmap bitmap.
+        * @param aBitmapMask bitmap mask.
+        */
+        inline void GetBitmap(
+            CFbsBitmap*& aBitmap,
+            CFbsBitmap*& aBitmapMask );
+
+        /**
+        * Resets bitmap information.
+        */
+        void Reset();
+
+        /**
+        * Constructs bitmap as far as possible.
+        * @param aTmpFileName temporary file name,
+        */
+        void Require( TFileName& aTmpFileName );
+
+    private:
+
+        /**
+        * Creates bitmaps using AVKON methods.
+        * @param aTmpFileName temporary file name,
+        */
+        void DoCreateBitmapsL( TFileName& aTmpFileName  );
+
+        /**
+        * Sets size to the bitmap using AVKON method.
+        */
+        void DoSetSize();
+
+    private:
+
+        // Bitmap pool identifier.
+        TVtUiBitmapPoolId iBitmapPoolId;
+
+        // Size has been defined.
+        TBool iHasSize;
+
+        // Size of the bitmap has been changed.
+        TBool iSizeChanged;
+
+        // Size of the bitmaps.
+        TSize iSize;
+        
+        // ETrue if default color required.
+        TBool iRequireDefaultColor;
+
+        // Default color has been defined.
+        TBool iHasDefaultColor;
+        
+        // Default color.
+        TRgb iDefaultColor;
+
+        // Bitmap identifier.
+        TVtUiBitmapId iBitmapId;
+
+        // Owned bitmap instance.
+        CFbsBitmap* iBitmap;
+
+        // Bitmap mask identifier.
+        TVtUiBitmapId iBitmapMaskId;
+
+        // Owned bitmap mask instance.
+        CFbsBitmap* iBitmapMask;
+
+        // ETrue if bitmaps have been created.
+        TBool iDoCreateBitmaps;
+
+        // ETrue if size has been set.
+        TBool iDoSetSize;
+
+        // ETrue if aspect ratio preservation has been updated.
+        TBool iHasAspectRatioPreserve;
+
+        // ETrue if aspect ratio should be preserved.
+        TBool iAspectRatioPreserve;
+
+    };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CVtUiBitmapManager
+// -----------------------------------------------------------------------------
+//
+CVtUiBitmapManager::CVtUiBitmapManager()
+    : iBitmapArray( KVtUiBitmapManagerGranularity )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::~CVtUiBitmapManager
+// -----------------------------------------------------------------------------
+//
+CVtUiBitmapManager::~CVtUiBitmapManager()
+    {
+    iBitmapArray.ResetAndDestroy();
+    iBitmapArray.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::AddBitmapsL
+// -----------------------------------------------------------------------------
+//
+TVtUiBitmapPoolId CVtUiBitmapManager::AddBitmapsL(
+        TVtUiBitmapId aBitmapId, 
+        TVtUiBitmapId aBitmapMaskId,
+        TBool aExpectDefaultColor )
+    {
+    iBitmapId++;
+    CBitmapInfo* bitmapInfo = new ( ELeave ) CBitmapInfo( iBitmapId );
+    CleanupStack::PushL( bitmapInfo );
+    bitmapInfo->SetBitmaps( aBitmapId, aBitmapMaskId );
+    bitmapInfo->SetDefaultColorRequired( aExpectDefaultColor );
+    bitmapInfo->Require( iTmpFileName );
+
+    User::LeaveIfError( iBitmapArray.Append( bitmapInfo ) );
+    CleanupStack::Pop( bitmapInfo );
+    return iBitmapId;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::AddBitmapL
+// -----------------------------------------------------------------------------
+//
+TVtUiBitmapPoolId CVtUiBitmapManager::AddBitmapL(
+        TVtUiBitmapId aBitmapId,
+        TBool aExpectDefaultColor )
+    {
+    iBitmapId++;
+    CBitmapInfo* bitmapInfo = new ( ELeave ) CBitmapInfo( iBitmapId );
+    CleanupStack::PushL( bitmapInfo );
+    bitmapInfo->SetBitmap( aBitmapId );
+    bitmapInfo->SetDefaultColorRequired( aExpectDefaultColor );
+    bitmapInfo->Require( iTmpFileName );
+
+    User::LeaveIfError( iBitmapArray.Append( bitmapInfo ) );
+    CleanupStack::Pop( bitmapInfo );
+    return iBitmapId;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::RemoveBitmap
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::RemoveBitmap( 
+        TVtUiBitmapPoolId aId )
+    {
+    const TInt pos = Find( aId );
+    if ( pos != KErrNotFound )
+        {
+        CBitmapInfo* bitmapInfo = iBitmapArray[ pos ];
+        iBitmapArray.Remove( pos );
+        delete bitmapInfo;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::SetSize
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::SetSize( 
+        TVtUiBitmapPoolId aId, 
+        const TSize& aSize )
+    {
+    const TInt pos = Find( aId );
+    if ( pos != KErrNotFound )
+        {
+        CBitmapInfo* bitmapInfo = iBitmapArray[ pos ];
+        bitmapInfo->SetSize( aSize );
+        bitmapInfo->Require( iTmpFileName );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::SetAspectRatio
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::SetAspectRatio( 
+        TVtUiBitmapPoolId aId,
+        TBool aPreserve )
+    {
+    const TInt pos = Find( aId );
+    if ( pos != KErrNotFound )
+        {
+        CBitmapInfo* bitmapInfo = iBitmapArray[ pos ];
+        bitmapInfo->SetAspectRatio( aPreserve );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::SetSizeAndColor
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::SetSizeAndColor( 
+        TVtUiBitmapPoolId aId, 
+        const TSize& aSize, 
+        const TRgb& aDefaultColor )
+    {
+    const TInt pos = Find( aId );
+    if ( pos != KErrNotFound )
+        {
+        CBitmapInfo* bitmapInfo = iBitmapArray[ pos ];
+        bitmapInfo->SetSize( aSize );
+        bitmapInfo->SetDefaultColor( aDefaultColor );
+        bitmapInfo->Require( iTmpFileName );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::RequireBitmap
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::RequireBitmap( TVtUiBitmapPoolId aId )
+    {
+    const TInt pos = Find( aId );
+    if ( pos != KErrNotFound )
+        {
+        CBitmapInfo* bitmapInfo = iBitmapArray[ pos ];
+        bitmapInfo->Require( iTmpFileName );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::GetBitmaps
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::GetBitmaps(
+        TVtUiBitmapPoolId aId,
+        CFbsBitmap*& aBitmap,
+        CFbsBitmap*& aBitmapMask )
+    {
+    aBitmap = NULL;
+    aBitmapMask = NULL;
+
+    const TInt pos = Find( aId );
+    if ( pos != KErrNotFound )
+        {
+        CBitmapInfo* bitmapInfo = iBitmapArray[ pos ];
+        bitmapInfo->GetBitmap( aBitmap, aBitmapMask );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::GetBitmap
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::GetBitmap(
+        TVtUiBitmapPoolId aId,
+        CFbsBitmap*& aBitmap )
+    {
+    CFbsBitmap* dummy = NULL;
+    GetBitmaps( aId, aBitmap, dummy );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::InvalidateBitmaps
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::InvalidateBitmaps()
+    {
+    const TInt count = iBitmapArray.Count();
+    for ( TInt index = 0; index < count; index++ )
+        {
+        CBitmapInfo* bitmapInfo = iBitmapArray[ index ];
+        bitmapInfo->Reset();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::Find
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiBitmapManager::Find( TVtUiBitmapPoolId aId ) const
+    {
+    TInt result = KErrNotFound;
+    const TInt count = iBitmapArray.Count();
+    for ( TInt index = 0; index < count; index++ )
+        {
+        CBitmapInfo* bitmapInfo = iBitmapArray[ index ];
+        if ( bitmapInfo->BitmapPoolId() == aId )
+            {
+            result = index;
+            index = count; // out of the loop
+            }
+        }
+
+    return result;
+    }
+
+// Implementation of CBitmapInfo:
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::CBitmapInfo
+// -----------------------------------------------------------------------------
+//
+inline CVtUiBitmapManager::CBitmapInfo::CBitmapInfo(
+        TVtUiBitmapPoolId aId )
+    : iBitmapPoolId( aId ), 
+      iBitmapId( EVtUiBitmapNone ), 
+      iBitmapMaskId( EVtUiBitmapNone )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::~CBitmapInfo
+// -----------------------------------------------------------------------------
+//
+CVtUiBitmapManager::CBitmapInfo::~CBitmapInfo()
+    {
+    delete iBitmap;
+    delete iBitmapMask;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::SetBitmaps
+// -----------------------------------------------------------------------------
+//
+inline void CVtUiBitmapManager::CBitmapInfo::SetBitmaps( 
+        TVtUiBitmapId aBitmapId, 
+        TVtUiBitmapId aBitmapMaskId )
+    {
+    iBitmapId = aBitmapId;
+    iBitmapMaskId = aBitmapMaskId;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::SetBitmap
+// -----------------------------------------------------------------------------
+//
+inline void CVtUiBitmapManager::CBitmapInfo::SetBitmap( 
+        TVtUiBitmapId aBitmapId )
+    {
+    iBitmapId = aBitmapId;
+    iBitmapMaskId = EVtUiBitmapNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::SetSize
+// -----------------------------------------------------------------------------
+//
+inline void CVtUiBitmapManager::CBitmapInfo::SetSize( 
+        const TSize& aSize )
+    {
+    if ( iHasSize )
+        {
+        iSizeChanged = ( iSize != aSize );
+        }
+
+    iHasSize = ETrue;
+    iSize = aSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::SetAspectRatio
+// -----------------------------------------------------------------------------
+//
+inline void CVtUiBitmapManager::CBitmapInfo::SetAspectRatio( TBool aPreserve )
+    {
+    iHasAspectRatioPreserve = ETrue;
+    iAspectRatioPreserve = aPreserve;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::SetDefaultColorRequired
+// -----------------------------------------------------------------------------
+//
+inline void CVtUiBitmapManager::CBitmapInfo::SetDefaultColorRequired( 
+        TBool aRequireDefaultColor )
+    {
+    iRequireDefaultColor = aRequireDefaultColor;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::SetDefaultColor
+// -----------------------------------------------------------------------------
+//
+inline void CVtUiBitmapManager::CBitmapInfo::SetDefaultColor( 
+        const TRgb& aDefaultColor )
+    {
+    __ASSERT_DEBUG( iRequireDefaultColor, 
+        VtUiPanic::Panic( EVtUiPanicDefaultColorRequireMismatch ) );
+    iHasDefaultColor = ETrue;
+    iDefaultColor = aDefaultColor;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::BitmapPoolId
+// -----------------------------------------------------------------------------
+//
+inline TVtUiBitmapPoolId CVtUiBitmapManager::CBitmapInfo::BitmapPoolId() const
+    {
+    return iBitmapPoolId;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::GetBitmap
+// -----------------------------------------------------------------------------
+//
+inline void CVtUiBitmapManager::CBitmapInfo::GetBitmap(
+        CFbsBitmap*& aBitmap,
+        CFbsBitmap*& aBitmapMask )
+    {
+    if ( iDoCreateBitmaps && iDoSetSize )
+        {
+        aBitmap = iBitmap;
+        aBitmapMask = iBitmapMask;
+        }
+    else
+        {
+        aBitmap = NULL;
+        aBitmapMask = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::Reset
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::CBitmapInfo::Reset()
+    {
+    delete iBitmap;
+    iBitmap = NULL;
+
+    delete iBitmapMask;
+    iBitmapMask = NULL;
+
+    iSize = TSize();
+    iHasSize = EFalse;
+    iSizeChanged = EFalse;
+    iHasDefaultColor = EFalse;
+    iDefaultColor = TRgb();
+    iDoCreateBitmaps = EFalse;
+    iDoSetSize = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::Require
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::CBitmapInfo::Require( TFileName& aTmpFileName )
+    {
+    // Bitmap can be created when the following has been satisfied
+    // a) It has not been created yet and default color is not required,
+    // b) It has not been created yet and default color is required and 
+    //    default color is available.
+    if ( !iDoCreateBitmaps && !( iRequireDefaultColor && !iHasDefaultColor ) )
+        {
+        TRAP_IGNORE( DoCreateBitmapsL( aTmpFileName ) );
+        }
+
+    DoSetSize();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::DoCreateBitmapsL
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::CBitmapInfo::DoCreateBitmapsL( 
+        TFileName& aTmpFileName )
+    {
+    if ( !iDoCreateBitmaps )
+        {
+        TInt bitmapIndex = KErrNotFound;
+
+        VtUiLayout::Resolve( iBitmapId, aTmpFileName, bitmapIndex );
+
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        TAknsItemID skinId = VtUiLayout::MapBitmapToSkinId( iBitmapId );
+        
+        TAknsItemID colorId = KAknsIIDNone;
+        TInt colorIndex = KErrNotFound;
+        TBool colorAvailable = EFalse;
+        if ( iHasDefaultColor )
+            {
+            colorAvailable = 
+                VtUiLayout::MapBitmapToColorId( 
+                    iBitmapId, colorId, colorIndex );
+            }
+
+        if ( iBitmapMaskId != EVtUiBitmapNone )
+            {
+            TInt bitmapMaskIndex = KErrNotFound;
+#ifdef _DEBUG
+            TFileName fileName;
+            VtUiLayout::Resolve( iBitmapMaskId, fileName, bitmapMaskIndex );
+            __ASSERT_ALWAYS( aTmpFileName == fileName, 
+                VtUiPanic::Panic( EVtUiPanicMismatchInBitmapFileNames ) );
+#else
+            VtUiLayout::Resolve( iBitmapMaskId, aTmpFileName, bitmapMaskIndex );
+#endif
+            if ( colorAvailable )
+                {
+                AknsUtils::CreateColorIconL( 
+                    skin, skinId,
+                    colorId, colorIndex,
+                    iBitmap, iBitmapMask,
+                    aTmpFileName,
+                    bitmapIndex,
+                    bitmapMaskIndex,
+                    iDefaultColor );
+                }
+            else
+                {
+                AknsUtils::CreateIconL(
+                    skin, skinId,
+                    iBitmap, iBitmapMask,
+                    aTmpFileName,
+                    bitmapIndex, 
+                    bitmapMaskIndex );
+                }
+            }
+        else
+            {
+            // Only normal skinning for these.
+            AknsUtils::CreateIconL(
+                skin,
+                skinId,
+                iBitmap,
+                aTmpFileName,
+                bitmapIndex );
+            }
+
+        iDoCreateBitmaps = ETrue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBitmapManager::CBitmapInfo::DoSetSize
+// -----------------------------------------------------------------------------
+//
+void CVtUiBitmapManager::CBitmapInfo::DoSetSize()
+    {
+    if ( iDoCreateBitmaps && iHasSize && ( !iDoSetSize || iSizeChanged ) )
+        {
+        iSizeChanged = EFalse;
+        TInt retBitmap = KErrNone;
+        if ( !iHasAspectRatioPreserve )
+            {
+            retBitmap = AknIconUtils::SetSize( iBitmap, iSize );
+            }
+        else
+            {
+            TScaleMode scaleMode = 
+                iAspectRatioPreserve ? 
+                    EAspectRatioPreserved : 
+                    EAspectRatioNotPreserved;
+            retBitmap = AknIconUtils::SetSize( iBitmap, iSize, scaleMode );
+            }
+
+        iDoSetSize = ( retBitmap == KErrNone );
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiBlankControl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* 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 of the CVtUiBlankControl control class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiBlankControl.h"
+#include    <aknsutils.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankControl::CVtUiBlankControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiBlankControl::CVtUiBlankControl()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankControl::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankControl::ConstructL( const TRect& aRect )
+    {
+    CreateWindowL();
+    MakeVisible( EFalse );
+    SetRect( aRect );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankControl::~CVtUiBlankControl
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiBlankControl::~CVtUiBlankControl()
+    {
+    AknsUtils::DeregisterControlPosition( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankControl::SetActive
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankControl::SetActive( TBool aStatus )
+    {
+    iBlankerActive = aStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankControl::OfferKeyEventL
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CVtUiBlankControl::OfferKeyEventL(
+        const TKeyEvent& /*aKeyEvent*/,
+        TEventCode /*aType*/ )
+    {
+    return iBlankerActive ? EKeyWasConsumed : EKeyWasNotConsumed;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankControl::Draw
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankControl::Draw( const TRect& /*aRect*/ ) const
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankControl::SizeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankControl::SizeChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankControl::PositionChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankControl::PositionChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiBlankDialog.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* 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 of the CVtUiBlankDialog class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiBlankDialog.h"
+#include    <videotelui.rsg>
+#include    <avkon.hrh>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankDialog::CVtUiBlankDialog
+// -----------------------------------------------------------------------------
+//
+CVtUiBlankDialog::CVtUiBlankDialog(
+        CEikDialog** aSelfPtr )
+    : iSelfPtr( aSelfPtr ) 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankDialog::~CVtUiBlankDialog
+// -----------------------------------------------------------------------------
+//
+CVtUiBlankDialog::~CVtUiBlankDialog()
+    {
+    if ( iSelfPtr )
+        {
+        *iSelfPtr = NULL;
+        iSelfPtr = NULL;
+        }
+
+    if ( iRequest )
+        {
+        User::RequestComplete( iRequest, KErrCancel );
+        iRequest = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankDialog::ExecuteDialogNoWaitLD
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankDialog::ExecuteDialogNoWaitLD()
+    {
+    ExecuteLD( R_VIDEOTELUI_BLANK_NOWAIT_DLG );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankDialog::ExecuteDialogLD
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankDialog::ExecuteDialogLD(
+        TRequestStatus* aRequest )
+    {
+    if ( !aRequest )
+        {
+        TInt error = KErrNone;
+        iError = &error;
+ 
+        ExecuteLD( R_VIDEOTELUI_BLANK_DLG );
+        User::LeaveIfError( error );
+        }
+    else
+        {
+        // It's assumed that either ExecuteLD leaves or
+        // then dialog is started (& dialog is not immediately deleted).
+        *aRequest = KRequestPending;
+        ExecuteLD( R_VIDEOTELUI_BLANK_NOWAIT_DLG );
+        iRequest = aRequest; 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankDialog::Complete
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankDialog::Complete( const TInt aError )
+    {
+    if ( iError )
+        {
+        *iError = aError;
+        }
+
+    if ( iRequest )
+        {
+        User::RequestComplete( iRequest, aError );
+        iRequest = NULL;
+        }
+
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankDialog::PreLayoutDynInitL
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankDialog::PreLayoutDynInitL()
+    {
+    MakeVisible( EFalse );
+    ButtonGroupContainer().MakeVisible( EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankDialog::PostLayoutDynInitL
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankDialog::PostLayoutDynInitL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankDialog::OkToExitL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiBlankDialog::OkToExitL( TInt aButtonId )
+    {
+    if ( aButtonId != EEikBidCancel )
+        {
+        return EFalse;
+        }
+    else
+        {
+        return CEikDialog::OkToExitL( aButtonId );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiBlankDialog::Draw
+// -----------------------------------------------------------------------------
+//
+void CVtUiBlankDialog::Draw( const TRect& /*aRect*/ ) const
+    {
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiContextControl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,328 @@
+/*
+* Copyright (c) 2004, 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:  Implementation of the CVtUiContextControl control class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiContextControl.h"
+#include    "VtUiLayout.h"
+#include    <aknsutils.h>
+#include    <aknsdrawutils.h>
+#include    <cvtlogger.h>
+#include    <featmgr.h>
+#include    "CVtUiAppUi.h"
+#include    "tvtuistates.h"
+#include    <aknsutils.h>
+#include	"tVtuifeaturevariation.h"
+
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::NewL
+// Constructor that may leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiContextControl* CVtUiContextControl::NewL(
+    CVtUiBitmapManager& aBitmapManager, CVtUiAppUi& aAppUi,
+    TVtUiStates& aUiStates)
+    {
+    __VTPRINTENTER( "CtxCtrl.NewL" )
+    CVtUiContextControl* self = new ( ELeave ) CVtUiContextControl(
+        aBitmapManager, aAppUi, aUiStates );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "CtxCtrl.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::~CVtUiContextControl
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiContextControl::~CVtUiContextControl()
+    {
+    __VTPRINTENTER( "CtxCtrl.~" )
+    BitmapManager().RemoveBitmap( iBackgroundId );
+    BitmapManager().RemoveBitmap( iBlindId );
+    BitmapManager().RemoveBitmap( iBlindMaskId );
+    if ( iAppUi.EventMonitor() )
+        {
+        iAppUi.EventMonitor()->RemoveObserver( this );
+        }
+    __VTPRINTEXIT( "CtxCtrl.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::HandlePointerEventL
+// -----------------------------------------------------------------------------
+//
+void CVtUiContextControl::HandlePointerEventL(
+    const TPointerEvent& aPointerEvent)
+    {
+    __VTPRINTENTER( "CtxCtrl.HandlePointerEventL" )
+    __VTPRINT2( DEBUG_GEN, "CtxCtrl.HandlePtr  ok= %d", iOkToSwapOnButtonUp )
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+        if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+            {
+            TRect window( Size() );
+            if ( !window.Contains( aPointerEvent.iPosition ) )
+                {
+                iOkToSwapOnButtonUp = ETrue;
+                SetGloballyCapturing( EFalse );
+                SetPointerCapture( EFalse); 
+                }
+            else if( iOkToSwapOnButtonUp )
+                {
+                 if ( !iUiStates.IsWhiteBalanceModeOn() &&
+                       !iUiStates.IsColorToneModeOn() )
+                        {
+                        if ( !( iAppUi.CanSwapImagePlaces() ) )
+                            {
+                            return;
+                            }	
+                        iAppUi.HandleCommandL( EVtUiCmdSwapImagesPlaces );
+                        }
+                }
+            else
+                {
+                SetGloballyCapturing( EFalse );
+                SetPointerCapture( EFalse); 
+                iOkToSwapOnButtonUp = ETrue;
+                }
+            }
+        }
+    __VTPRINTEXIT( "CtxCtrl.HandlePointerEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::HandleSizeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiContextControl::HandleSizeChanged()
+    {
+    __VTPRINTENTER( "CtxCtrl.HandleSizeChanged" )
+    TRect screen;
+    VtUiLayout::GetApplicationParentRect( screen );
+
+    TAknWindowLineLayout control;
+    VtUiLayout::GetFirstWindowBackgroundLayout( control );
+    TAknLayoutRect backLayout;
+    backLayout.LayoutRect( screen, control );
+    BitmapManager().SetSize( iBackgroundId, backLayout.Rect().Size() );
+
+    const TPoint positionRelativeToScreen( -PositionRelativeToScreen() );
+
+    VtUiLayout::GetFirstWindowStreamDisabledIconLayout( control );
+    TAknLayoutRect blindLayout;
+    blindLayout.LayoutRect( screen, control );
+    iBlindRect = blindLayout.Rect();
+    iBlindRect.Move( positionRelativeToScreen );
+    BitmapManager().SetSize( iBlindId, iBlindRect.Size() );
+    BitmapManager().SetSize( iBlindMaskId, iBlindRect.Size() );
+
+    VtUiLayout::GetFirstWindowStreamLayout( control );
+    TAknLayoutRect streamLayout;
+    streamLayout.LayoutRect( screen, control );
+    iStreamRect = streamLayout.Rect();
+    iStreamRect.Move( positionRelativeToScreen ) ;
+    __VTPRINTEXIT( "CtxCtrl.HandleSizeChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::StreamBlitPosition
+// -----------------------------------------------------------------------------
+//
+TPoint CVtUiContextControl::StreamBlitPosition() const
+    {
+    __VTPRINTENTER( "CtxCtrl.StreamBlitPosition" )
+    __VTPRINTEXIT( "CtxCtrl.StreamBlitPosition" )
+    return iStreamRect.iTl;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContextControl::StreamClippingRect
+// ---------------------------------------------------------------------------
+//
+TRect CVtUiContextControl::StreamClippingRect() const
+    {
+    __VTPRINTENTER( "CtxCtrl.StreamClippingRect" )
+    __VTPRINTEXIT( "CtxCtrl.StreamClippingRect" )
+    return iStreamRect;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::DrawColoredBackground
+// -----------------------------------------------------------------------------
+//
+void CVtUiContextControl::DrawColoredBackground( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "CtxCtrl.DrawColoredBackground" )
+    CVtUiVideoControlBase::DrawColoredBackground( aGc );
+    // Draw background image
+    CFbsBitmap* bg = NULL;
+    CFbsBitmap* bgMask = NULL;
+    BitmapManager().GetBitmaps( iBackgroundId, bg, bgMask );
+    if ( bg )
+        {
+        const TPoint origin;
+        const TRect rect( origin, bg->SizeInPixels() );
+        if ( bgMask )
+            {
+            aGc.BitBltMasked( origin, bg, rect, bgMask, ETrue );
+            }
+        else
+            {
+            aGc.BitBlt( origin, bg );
+            }
+        }
+    __VTPRINTEXIT( "CtxCtrl.DrawColoredBackground" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContextControl::BlindImage
+// ---------------------------------------------------------------------------
+//
+CFbsBitmap* CVtUiContextControl::BlindImage() const
+    {
+    __VTPRINTENTER( "CtxCtrl.BlindImage" )
+    __VTPRINTEXIT( "CtxCtrl.BlindImage" )
+    return Bitmap( iBlindId );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContextControl::BlindMask
+// ---------------------------------------------------------------------------
+//
+CFbsBitmap* CVtUiContextControl::BlindMask() const
+    {
+    __VTPRINTENTER( "CtxCtrl.BlindImage" )
+    __VTPRINTEXIT( "CtxCtrl.BlindImage" )
+    return Bitmap( iBlindMaskId );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContextControl::BlindBlitPosition
+// ---------------------------------------------------------------------------
+//
+TPoint CVtUiContextControl::BlindBlitPosition() const
+    {
+    __VTPRINTENTER( "CtxCtrl.BlindBlitPosition" )
+    __VTPRINTEXIT( "CtxCtrl.BlindBlitPosition" )
+    return iBlindRect.iTl;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::CVtUiContextControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiContextControl::CVtUiContextControl(
+        CVtUiBitmapManager& aBitmapManager,
+        CVtUiAppUi& aAppUi,
+        TVtUiStates& aUiStates )
+    : CVtUiVideoControlBase( aBitmapManager ),
+      iAppUi( aAppUi ),
+      iUiStates( aUiStates )
+    {
+    __VTPRINTENTER( "CtxCtrl.ctor" )
+    SetRenderingHint( ENoWaitingText );
+    SetRenderingHint( EColoredBackground );
+    __VTPRINTEXIT( "CtxCtrl.ctor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiContextControl::ConstructL()
+    {
+    __VTPRINTENTER( "CtxCtrl.ConstructL" )
+    BaseConstructL();
+    iBackgroundId =
+        BitmapManager().AddBitmapsL(
+            EVtUiBitmap_qgn_graf_call_video_out_bg,
+            EVtUiBitmap_qgn_graf_call_video_out_bg_mask,
+            EFalse );
+    BitmapManager().SetAspectRatio( iBackgroundId, EFalse );
+    iBlindId =
+        BitmapManager().AddBitmapL(
+            EVtUiBitmap_qgn_indi_call_video_blind_out,
+            EFalse );
+    BitmapManager().SetAspectRatio( iBlindId, EFalse );
+    iBlindMaskId =
+        BitmapManager().AddBitmapL(
+            EVtUiBitmap_qgn_indi_call_video_blind_out_mask_icon,
+            EFalse );
+    BitmapManager().SetAspectRatio( iBlindMaskId, EFalse );
+    SetNonFocusing();
+    if ( iAppUi.EventMonitor() )
+        {
+        iAppUi.EventMonitor()->AddObserverL( this );
+        }
+        
+    iOkToSwapOnButtonUp = ETrue;
+    __VTPRINTEXIT( "CtxCtrl.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::HandleWsEventL
+// -----------------------------------------------------------------------------
+//
+void CVtUiContextControl::HandleWsEventL( const TWsEvent& aEvent,
+    CCoeControl* aDestination )
+    {
+    __VTPRINTENTER( "CVtUiContextControl.HandleWsEventL" )
+    if( aEvent.Type() == EEventPointer )
+        {
+        // Touch outside of volume popup, close volume popup
+        if ( aEvent.Pointer()->iType == TPointerEvent::EButton1Down )
+            {
+            if ( aDestination == this )
+                {
+                iOkToSwapOnButtonUp = !iUiStates.IsZoomModeOn() &&
+                    !iUiStates.IsCaptureModeOn() &&
+                    !iUiStates.IsContrastModeOn() &&
+                    !iUiStates.IsBrightnessModeOn() &&
+                    !iUiStates.IsVolumeModeOn();
+                    SetGloballyCapturing( ETrue );
+                    SetPointerCapture( ETrue ); 
+                }
+            }             
+        }
+    __VTPRINTEXIT( "CVtUiContextControl.HandleWsEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiContextControl::LayoutRemoteVideo
+// -----------------------------------------------------------------------------
+//
+void CVtUiContextControl::LayoutRemoteVideo()
+    {
+    __VTPRINTENTER( "CVtUiContextControl.LayoutRemoteVideo" )
+    if ( NULL != iRemoteVideoControl )
+        {
+        TRect rectRemoteVideo(StreamClippingRect());
+        rectRemoteVideo.Move(PositionRelativeToScreen());
+        iRemoteVideoControl->SetExtent(rectRemoteVideo.iTl,rectRemoteVideo.Size());        
+        }
+    __VTPRINTEXIT( "CVtUiContextControl.LayoutRemoteVideo" )
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiDoc.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* 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 of the CVtUiDoc document class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiDoc.h"
+#include    "CVtUiAppUi.h"
+#include    <apgwgnam.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiDoc::CVtUiDoc
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiDoc::CVtUiDoc( CEikApplication& aApp )
+    : CAknDocument( aApp )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiDoc::CreateAppUiL
+// Creates application UI instance.
+// -----------------------------------------------------------------------------
+//
+CEikAppUi* CVtUiDoc::CreateAppUiL()
+    {
+    return new ( ELeave ) CVtUiAppUi;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiDoc::UpdateTaskNameL
+// Creates application UI instance.
+// -----------------------------------------------------------------------------
+//
+void CVtUiDoc::UpdateTaskNameL( CApaWindowGroupName* aWgName )
+    {
+    CAknDocument::UpdateTaskNameL( aWgName );
+    aWgName->SetHidden( ETrue );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiExecuteCmdDialog.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,312 @@
+/*
+* 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:  Implementation of the CVtUiExecuteCmdDialog class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiExecuteCmdDialog.h"
+#include    "MVtUiEngineCommandManager.h"
+#include    <mvtengcommandhandler.h>
+#include    <cvtlogger.h>
+
+// MODULE DATA STRUCTURES
+
+/**
+* Active object to perform asynchronous commands.
+* @since Series 60 2.6
+*/
+class CVtUiExecuteCmdDialog::CActiveCmd
+    : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        CActiveCmd(
+            CVtUiExecuteCmdDialog& aDialog,
+            MVtEngCommandHandler& aCommandHandler,
+            TVtEngCommandId aCommand,
+            TDesC8* aParams );
+
+        /**
+        * Destructor.
+        */
+        ~CActiveCmd();
+
+    public: // New functions
+
+        /**
+        * Starts active object. Command will be performed in RunL.
+        */
+        void Start();
+
+        /**
+        * Checks if command has been performed.
+        * @return ETrue if command has been performed.
+        */
+        TBool CommandPerformed() const;
+
+    private:
+
+        /**
+        * @see CActive::RunL
+        */
+        void RunL();
+
+        /**
+        * @see CActive::DoCancel.
+        */
+        void DoCancel();
+
+        /**
+        * @see CActive::RunError.
+        */
+        TInt RunError( TInt aResult );
+
+    private:
+
+        // Ref to dialog.
+        CVtUiExecuteCmdDialog& iDialog;
+
+        // Ref to command handler.
+        MVtEngCommandHandler& iCommandHandler;
+
+        // Command to be executed.
+        TVtEngCommandId iCommand;
+
+        // Owned parameters.
+        TDesC8* iCommandParams;
+
+        // ETrue if command has been performed.
+        TBool iCommandPerformed;
+
+    };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::CVtUiExecuteCmdDialog
+// -----------------------------------------------------------------------------
+//
+CVtUiExecuteCmdDialog::CVtUiExecuteCmdDialog(
+        CEikDialog** aSelfPtr,
+        MVtEngCommandHandler& aCommandHandler,
+        MVtUiEngineCommandManager& aCommandManager )
+    : CVtUiBlankDialog( aSelfPtr ),
+      iCommandHandler( aCommandHandler ),
+      iCommandManager( aCommandManager )
+    {
+    __VTPRINT2( DEBUG_GEN, "Ui.Dlg.Ctor this=%d", (TInt)this )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::~CVtUiExecuteCmdDialog
+// -----------------------------------------------------------------------------
+//
+CVtUiExecuteCmdDialog::~CVtUiExecuteCmdDialog()
+    {
+    __VTPRINTENTER( "VtUiExCmdDlg.~" )
+    __VTPRINT2( DEBUG_GEN, "VtUiExCmdDlg.~ this=%d", (TInt)this )
+    if ( iActiveCmd )
+        {
+        if ( !iCommandCompleted && iActiveCmd->CommandPerformed() )
+            {
+            iCommandHandler.CancelCommand( iCommand ); // ignore error
+            }
+        }
+    delete iCommandParams;
+    delete iActiveCmd;
+
+    iCommandManager.RemoveObserver( *this );
+    __VTPRINTEXIT( "VtUiExCmdDlg.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::ExecuteCmdLD
+// -----------------------------------------------------------------------------
+//
+void CVtUiExecuteCmdDialog::ExecuteCmdLD(
+        const TVtEngCommandId aCommandId,
+        TDesC8* aParams,
+        TRequestStatus* aRequest )
+    {
+    __VTPRINTENTER( "VtUiExCmdDlg.ExecuteCmd" )
+    __VTPRINT2( DEBUG_GEN, "Ui.Dlg.Exec this=%d", (TInt)this )
+    iCommand = aCommandId;
+    CleanupStack::PushL( this );
+    if ( aParams )
+        {
+        iCommandParams = aParams->AllocL();
+        }
+
+    iCommandManager.AddObserverL( *this );
+    CleanupStack::Pop( this );
+
+    CVtUiBlankDialog::ExecuteDialogLD( aRequest );
+    __VTPRINTEXIT( "VtUiExCmdDlg.ExecuteCmd" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::PostLayoutDynInitL
+// -----------------------------------------------------------------------------
+//
+void CVtUiExecuteCmdDialog::PostLayoutDynInitL()
+    {
+    __VTPRINTENTER( "VtUiExCmdDlg.PostL" )
+    iActiveCmd =
+        new ( ELeave ) CActiveCmd(
+            *this, iCommandHandler, iCommand, iCommandParams );
+    iActiveCmd->Start();
+    __VTPRINTEXITR( "VtUiExCmdDlg.PostL this=%d", (TInt)this )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiExecuteCmdDialog::HandleVTCommandPerformedL(
+        TVtEngCommandId aCommand,
+        const TInt aError )
+    {
+    __VTPRINTENTER( "VtUiExCmdDlg.HandleVTCommandPerformed" )
+    __VTPRINT2( DEBUG_GEN, "VtUiExCmdDlg.cmd.%d", aCommand )
+    __VTPRINT2( DEBUG_GEN, "VtUiExCmdDlg.err.%d", aError )
+    if ( iActiveCmd && ( aCommand == iCommand ) )
+        {
+        if ( iActiveCmd->CommandPerformed() && !iCommandCompleted )
+            {
+            __VTPRINT( DEBUG_GEN, "VtUiExCmdDlg.match" )
+            iCommandCompleted = ETrue;
+            // Corrupted images may leave during initialization, thus we have
+            // to mask out errors when they happen during share initialize.
+            // Error code is handled correctly in CVtUiAppUi::CEventObserver::
+            // HandleVTCommandPerformedL() method, thus it will not be ignored.
+            if ( aCommand == KVtEngInitializeShareImage )
+                {
+                Complete( KErrNone );
+                }
+            else
+                {
+                Complete( aError );
+                }
+            }
+        }
+    __VTPRINTEXIT( "VtUiExCmdDlg.HandleVTCommandPerformed" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::HandleExecuteFailed
+// -----------------------------------------------------------------------------
+//
+void CVtUiExecuteCmdDialog::HandleExecuteFailed( TInt aResult )
+    {
+    __VTPRINT3( DEBUG_GEN, "VtUiExCmdDlg.Fail this=%d res=%d",
+        (TInt)this, aResult )
+    Complete( aResult );
+    }
+
+// Implementation of CVtUiExecuteCmdDialog::CActiveCmd:
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::CActiveCmd::CActiveCmd
+// -----------------------------------------------------------------------------
+//
+CVtUiExecuteCmdDialog::CActiveCmd::CActiveCmd(
+        CVtUiExecuteCmdDialog& aDialog,
+        MVtEngCommandHandler& aCommandHandler,
+        TVtEngCommandId aCommand,
+        TDesC8* aParams)
+    : CActive( CActive::EPriorityHigh ),
+      iDialog( aDialog ),
+      iCommandHandler( aCommandHandler ),
+      iCommand( aCommand ),
+      iCommandParams( aParams )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::CActiveCmd::~CActiveCmd
+// -----------------------------------------------------------------------------
+//
+CVtUiExecuteCmdDialog::CActiveCmd::~CActiveCmd()
+    {
+    __VTPRINT2( DEBUG_GEN, "VtUiExCmdDlgCmd.Dtor this=%d", (TInt)this )
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::CActiveCmd::Start
+// -----------------------------------------------------------------------------
+//
+void CVtUiExecuteCmdDialog::CActiveCmd::Start()
+    {
+    __VTPRINTENTER( "VtUiExCmdDlgCmd.Start" )
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+    SetActive();
+    __VTPRINTEXITR( "VtUiExCmdDlgCmd.Start this=%d", (TInt)this )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::CActiveCmd::CommandPerformed
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiExecuteCmdDialog::CActiveCmd::CommandPerformed() const
+    {
+    __VTPRINT3( DEBUG_GEN, "VtUiExCmdDlgCmd.Perf this=%d,cmd=%d",
+        (TInt)this, iCommandPerformed )
+    return iCommandPerformed;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::CActiveCmd::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtUiExecuteCmdDialog::CActiveCmd::RunL()
+    {
+    __VTPRINTENTER( "VtUiExCmdDlgCmd.RunL" )
+    iCommandHandler.ExecuteL( iCommand, iCommandParams );
+    iCommandPerformed = ETrue;
+    __VTPRINTEXITR( "VtUiExCmdDlgCmd.RunL this=%d", (TInt)this )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::CActiveCmd::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtUiExecuteCmdDialog::CActiveCmd::DoCancel()
+    {
+    __VTPRINT2( DEBUG_GEN, "VtUiExCmdDlgCmd.DoCnl this=%d", (TInt)this )
+    // Request is completed immediately.
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiExecuteCmdDialog::CActiveCmd::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiExecuteCmdDialog::CActiveCmd::RunError( TInt aResult )
+    {
+    __VTPRINTENTER( "VtUiExCmdDlgCmd.RunError" )
+    // Exception was raised in RunL. Inform the dialog to close itself.
+    iDialog.HandleExecuteFailed( aResult );
+    __VTPRINTEXITR( "VtUiExCmdDlgCmd.RunError this=%d", (TInt)this )
+    return KErrNone;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiMainControl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,245 @@
+/*
+* 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:  Implementation of the CVtUiMainControl control class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiMainControl.h"
+#include    "VtUiLayout.h"
+#include    <aknsutils.h>
+#include    <aknsdrawutils.h>
+#include    <cvtlogger.h>
+#include    <featmgr.h>
+#include    "CVtUiAppUi.h"
+#include    "tvtuistates.h"
+#include    <aknsutils.h>
+#include	"tVtuifeaturevariation.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::NewL
+// -----------------------------------------------------------------------------
+CVtUiMainControl* CVtUiMainControl::NewL( CVtUiBitmapManager& aBitmapManager,
+    TVtUiStates& aUiStates )
+    {
+    __VTPRINTENTER( "MainCtrl.NewL" )
+    CVtUiMainControl* self =
+        new ( ELeave ) CVtUiMainControl( aBitmapManager, aUiStates );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "MainCtrl.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::CVtUiMainControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiMainControl::CVtUiMainControl( CVtUiBitmapManager& aBitmapManager,
+    TVtUiStates& aUiStates ) : CVtUiVideoControlBase( aBitmapManager ),
+    iUiStates ( aUiStates )
+    {
+    __VTPRINTENTER( "MainCtrl.Ctor" )
+    SetRenderingHint( ESkinnedBackground );
+    __VTPRINTEXIT( "MainCtrl.Ctor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiMainControl::ConstructL()
+    {
+    __VTPRINTENTER( "MainCtrl.ConstructL" )
+    BaseConstructL();
+    iBlindId =
+        BitmapManager().AddBitmapL(
+            EVtUiBitmap_qgn_indi_call_video_blind_in,
+            EFalse );
+    BitmapManager().SetAspectRatio( iBlindId, EFalse );
+    iBlindMaskId =
+        BitmapManager().AddBitmapL(
+            EVtUiBitmap_qgn_indi_call_video_blind_in_mask_icon,
+            EFalse );
+    BitmapManager().SetAspectRatio( iBlindMaskId, EFalse );
+    __VTPRINTEXIT( "MainCtrl.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::~CVtUiMainControl
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiMainControl::~CVtUiMainControl()
+    {
+    __VTPRINTENTER( "MainCtrl.~" )
+    BitmapManager().RemoveBitmap( iBlindId );
+    BitmapManager().RemoveBitmap( iBlindMaskId );
+    __VTPRINTEXIT( "MainCtrl.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::HandleSizeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiMainControl::HandleSizeChanged()
+    {
+    __VTPRINTENTER( "MainCtrl.HandleSizeChanged" )
+    const TRect mainPaneRect( Rect() );
+
+    // blind icon and mask
+    TAknWindowLineLayout blind;
+    VtUiLayout::GetSecondWindowDisabledIconLayout( blind );
+    iBlindLayout.LayoutRect( mainPaneRect, blind );
+    const TSize blindSize( iBlindLayout.Rect().Size() );
+    BitmapManager().SetSize( iBlindId, blindSize );
+    BitmapManager().SetSize( iBlindMaskId, blindSize );
+
+    // stream
+    TAknWindowLineLayout stream;
+    VtUiLayout::GetSecondWindowStreamWholeLayout( stream,
+         iUiStates.IsToolbarAvailable(), iSQCifRemote );
+
+    iStreamLayoutRect.LayoutRect( mainPaneRect, stream );
+
+    __VTPRINTEXIT( "MainCtrl.HandleSizeChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::DrawWaitingText
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiMainControl::DrawWaitingText( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "MainCtrl.DrawWaitingText" )
+    TBool wasDrawn( EFalse );
+    if ( !iSQCifRemote)
+        {
+        wasDrawn = CVtUiVideoControlBase::DrawWaitingText( aGc );
+        }
+    __VTPRINTEXITR( "MainCtrl.DrawWaitingText %d", wasDrawn )
+    return wasDrawn;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::StreamBlitPosition
+// -----------------------------------------------------------------------------
+//
+TPoint CVtUiMainControl::StreamBlitPosition() const
+    {
+    __VTPRINTENTER( "MainCtrl.StreamBlitPosition" )
+    const TSize videoSize( iStreamBitmap->SizeInPixels() );
+    const TSize streamSize( iStreamLayoutRect.Rect().Size() );
+    __VTPRINTEXIT( "MainCtrl.StreamBlitPosition" )
+    return AdjustPointForDP( iStreamLayoutRect.Rect().iTl );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::StreamClippingRect
+// -----------------------------------------------------------------------------
+//
+TRect CVtUiMainControl::StreamClippingRect() const
+    {
+    __VTPRINTENTER( "MainCtrl.StreamClippingRect" )
+    __VTPRINTEXIT( "MainCtrl.StreamClippingRect" )
+    return AdjustRectForDP( iStreamLayoutRect.Rect() );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::BlindImage
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap* CVtUiMainControl::BlindImage() const
+    {
+    __VTPRINTENTER( "MainCtrl.BlindImage" )
+    __VTPRINTEXIT( "MainCtrl.BlindImage" )
+    return Bitmap( iBlindId );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::BlindMask
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap* CVtUiMainControl::BlindMask() const
+    {
+    __VTPRINTENTER( "MainCtrl.BlindMask" )
+    __VTPRINTEXIT( "MainCtrl.BlindMask" )
+    return Bitmap( iBlindMaskId );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMainControl::BlindBlitPosition
+// ---------------------------------------------------------------------------
+//
+TPoint CVtUiMainControl::BlindBlitPosition() const
+    {
+    __VTPRINTENTER( "CVtUiMainControl.BlindBlitPosition" )
+    __VTPRINTEXIT( "CVtUiMainControl.BlindBlitPosition" )
+    return iBlindLayout.Rect().iTl;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMainControl::WaitingTextLayout
+// ---------------------------------------------------------------------------
+//
+TAknTextLineLayout CVtUiMainControl::WaitingTextLayout( TInt aLine )
+    {
+    __VTPRINTENTER( "MainCtrl.WaitingTextLayout" )
+    TAknTextLineLayout textLayout;
+    VtUiLayout::GetSecondWindowWaitingTextLayout( textLayout,
+        aLine ? EFalse : ETrue );
+    __VTPRINTEXIT( "MainCtrl.WaitingTextLayout" )
+    return textLayout;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::SupportSQCif
+// -----------------------------------------------------------------------------
+//
+void CVtUiMainControl::SupportSQCif( TBool aIsSupported )
+    {
+    __VTPRINTENTER( "MainCtrl.SupportSQCif" )
+    const TBool layoutUpdateRequired( aIsSupported != iSQCifRemote );
+    iSQCifRemote = aIsSupported;
+    if ( layoutUpdateRequired )
+        {
+        HandleSizeChanged();
+        }
+    __VTPRINTEXITR( "MainCtrl.SupportSQCif %d", iSQCifRemote )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::LayoutRemoteVideo
+// -----------------------------------------------------------------------------
+//
+void CVtUiMainControl::LayoutRemoteVideo( )
+    {    
+    __VTPRINTENTER( "MainCtrl.LayoutRemoteVideo" )
+    if ( NULL != iRemoteVideoControl )
+        {
+        TRect rectRemoteVideo(StreamClippingRect());
+        rectRemoteVideo.Move(PositionRelativeToScreen());
+        iRemoteVideoControl->SetExtent(rectRemoteVideo.iTl,rectRemoteVideo.Size());
+        }
+    __VTPRINTEXIT( "MainCtrl.LayoutRemoteVideo" )
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiMutedControl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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 of the CVtUiMutedControl control class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiMutedControl.h"
+#include    "VtUiLayout.h"
+#include    <eiklabel.h>
+#include    <aknsutils.h>
+#include    <aknsdrawutils.h>
+#include    <stringloader.h>
+#include    <videotelui.rsg>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiMutedControl::CVtUiMutedControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiMutedControl::CVtUiMutedControl()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMutedControl::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiMutedControl::ConstructL()
+    {
+    HBufC* mutedText = 
+        StringLoader::LoadLC( R_VIDEOTELUI_QTN_INCAL_MUTED_PANE );
+
+    iMutedLabel = new ( ELeave ) CEikLabel;
+    iMutedLabel->SetContainerWindowL( *this );
+    iMutedLabel->SetTextL( *mutedText );
+
+    CleanupStack::PopAndDestroy( mutedText );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMutedControl::~CVtUiMutedControl
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiMutedControl::~CVtUiMutedControl()
+    {
+    AknsUtils::DeregisterControlPosition( this );
+
+    delete iMutedLabel;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMutedControl::HandleResourceChange
+// -----------------------------------------------------------------------------
+//
+void CVtUiMutedControl::HandleResourceChange(
+        TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );
+
+    if ( aType == KAknsMessageSkinChange )
+        {
+        SizeChanged();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMutedControl::Draw
+// -----------------------------------------------------------------------------
+//
+void CVtUiMutedControl::Draw( const TRect& /*aRect*/ ) const
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMutedControl::SizeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiMutedControl::SizeChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+
+    TRect naviPane( Rect() );
+    if ( naviPane.IsEmpty() )
+        {
+        return;
+        }
+
+    TAknTextLineLayout label;
+    VtUiLayout::GetMutedTextLayout( label );
+
+    AknLayoutUtils::LayoutLabel( iMutedLabel, naviPane, label );
+
+    // Update label color
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();        
+    TRgb skinColor;
+
+    TInt error = 
+        AknsUtils::GetCachedColor( 
+            skin, 
+            skinColor, 
+            KAknsIIDQsnTextColors,
+            EAknsCIQsnTextColorsCG2 );
+
+    if ( ( error == KErrNone ) && iMutedLabel )
+        {
+        // Ignore error
+        TRAP_IGNORE(  
+            iMutedLabel->OverrideColorL( EColorLabelText, skinColor ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMutedControl::PositionChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiMutedControl::PositionChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMutedControl::CountComponentControls
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiMutedControl::CountComponentControls() const
+    {
+    return 1; // one label
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMutedControl::ComponentControl
+// -----------------------------------------------------------------------------
+//
+CCoeControl* CVtUiMutedControl::ComponentControl(
+        TInt /*aIndex*/ ) const
+    {
+    return iMutedLabel;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiNaviPane.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,362 @@
+/*
+* 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:  Implementation of the CVtUiNaviPane class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiNaviPane.h"
+#include    "CVtUiNaviPaneControl.h"
+#include    "CVtUiMutedControl.h"
+#include    "CVtUiAppUi.h"
+
+#include    <cvtlogger.h>
+#include    <avkon.rsg>
+#include    <aknnavi.h>
+#include    <aknnavide.h>
+#include    <featmgr.h>
+#include	"tVtuifeaturevariation.h"
+#include    <stringloader.h>
+#include    <videotelui.rsg>
+
+// CONSTANTS
+
+// Timeout after which voice volume bar is switched back to indicators.
+const TInt KVtUiVoiceVolumeTimeout = 2000000;
+
+// LOCAL FUNCTION PROTOTYPES
+
+/**
+* Creates navigation decorator.
+* @param aNaviPane reference to navi pane.
+* @param aControl control to be decorated, ownership passed.
+* @return new navigation decorator instance.
+*/
+CAknNavigationDecorator* CreateDecoratorL(
+    CAknNavigationControlContainer& aNaviPane,
+    CCoeControl* aControl );
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CreateDecoratorL Creates navigation decorator.
+// Returns: new navigation decorator instance.
+// -----------------------------------------------------------------------------
+//
+CAknNavigationDecorator* CreateDecoratorL(
+        CAknNavigationControlContainer& aNaviPane,
+        CCoeControl* aControl )
+    {
+    CAknNavigationDecorator* decoratedFolder =
+        CAknNavigationDecorator::NewL(
+            &aNaviPane,
+            aControl,
+            CAknNavigationDecorator::ENotSpecified );
+
+    CleanupStack::PushL( decoratedFolder );
+    decoratedFolder->SetContainerWindowL( aNaviPane );
+    aControl->SetContainerWindowL( *decoratedFolder );
+    CleanupStack::Pop( decoratedFolder );
+
+    decoratedFolder->MakeScrollButtonVisible( EFalse );
+
+    return decoratedFolder;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::CVtUiNaviPane
+// -----------------------------------------------------------------------------
+//
+CVtUiNaviPane::CVtUiNaviPane(
+        CAknNavigationControlContainer& aNaviPane,
+        CVtUiAppUi& aAppUi )
+    : CActive( CActive::EPriorityStandard ),
+      iNaviPane( aNaviPane ),
+      iAppUi ( aAppUi )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::ConstructL( )
+    {
+    // Create the navi pane indicator (call duration).
+        {
+        CVtUiNaviPaneControl* naviControl =
+            new ( ELeave ) CVtUiNaviPaneControl( *this );
+        CleanupStack::PushL( naviControl );
+        naviControl->ConstructL();
+        CleanupStack::Pop( naviControl );
+
+        iMainIndicators =
+            CreateDecoratorL( iNaviPane, naviControl );
+
+        iNaviPaneControl = naviControl;
+        }
+
+    // Create muted indicator.
+        {
+        HBufC* mutedText = 
+            StringLoader::LoadLC( R_VIDEOTELUI_QTN_INCAL_MUTED_PANE ); 
+
+        iMutedIndicator = iNaviPane.CreateNavigationLabelL( *mutedText );
+        
+        CleanupStack::PopAndDestroy( mutedText );
+        }
+
+    User::LeaveIfError( iTimer.CreateLocal() );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::NewL
+// -----------------------------------------------------------------------------
+//
+CVtUiNaviPane* CVtUiNaviPane::NewL(
+        CAknNavigationControlContainer& aNaviPane,
+        CVtUiAppUi& aAppUi )
+    {
+    CVtUiNaviPane* self =
+        new ( ELeave ) CVtUiNaviPane(
+            aNaviPane, aAppUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::~CVtUiNaviPane
+// -----------------------------------------------------------------------------
+//
+CVtUiNaviPane::~CVtUiNaviPane()
+    {
+    Cancel();
+
+    delete iMainIndicators;
+    delete iMutedIndicator;
+
+    iTimer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::SetCurrentSpeaker
+// Parameter aLoudspeaker defines which speaker is used.
+// ETrue for loudspeaker, EFalse for handset.
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::SetCurrentSpeaker( const TBool aLoudspeaker )
+    {
+    if( iLoudspeaker != aLoudspeaker )
+        {
+        Cancel();
+        if( iCallDurationEnabled || iMicrophoneMuted )
+            {
+            iSliderType = ENone;
+            }
+        }
+    iLoudspeaker = aLoudspeaker;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::SetMuted
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::SetMuted(
+        const TBool aStatus )
+    {
+    __VTPRINT2( DEBUG_GEN, "NaviPane.SetMuted.aStatus=%d", aStatus )
+    if( iMicrophoneMuted != aStatus )
+        {
+        Cancel();
+        // if volume indicator is shown when audio is umuted
+        // volume indicator won't be dismissed and call duration
+        // will not be shown
+        if( iCallDurationEnabled || aStatus )
+            {
+            iSliderType = ENone;
+            }
+        }
+    iMicrophoneMuted = aStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::SetCallDuration
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::SetCallDuration(
+        const TTimeIntervalSeconds& aDuration,
+        const TBool aEnabled )
+    {
+    iCallDurationEnabled = aEnabled;
+    iNaviPaneControl->SetCallDuration( aDuration, aEnabled );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::CommitL
+//
+// Priority order of different navi pane elements is the following:
+// 1. Muted indicator
+// 2. Main indicators (call duration)
+//
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::CommitL()
+    {
+    CAknNavigationDecorator* selected = DefaultIndicator();
+
+    PushL( selected );
+
+    // If current is main indicators, then update now.
+    if ( iCurrent == iMainIndicators )
+        {
+        iNaviPaneControl->CommitL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::GetSpeakerVolume
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::GetSpeakerVolume(
+        const TBool ,
+        TInt& aValue ) const
+    {
+    aValue = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::HandleResourceChange
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::HandleResourceChange(
+        TInt aType )
+    {
+    // iCurrent will get event through navi pane.
+    if ( iMainIndicators != iCurrent )
+        {
+        iMainIndicators->HandleResourceChange( aType );
+        iNaviPaneControl->HandleResourceChange( aType );
+        }
+    if ( iMutedIndicator != iCurrent )
+        {
+        iMutedIndicator->HandleResourceChange( aType );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::DoCancel()
+    {
+    iTimer.Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::RunL
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::RunL()
+    {
+    iSliderType = ENone;
+    CAknNavigationDecorator* selected = DefaultIndicator();
+    if ( selected )
+        {
+        PushL( selected );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::PushAfterTimeout
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::PushAfterTimeout()
+    {
+    Cancel();
+    iTimer.After( iStatus, KVtUiVoiceVolumeTimeout );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::PushL
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPane::PushL( CAknNavigationDecorator* aNew )
+    {
+    if ( !aNew )
+        {
+        if ( iCurrent )
+            {
+            iNaviPane.Pop();
+            iCurrent = NULL;
+            }
+        else
+            {
+            iNaviPane.PushDefaultL();
+            }
+        }
+    else if ( iCurrent != aNew )
+        {
+        // If current not defined, then push to navi pane. This should be called
+        // during construction.
+        if ( !iCurrent )
+            {
+            iNaviPane.PushL( *aNew );
+            iCurrent = aNew;
+            }
+        // Otherwise replace the old one.
+        else
+            {
+            iNaviPane.ReplaceL( *iCurrent, *aNew );
+            iCurrent = aNew;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::DefaultIndicator
+// Returns default indicator. Note that this does not include temporary
+// zoom indicator.
+// -----------------------------------------------------------------------------
+//
+CAknNavigationDecorator* CVtUiNaviPane::DefaultIndicator() const
+    {
+    CAknNavigationDecorator* selected = NULL;
+
+    if ( IsActive() )
+        {
+        selected = iMainIndicators;
+        }
+    else if ( iMicrophoneMuted && iSliderType != EVolume && iSliderType != EZoom )
+        {
+        selected = iMutedIndicator;
+        }
+     else if ( iCallDurationEnabled && iSliderType != EVolume && iSliderType != EZoom )
+        {
+        selected = iMainIndicators;
+        }
+
+    return selected;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiNaviPaneControl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2004, 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:  Implementation of the CVtUiNaviPaneControl control class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiNaviPaneControl.h"
+#include    "CVtUiNaviPane.h"
+#include    "VtUiLayout.h"
+#include    <aknsutils.h>
+#include    <aknsdrawutils.h>
+
+// CONSTANTS
+
+// There are sixty seconds in one minute.
+const TInt KVtUiOneMinuteInSeconds = 60;
+
+// There are sixty minutes in one hour.
+const TInt KVtUiOneHourInSeconds = 3600;
+
+// Maximum duration is 99:59:59.
+const TInt KVtUiMaxDurationInSeconds = 
+    99*KVtUiOneHourInSeconds + 
+    59*KVtUiOneMinuteInSeconds +
+    59;
+
+// Amount of digits.
+const TInt KVtUiDigits = 10;
+
+// Index of time separator.
+const TInt KVtUiSeparatorTime = 0;
+
+// Index of hour separator.
+const TInt KVtUiSeparatorHour = 1;
+
+// Index of minute separator.
+const TInt KVtUiSeparatorMinute = 2;
+
+// Index of second separator.
+const TInt KVtUiSeparatorSecond = 3;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::CVtUiNaviPaneControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiNaviPaneControl::CVtUiNaviPaneControl( CVtUiNaviPane& aNaviPane )
+    : iNaviPane ( aNaviPane )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPaneControl::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::~CVtUiNaviPaneControl
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiNaviPaneControl::~CVtUiNaviPaneControl()
+    {
+    AknsUtils::DeregisterControlPosition( this );
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::SetCallDuration
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPaneControl::SetCallDuration( 
+        const TTimeIntervalSeconds& aDuration,
+        const TBool aEnabled )
+    {
+    iCallDurationEnabled = aEnabled;
+    iCallDuration = aDuration;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::CommitL
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPaneControl::CommitL()
+    {
+    ReportEventL( MCoeControlObserver::EEventStateChanged ); 
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::Draw
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPaneControl::Draw( const TRect& /*aRect*/ ) const
+    {
+    CWindowGc& gc = SystemGc();
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    
+    const TDesC& callDurationText = GetCallDurationText();
+    if ( callDurationText.Length() )
+        {
+        TRgb color = iCallDurationLayout.Color();
+        // Color is not updated if it not found from the skin
+        AknsUtils::GetCachedColor(
+            skin,
+            color,
+            KAknsIIDQsnTextColors,
+            EAknsCIQsnTextColorsCG2 );
+        iCallDurationLayout.DrawText( gc, callDurationText, EFalse, color );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::SizeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPaneControl::SizeChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+    TAknWindowLineLayout rect;
+    TRect parent( Rect() );
+    if ( parent.IsEmpty() )
+        {
+        return;
+        }
+
+    TAknTextLineLayout text;
+    VtUiLayout::GetCallDurationTextLayout( text );
+    iCallDurationLayout.LayoutText( parent, text );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::PositionChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPaneControl::PositionChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::GetCallDurationText
+// -----------------------------------------------------------------------------
+//
+const TDesC& CVtUiNaviPaneControl::GetCallDurationText() const
+    {
+    iCallDurationBuffer.Zero();
+
+    if ( iCallDurationEnabled )
+        {
+        TLocale locale;
+    
+        TInt durationInseconds = iCallDuration.Int();
+        if ( durationInseconds > KVtUiMaxDurationInSeconds )
+            {
+            durationInseconds = KVtUiMaxDurationInSeconds;
+            }
+
+        const TInt hours = durationInseconds / KVtUiOneHourInSeconds;
+        const TInt secondsLeft = 
+            durationInseconds - ( hours * KVtUiOneHourInSeconds );
+
+        const TInt minutes = secondsLeft / KVtUiOneMinuteInSeconds;
+        const TInt seconds = 
+            secondsLeft - ( minutes * KVtUiOneMinuteInSeconds );
+
+        AppendChar( 
+            iCallDurationBuffer, 
+            locale.TimeSeparator( KVtUiSeparatorTime ) );
+
+        AppendNum( 
+            iCallDurationBuffer,
+            hours );
+    
+        AppendChar( 
+            iCallDurationBuffer, 
+            locale.TimeSeparator( KVtUiSeparatorHour ) );
+    
+        AppendNum( 
+            iCallDurationBuffer, 
+            minutes );
+
+        AppendChar( 
+            iCallDurationBuffer, 
+            locale.TimeSeparator( KVtUiSeparatorMinute ) );
+
+        AppendNum( 
+            iCallDurationBuffer, 
+            seconds );
+
+        AppendChar( 
+            iCallDurationBuffer, 
+            locale.TimeSeparator( KVtUiSeparatorSecond ) );
+
+        // Convert numbers to display language.
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( 
+            iCallDurationBuffer );
+        }
+
+    return iCallDurationBuffer;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::AppendChar
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPaneControl::AppendChar( 
+        TDes& aBuffer,
+        const TChar& aChar )
+    {
+    if ( aChar )
+        {
+        aBuffer.Append( aChar );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPaneControl::AppendNum
+// -----------------------------------------------------------------------------
+//
+void CVtUiNaviPaneControl::AppendNum(
+        TDes& aBuffer,
+        TInt aNumber )
+    {
+    if ( aNumber < 0 )
+        {
+        aNumber = 0;
+        }
+
+    const TInt firstDigit = ( aNumber / KVtUiDigits ) % KVtUiDigits;
+    const TInt secondDigit = ( aNumber % KVtUiDigits );
+
+    aBuffer.AppendNum( firstDigit );
+    aBuffer.AppendNum( secondDigit );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiNumberEntryActivationControl.cpp	Mon Nov 23 14:47:47 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:  Implementation of the CVtUiNumberEntryActivationControl
+*                control class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiNumberEntryActivationControl.h"
+#include    "CVtUiAppUi.h"
+#include    "VtUiUtility.h"
+
+#include    <aknutils.h>
+#include    <aknsutils.h>
+#include    <eikenv.h>
+#include    <cvtlogger.h>
+
+// CONSTANTS
+
+// Control priority for the forwarder control. Above all other controls.
+extern const TInt KVtUiNumberEntryActivationPriority =
+    ECoeStackPriorityEnvironmentFilter + 100;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryActivationControl::CVtUiNumberEntryActivationControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiNumberEntryActivationControl::CVtUiNumberEntryActivationControl(
+        CVtUiAppUi& aAppUi )
+    : iAppUi( aAppUi ), iIsActive ( ETrue )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryActivationControl::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryActivationControl::ConstructL( const TRect& aRect )
+    {
+    // Create invisible control.
+    CreateWindowL();
+    MakeVisible( EFalse );
+    SetRect( aRect );
+
+    iAppUi.AddToStackL(
+        this,
+        KVtUiNumberEntryActivationPriority,
+        ECoeStackFlagRefusesFocus );
+    iAddedToStack = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryActivationControl::~CVtUiNumberEntryActivationControl
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiNumberEntryActivationControl::~CVtUiNumberEntryActivationControl()
+    {
+    AknsUtils::DeregisterControlPosition( this );
+
+    if ( iAddedToStack )
+        {
+        iAppUi.RemoveFromStack( this );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryActivationControl::Draw
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryActivationControl::Draw( const TRect& /*aRect*/ ) const
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryActivationControl::SizeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryActivationControl::SizeChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryActivationControl::PositionChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryActivationControl::PositionChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryActivationControl::OfferKeyEventL
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CVtUiNumberEntryActivationControl::OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType )
+    {
+    __VTPRINTENTER( "VtUiNumberEntryAC.OfferKeyEvent" )
+    TBool numberEntryOpen = EFalse;
+    TChar dtmfTone;
+    TBool playDtmfTone = EFalse;
+    TKeyResponse keyResponse = EKeyWasNotConsumed;
+    if ( aKeyEvent.iScanCode == EStdKeyYes )
+        {
+        // send key is always consumed to prevent event forwarding to telephony
+        // EStdKeyYes is scan code for send key, iCode cannot be used because
+        // it is valid only when event type is EEventKey (not in up/down events)
+        keyResponse = EKeyWasConsumed;
+        }    
+    if ( !iIsActive )
+        {
+        return keyResponse;
+        }
+
+    if ( !aKeyEvent.iRepeats )
+        {
+        if ( VtUiUtility::IsDTMFEvent( aKeyEvent, dtmfTone ) )
+            {
+            numberEntryOpen = iAppUi.OpenNumberEntryL();
+            playDtmfTone = ( aType == EEventKey );
+            }
+        else if ( aKeyEvent.iCode == EKeyPhoneSend )
+            {
+            keyResponse = iAppUi.HandlePhoneSendKeyL( aKeyEvent, aType );
+            }
+        }
+
+    if ( numberEntryOpen )
+        {
+        iEikonEnv->SyncNotifyFocusObserversOfChangeInFocus();
+        }
+
+    // Tone actions are delegated to current state for validation.
+    if ( playDtmfTone )
+        {        
+        iAppUi.State().StartDtmfTone( dtmfTone );
+        }
+    else if ( aType == EEventKeyUp )
+        {
+        iAppUi.State().StopDtmfTone();
+        } 
+    __VTPRINTEXITR( "VtUiNumberEntryAC.OfferKeyEvent %d", keyResponse )
+    return keyResponse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryActivationControl::SetActive
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryActivationControl::SetActive( TBool aIsActive )
+    {
+    iIsActive = aIsActive;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiRemoteVideoControl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,215 @@
+/*
+* 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 of the CVtUiRemoteVideoControl
+*                control class.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <cvtlogger.h>
+#include   <eikdef.h>
+#include    <aknincallbubblenotify.h>
+#include    <aknslayeredbackgroundcontrolcontext.h>
+#include    <aknutils.h>
+#include    <aknnavi.h>
+#include    <akntitle.h>
+#include    <akndlgshut.h>
+#include    <aknnotedialog.h>
+#include    <aknnotewrappers.h>
+#include    <akncontext.h>
+#include    <eikspane.h>
+#include    <eikmenup.h>
+#include    <eikmenub.h>
+#include    <apgcli.h>
+#include    <featmgr.h>
+#include    <videotelui.rsg>
+#include    <hlplch.h>
+#include    <apgwgnam.h>
+#include    <stringloader.h>
+#include    <akndef.h>
+#include    <aknconsts.h>
+#include    "CVtUiRemoteVideoControl.h"
+#include    "CVtUiAppUi.h"
+#include    "CVtUiContextControl.h"
+
+
+// Implementation of CVtUiRemoteVideoControl
+
+// -----------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::NewL
+// -----------------------------------------------------------------------------
+
+CVtUiRemoteVideoControl* CVtUiRemoteVideoControl::NewL( CVtUiAppUi& aAppUi)
+    {
+    __VTPRINTENTER( "RemoteVideoControl.NewL" )
+    CVtUiRemoteVideoControl* self = new ( ELeave ) CVtUiRemoteVideoControl(aAppUi);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "RemoteVideoControl.NewL" )
+    return self;
+
+    }
+// ---------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::~CVtUiRemoteVideoControl
+// ---------------------------------------------------------------------------
+//
+CVtUiRemoteVideoControl::~CVtUiRemoteVideoControl()
+    {    
+    __VTPRINTENTER( "RemoteVideoControl.~" )
+    __VTPRINTEXIT( "RemoteVideoControl.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::CVtUiVideoControlBase
+// ---------------------------------------------------------------------------
+//
+CVtUiRemoteVideoControl::CVtUiRemoteVideoControl( CVtUiAppUi& aAppUi):
+    iAppUi(aAppUi)
+    {
+    __VTPRINTENTER( "RemoteVideoControl.ctor" )
+    __VTPRINTEXIT( "RemoteVideoControl.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::BaseConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiRemoteVideoControl::ConstructL()
+    {
+    __VTPRINTENTER( "RemoteVideoControl.ConstructL" )
+    CreateWindowL();
+    SetExtent( TPoint(), TSize() );
+    ActivateL();
+    //Window().SetNonFading( ETrue );    
+    __VTPRINTEXIT( "RemoteVideoControl.ConstructL" )
+    }
+
+RWindow& CVtUiRemoteVideoControl::GetRWindow()
+    {
+    __VTPRINTENTER( "RemoteVideoControl.GetRWindow" )
+    __VTPRINTEXIT( "RemoteVideoControl.GetRWindow" )
+    return Window();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::HandleSizeChanged
+// ---------------------------------------------------------------------------
+//
+void CVtUiRemoteVideoControl::HandleSizeChanged()
+    {
+    __VTPRINTENTER( "RemoteVideoControl.HandleSizeChanged" )    
+    __VTPRINTEXIT( "RemoteVideoControl.HandleSizeChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::SizeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiRemoteVideoControl::SizeChanged()
+    {
+    __VTPRINTENTER( "RemoteVideoControl.SizeChanged" )
+    TPoint position = Position();
+    TRect rect = Rect();
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl position x:%d", position.iX )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl position y:%d", position.iY )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl rect iTl.x:%d", rect.iTl.iX )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl rect iTl.y:%d", rect.iTl.iY )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl rect iBr.x:%d", rect.iBr.iX )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl rect iBr.y:%d", rect.iBr.iY )
+
+    __VTPRINTEXIT( "RemoteVideoControl.SizeChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::PositionChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiRemoteVideoControl::PositionChanged()
+    {
+    __VTPRINTENTER( "RemoteVideoControl.PositionChanged" )
+    __VTPRINTEXIT( "RemoteVideoControl.PositionChanged" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::Draw
+// ---------------------------------------------------------------------------
+//
+void CVtUiRemoteVideoControl::Draw( const TRect& ) const
+    {
+    __VTPRINTENTER( "RemoteVideoControl.Draw" )
+    //DoDraw( SystemGc() );
+    __VTPRINTEXIT( "RemoteVideoControl.Draw" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::DoDraw
+// ---------------------------------------------------------------------------
+//
+void CVtUiRemoteVideoControl::DoDraw( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "RemoteVideoControl.DoDraw(gc)" )
+ 
+   aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+   aGc.SetPenStyle( CGraphicsContext::ENullPen );
+   aGc.SetBrushColor( KRgbRed );
+   aGc.DrawRect( Rect() );
+   aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
+    
+    TPoint position = Position();
+    TRect rect = Rect();
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl position x:%d", position.iX )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl position y:%d", position.iY )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl rect iTl.x:%d", rect.iTl.iX )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl rect iTl.y:%d", rect.iTl.iY )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl rect iBr.x:%d", rect.iBr.iX )
+    __VTPRINT2( DEBUG_GEN, "CVtUiRemoteVideoControl rect iBr.y:%d", rect.iBr.iY )
+
+    __VTPRINTEXIT( "RemoteVideoControl.DoDraw(gc)" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::HandlePointerEventL
+// -----------------------------------------------------------------------------
+//
+void CVtUiRemoteVideoControl::HandlePointerEventL(
+    const TPointerEvent& aPointerEvent)
+    {
+    __VTPRINTENTER( "RemoteVideoControl.HandlePointerEventL" )
+    
+    if(iAppUi.ContextControl().RemoteVideoControl())
+        {
+        iAppUi.ContextControl().HandlePointerEventL(aPointerEvent);
+        }
+    
+    __VTPRINTEXIT( "RemoteVideoControl.HandlePointerEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiRemoteVideoControl::HandleWsEventL
+// -----------------------------------------------------------------------------
+//
+void CVtUiRemoteVideoControl::HandleWsEventL( const TWsEvent& aEvent,
+    CCoeControl* aDestination )
+    {
+    __VTPRINTENTER( "RemoteVideoControl.HandleWsEventL" )
+    
+    if(iAppUi.ContextControl().RemoteVideoControl())
+    {
+    iAppUi.ContextControl().HandleWsEventL( aEvent, aDestination );
+    }    
+    
+    __VTPRINTEXIT( "RemoteVideoControl.HandleWsEventL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/CVtUiZoomControl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,856 @@
+/*
+* Copyright (c) 2004, 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:  Implementation of the CVtUiZoomControl control class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CVtUiZoomControl.h"
+#include    "VtUiLayout.h"
+#include    <aknsutils.h>
+#include    <aknsdrawutils.h>
+#include    "videotelui.hrh"
+
+#include    <cvtlogger.h>
+// CONSTANTS
+
+// Maximum amount of steps.
+const TInt KVtUiZoomControlMaxSteps = 11;
+
+// Minimum amount of steps.
+const TInt KVtUiZoomControlMinSteps = 1;
+
+// Fixed point position.
+const TInt KVtUiZoomControlFixed = 16;
+
+// Fixed point number, corresponds to one.
+const TInt KVtUiZoomControlOne = ( 1 << KVtUiZoomControlFixed );
+
+// Amount of partial bits. It is expected that 
+// KVtUiZoomControlFixed >= KVtUiZoomControlPartial.
+const TInt KVtUiZoomControlPartial = 8;
+
+// Maximum duration of zooming from minimum to maximum, in microseconds.
+const TInt KVtUiZoomDurationMax = 2000000;
+
+// Maximum duration to increase zoom step by one, in microseconds.
+const TInt KVtUiZoomStepDurationMax = 200000;
+
+// Index of transparent color.
+const TInt KVtUiZoomTransparent = 0;
+
+// MODULE DATA STRUCTURES
+
+/**
+* Inner class to hold everything related to one bitmap.
+* @since Series 60 2.6
+*/
+class CVtUiZoomControl::CBitmap
+    : public CBase
+    {
+    public: // Constructors and destructors.
+
+        /**
+        * Constructor.
+        */
+        CBitmap();
+
+        /**
+        * Symbian OS constructor.
+        * @param aSize size of the bitmap.
+        * @param aMode display mode of the bitmap.
+        */
+        void ConstructL( 
+            const TSize& aSize,
+            const TDisplayMode aMode );
+
+        /**
+        * Destructor.
+        */
+        ~CBitmap();
+
+    public:
+
+        /**
+        * Returns bitmap.
+        * @return bitmap, ownership not passed.
+        */
+        inline CFbsBitmap* Bitmap() const;
+
+        /**
+        * Returns bitmap context.
+        * @return bitmap context, ownership not passed.
+        */
+        inline CFbsBitGc* Context() const;
+
+    private:
+
+        // Owned bitmap.
+        CFbsBitmap* iBitmap;
+
+        // Owned device.
+        CFbsBitmapDevice* iDevice;
+
+        // Owned context.
+        CFbsBitGc* iContext;
+
+    };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::CVtUiZoomControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiZoomControl::CVtUiZoomControl( CVtUiBitmapManager& aBitmapManager )
+    : iBitmapManager( aBitmapManager )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::ConstructL()
+    {
+    iZoomDirId = 
+        iBitmapManager.AddBitmapsL( 
+            EVtUiBitmap_qgn_indi_zoom_dir, 
+            EVtUiBitmap_qgn_indi_zoom_dir_mask,
+            ETrue );
+    iZoomAreaId =
+        iBitmapManager.AddBitmapL( EVtUiBitmap_qgn_graf_zoom_area, EFalse );
+    iBitmapManager.SetAspectRatio( iZoomAreaId, EFalse );
+
+    iZoomMinId =
+        iBitmapManager.AddBitmapL( EVtUiBitmap_qgn_indi_zoom_min, EFalse );
+    iBitmapManager.SetAspectRatio( iZoomMinId, EFalse );
+
+    iZoomMaxId =
+        iBitmapManager.AddBitmapL( EVtUiBitmap_qgn_indi_zoom_max, EFalse );
+    iBitmapManager.SetAspectRatio( iZoomMaxId, EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::~CVtUiZoomControl
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiZoomControl::~CVtUiZoomControl()
+    {
+    AknsUtils::DeregisterControlPosition( this );
+
+    iBitmapManager.RemoveBitmap( iZoomDirId );
+    iBitmapManager.RemoveBitmap( iZoomAreaId );
+    iBitmapManager.RemoveBitmap( iZoomMinId );
+    iBitmapManager.RemoveBitmap( iZoomMaxId );
+
+    delete iZoomPartialMask;
+    delete iZoomPartialShade;
+    delete iZoomPartialShadeMask;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::SetZoomParams
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::SetZoomParams( 
+        const TInt aStepCount, 
+        const TInt aCurrentStep )
+    {
+    iCurrentZoomStep = aCurrentStep;
+    iMaxZoomStep = aStepCount;
+    if ( iMaxZoomStep < 0 )
+        {
+        iMaxZoomStep = 0;
+        }
+    iCurrentZoomStep = Max( Min( iCurrentZoomStep, iMaxZoomStep ), 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::CommitL
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::CommitL()
+    {
+    ReportEventL( MCoeControlObserver::EEventStateChanged );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::IsZoomEnabled
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiZoomControl::IsZoomEnabled() const
+    {
+    return ( iMaxZoomStep > 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::GetZoomParams
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::GetZoomParams(
+        TInt& aStepCount,
+        TInt& aCurrentStep ) const
+    {
+    aStepCount = iMaxZoomStep;
+    aCurrentStep = iCurrentZoomStep;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::UpdateZoomL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiZoomControl::UpdateZoomL()
+    {
+    const TInt oldZoomStep = iCurrentZoomStep;
+    if ( iZoomDirection )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUiZmCtl.UpdZoom" )
+        TTime timeNow;
+        timeNow.UniversalTime();
+
+        const TTimeIntervalMicroSeconds duration = 
+            timeNow.MicroSecondsFrom( iZoomStartTime );
+
+        if ( duration >= TInt64( KVtUiZoomDurationMax ) )
+            {
+            // Duration is over maximum, so we can stop zooming.
+            if ( iZoomDirection > 0 )
+                {
+                iCurrentZoomStep = iMaxZoomStep;
+                }
+            else
+                {
+                iCurrentZoomStep = 0;
+                }
+
+            iZoomDirection = 0;
+            }
+        else if ( duration < TInt64( 0 ) )
+            {
+            // Clock has been changed. Stop zooming.
+            iZoomDirection = 0;
+            }
+        else
+            {
+            // Zoom is increased at least by one step per 0.2 seconds.
+            TInt64 minimum( duration.Int64() );
+            minimum /= KVtUiZoomStepDurationMax;
+
+            // Zoom is increased from minimum to maximum in 2 seconds.
+            TInt64 maximum( duration.Int64() );
+            maximum *= iMaxZoomStep;
+            maximum /= KVtUiZoomDurationMax;
+
+            // Select maximum.
+            TInt zoomStepDelta = 
+                iZoomDirection * Max( I64INT( minimum ), I64INT( maximum ) );
+            TInt zoomStep = iZoomStepStart + zoomStepDelta;
+
+            // If minimum has been reached, zooming can be stopped.
+            if ( zoomStep < 0 )
+                {
+                zoomStep = 0;
+                iZoomDirection = 0;
+                }
+            // If maximum has been reached, zooming can be stopped.
+            if ( zoomStep > iMaxZoomStep )
+                {
+                zoomStep = iMaxZoomStep;
+                iZoomDirection = 0;
+                }
+
+            iCurrentZoomStep = zoomStep;
+            }
+        __VTPRINT( DEBUG_GEN, "VtUiZmCtl.chk" )
+        }
+
+    const TBool updateNeeded = ( oldZoomStep != iCurrentZoomStep );
+    if ( updateNeeded )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUiZmCtl.upd" )
+        ReportEventL( MCoeControlObserver::EEventStateChanged );
+        }
+
+    return updateNeeded;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::StopZoom
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::StopZoom()
+    {
+    iZoomDirection = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::OfferKeyEventL
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CVtUiZoomControl::OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType )
+    {
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if ( aKeyEvent.iScanCode == EStdKeyUpArrow ||
+         aKeyEvent.iScanCode == EStdKeyDownArrow ||
+         aKeyEvent.iCode == EKeyZoomIn ||
+         aKeyEvent.iCode == EKeyZoomOut )
+        {
+        switch ( aType )
+            {
+            case EEventKey:
+                {
+                TInt direction = +1;
+                if ( aKeyEvent.iScanCode == EStdKeyDownArrow ||
+                    aKeyEvent.iCode == EKeyZoomOut )
+                    {
+                    direction = -1;
+                    }
+        
+                if ( !aKeyEvent.iRepeats )
+                    {
+                    // Update start parameters.
+                    iZoomDirection = direction;
+                    iZoomStepStart = iCurrentZoomStep + direction;
+                    iZoomStepStart = Min( iZoomStepStart, iMaxZoomStep );
+                    iZoomStepStart = Max( iZoomStepStart, 0 );
+                    iZoomStartTime.UniversalTime();
+                    }
+                
+                (void)UpdateZoomL();
+                }
+                break;
+
+            case EEventKeyUp:
+                // Stop zooming.
+                iZoomDirection = 0;
+                break;
+
+            default:
+                // Do nothing.
+                break;
+            }
+
+        response = EKeyWasConsumed;
+        }
+
+    return response;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::HandleResourceChange
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::HandleResourceChange(
+        TInt aType )
+    {
+    if ( aType == KAknsMessageSkinChange ) 
+        {
+        // We must refresh partial bitmap upon next redraw.
+        iZoomMaskPartial = KErrNotFound;
+        iZoomMaskRow = KErrNotFound;
+        }
+
+    CCoeControl::HandleResourceChange( aType );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::Draw
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::Draw( const TRect& /*aRect*/ ) const
+    {   
+    __VTPRINT( DEBUG_GEN, "VtUiZmCtl.Draw" )   
+    iBitmapManager.SetSizeAndColor( 
+        iZoomDirId, 
+        iZoomDirLayout.Rect().Size(),
+        iZoomDirLayout.Color() );
+    iBitmapManager.SetSize( 
+        iZoomAreaId, 
+        iZoomAreaLayout.Rect().Size() );
+    iBitmapManager.SetSize( 
+        iZoomMinId, 
+        iZoomAreaLayout.Rect().Size() );
+    iBitmapManager.SetSize( 
+        iZoomMaxId, 
+        iZoomAreaLayout.Rect().Size() );
+
+    CFbsBitmap* maxBitmap = NULL;
+    CFbsBitmap* minBitmap = NULL;
+    CFbsBitmap* areaBitmap = NULL;
+    iBitmapManager.GetBitmap( iZoomMaxId, maxBitmap );
+    iBitmapManager.GetBitmap( iZoomMinId, minBitmap );
+    iBitmapManager.GetBitmap( iZoomAreaId, areaBitmap );
+
+    TInt full;
+    TInt partial;
+    TRect drawRect;
+    TPoint drawPos;
+
+    DetermineSteps( full, partial );
+    if ( areaBitmap && partial && ( full < KVtUiZoomControlMaxSteps ) )
+        {
+        // First generate bitmaps, so that drawing can be done 
+        // quickly in sequence.
+        GetPositionAndRect( 
+            drawPos,
+            drawRect,
+            full + 1 );
+
+        if ( !GenerateZoomMaskBitmap( 
+                areaBitmap, 
+                partial, 
+                drawRect.iTl.iY,
+                drawRect.Size() ) )
+            {
+            // If zoom mask generation fails, then we have no choice
+            // than not to draw.
+            partial = 0; 
+            }
+        }
+
+    CWindowGc& gc = SystemGc();
+    gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+
+    // Draw zoom direction indicator:
+
+    CFbsBitmap* zoomDirBitmap = NULL;
+    CFbsBitmap* zoomDirMask = NULL;
+    iBitmapManager.GetBitmaps( iZoomDirId, zoomDirBitmap, zoomDirMask );
+    if ( zoomDirBitmap && zoomDirMask )
+        {
+        iZoomDirLayout.DrawImage( gc, zoomDirBitmap, zoomDirMask );
+        }
+    
+    // Draw zoom indicator:
+    if ( !areaBitmap )
+        {
+        // If area bitmap is invalid, then we have to return.
+        return;
+        }
+
+    if ( maxBitmap )
+        {
+        // First, draw maximum area.
+        for ( TInt index = KVtUiZoomControlMinSteps; 
+              index <= full; 
+              index++ )
+            {
+            GetPositionAndRect( 
+                drawPos, 
+                drawRect, 
+                index );
+            gc.BitBltMasked( 
+                drawPos,
+                maxBitmap, 
+                drawRect, 
+                areaBitmap, 
+                ETrue );
+            }
+        }
+
+    if ( minBitmap && ( full < KVtUiZoomControlMaxSteps ) )
+        {
+        // Then draw minimum area.
+        for ( TInt index = full + 1; 
+              index <= KVtUiZoomControlMaxSteps; 
+              index++ )
+            {
+            GetPositionAndRect( 
+                drawPos, 
+                drawRect, 
+                index );
+            gc.BitBltMasked( 
+                drawPos, 
+                minBitmap, 
+                drawRect, 
+                areaBitmap, 
+                ETrue );
+            }
+
+        if ( maxBitmap && partial && iZoomPartialMask )
+            {
+            // Finally draw partial area.
+            GetPositionAndRect( 
+                drawPos,
+                drawRect,
+                full + 1 );
+            gc.BitBltMasked( 
+                drawPos,
+                maxBitmap,
+                drawRect, 
+                iZoomPartialMask->Bitmap(),
+                ETrue );
+            }
+        }
+    
+    __VTPRINT( DEBUG_GEN, "VtUiZmCtl.Draw.ok" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::SizeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::SizeChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+
+    TRect parent( Rect() );
+    TAknWindowLineLayout rect;
+    if ( parent.IsEmpty() )
+        {
+        return;
+        }
+
+        {
+        TAknLayoutRect& tmpRect = iZoomDirLayout; 
+        VtUiLayout::GetZoomPaneLayout( rect );
+        tmpRect.LayoutRect( parent, rect );
+        parent = tmpRect.Rect();
+        iZoomPaneRect = parent;
+        }
+
+    VtUiLayout::GetZoomDirLayout( rect );
+    iZoomDirLayout.LayoutRect( parent, rect );
+    iBitmapManager.SetSizeAndColor( 
+        iZoomDirId, 
+        iZoomDirLayout.Rect().Size(),
+        iZoomDirLayout.Color() );
+
+    VtUiLayout::GetZoomAreaLayout( rect );
+    iZoomAreaLayout.LayoutRect( parent, rect );
+    iBitmapManager.SetSize( 
+        iZoomAreaId, 
+        iZoomAreaLayout.Rect().Size() );
+    iBitmapManager.SetSize( 
+        iZoomMinId, 
+        iZoomAreaLayout.Rect().Size() );
+    iBitmapManager.SetSize( 
+        iZoomMaxId, 
+        iZoomAreaLayout.Rect().Size() );
+    (void) CreateBitmaps();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::PositionChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::PositionChanged()
+    {
+    AknsUtils::RegisterControlPosition( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::DetermineSteps
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::DetermineSteps(
+        TInt& aFullSteps,
+        TInt& aPartialStep ) const
+    {
+    aFullSteps = 1;
+    aPartialStep = 0;
+
+    TInt currentZoomStep = Max( Min( iCurrentZoomStep, iMaxZoomStep ), 0 );
+
+    if ( iMaxZoomStep > 0 )
+        {
+        TInt zoomDeltaSteps = 0;
+        TInt zoomDeltaMaxSteps = 0;
+
+        // Formula equals: x = ( N * ( y - 1 ) ) / 10.
+        
+        aFullSteps = KVtUiZoomControlMinSteps;
+        const TInt divider = 
+            KVtUiZoomControlMaxSteps - KVtUiZoomControlMinSteps;
+        for ( TInt row = KVtUiZoomControlMaxSteps - 1; 
+              row >= KVtUiZoomControlMinSteps - 1;
+              row-- )
+            {
+            const TInt zoomStartSteps = 
+                ( iMaxZoomStep * row ) / divider;
+            const TInt previousZoomStartSteps = 
+                ( iMaxZoomStep * ( row - 1 ) ) / divider;
+
+            if ( ( currentZoomStep >= zoomStartSteps ) &&
+                 ( previousZoomStartSteps != zoomStartSteps ) )
+                {
+                aFullSteps = ( row + 1 );
+                zoomDeltaSteps = currentZoomStep - zoomStartSteps;
+                zoomDeltaMaxSteps = ( iMaxZoomStep * ( row + 1 ) ) / divider;
+                zoomDeltaMaxSteps -= zoomStartSteps;
+                break;
+                }
+            }
+
+        aPartialStep = 0;
+        if ( zoomDeltaSteps && zoomDeltaMaxSteps )
+            {
+            TInt64 partial( zoomDeltaSteps );
+            partial *= KVtUiZoomControlOne;
+            partial /= zoomDeltaMaxSteps;
+            
+            partial >>= ( KVtUiZoomControlFixed - KVtUiZoomControlPartial );
+            aPartialStep = I64INT( partial );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::GenerateZoomMaskBitmap
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiZoomControl::GenerateZoomMaskBitmap(
+        CFbsBitmap* aMaskBitmap,    
+        const TInt aPartial,
+        const TInt aRow,
+        const TSize& aRowSize ) const
+    {
+    if ( iZoomPartialMask && 
+         ( ( iZoomMaskPartial != aPartial ) || 
+           ( iZoomMaskRow != aRow ) ) )
+        {
+        DoGenerateZoomMaskBitmap( 
+            aMaskBitmap,
+            aPartial, 
+            aRow,
+            aRowSize );
+        }
+    return ( iZoomPartialMask != NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::DoGenerateZoomMaskBitmap
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::DoGenerateZoomMaskBitmap(
+        CFbsBitmap* aMaskBitmap,
+        const TInt aPartial,
+        const TInt aRow,
+        const TSize& aRowSize ) const
+    {
+    CFbsBitGc* bitmapMaskGc = iZoomPartialMask->Context();
+    
+    CFbsBitmap* shade = iZoomPartialShade->Bitmap();
+    CFbsBitGc* shadeGc = iZoomPartialShade->Context();
+
+    // Fill shade with aPartial.
+    shadeGc->SetPenStyle( CGraphicsContext::ENullPen );
+    shadeGc->SetBrushColor( TRgb::Gray256( aPartial ) );
+    shadeGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
+    shadeGc->Clear(); 
+    
+    // Now grab one row from iZoomAreaBitmap.
+    CFbsBitmap* mask = iZoomPartialShadeMask->Bitmap();
+    CFbsBitGc* maskGc = iZoomPartialShadeMask->Context();
+
+    // Clear with transparency.
+    maskGc->SetPenStyle( CGraphicsContext::ENullPen );
+    maskGc->SetBrushColor( TRgb::Gray2( 1 ) ); // transparency
+    maskGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
+    maskGc->Clear(); 
+
+    maskGc->SetPenStyle( CGraphicsContext::ENullPen );
+    // Blit appropriate region from aMaskBitmap to maskGc.
+    maskGc->BitBlt( 
+        TPoint( 0, aRow ), 
+        aMaskBitmap, 
+        TRect( TPoint( 0, aRow ), aRowSize ) );
+
+    // Now fill bitmapMask with black (= transparency).
+    bitmapMaskGc->SetPenStyle( CGraphicsContext::ENullPen );
+    bitmapMaskGc->SetBrushColor( TRgb::Gray256( KVtUiZoomTransparent ) );
+    bitmapMaskGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
+    bitmapMaskGc->Clear();
+
+    // Then blit shade masked
+    TPoint origin;
+    TRect rect( origin, shade->SizeInPixels() );
+
+    bitmapMaskGc->BitBltMasked( origin, shade, rect, mask, ETrue );
+
+    iZoomMaskPartial = aPartial;
+    iZoomMaskRow = aRow;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::CreateBitmaps
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiZoomControl::CreateBitmaps()
+    {
+    TRAPD( err, CreateBitmapsL() );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::CreateBitmapsL
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::CreateBitmapsL()
+    {
+    TBool requiredToCreate = ETrue;
+    TSize requiredSize = SizeOfBitmap();
+    if ( iZoomPartialMask )
+        {
+        requiredToCreate = 
+            ( requiredSize != iZoomPartialMask->Bitmap()->SizeInPixels() );
+        }
+
+    if ( requiredToCreate )
+        {
+        iZoomMaskPartial = KErrNotFound;
+        iZoomMaskRow = KErrNotFound;
+
+        // Delete old ones away.
+        delete iZoomPartialMask;
+        iZoomPartialMask = NULL;
+
+        delete iZoomPartialShade;
+        iZoomPartialShade = NULL;
+
+        delete iZoomPartialShadeMask;
+        iZoomPartialShadeMask = NULL;
+
+        CBitmap* zoomPartialMask = new ( ELeave ) CBitmap;
+        CleanupStack::PushL( zoomPartialMask );
+        zoomPartialMask->ConstructL( requiredSize, EGray256 );
+
+        CBitmap* zoomPartialShade = new ( ELeave ) CBitmap;
+        CleanupStack::PushL( zoomPartialShade );
+        zoomPartialShade->ConstructL( requiredSize, EGray256 );
+
+        CBitmap* zoomPartialShadeMask = new ( ELeave ) CBitmap;
+        CleanupStack::PushL( zoomPartialShadeMask );
+        zoomPartialShadeMask->ConstructL( requiredSize, EGray2 );
+    
+        // Pop zoomPartialShadeMask, zoomPartialShade & zoomPartialMask.
+        CleanupStack::Pop( 3, zoomPartialMask ); 
+        iZoomPartialMask = zoomPartialMask;
+        iZoomPartialShade = zoomPartialShade;
+        iZoomPartialShadeMask = zoomPartialShadeMask;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::SizeOfBitmap
+// -----------------------------------------------------------------------------
+//
+TSize CVtUiZoomControl::SizeOfBitmap() const
+    {
+    // Bitmaps fill the whole zoom area.
+    return iZoomAreaLayout.Rect().Size();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::GetPositionAndRect
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::GetPositionAndRect(
+        TPoint& aPosition,
+        TRect& aSourceRect,
+        const TInt aZoomStep ) const
+    {
+    TAknWindowLineLayout rect;
+    TAknLayoutRect layout;
+    const TRect zoomAreaRect = iZoomAreaLayout.Rect();
+    const TRect& zoomParentRect = iZoomPaneRect;
+
+    VtUiLayout::GetZoomStepLayout( 
+        rect, 
+        aZoomStep ); 
+    layout.LayoutRect( zoomParentRect, rect );
+    aSourceRect = layout.Rect();
+    aPosition = aSourceRect.iTl;
+
+    aSourceRect.iTl -= zoomAreaRect.iTl;
+    aSourceRect.iBr -= zoomAreaRect.iTl;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::CBitmap::CBitmap
+// -----------------------------------------------------------------------------
+//
+CVtUiZoomControl::CBitmap::CBitmap()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::CBitmap::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtUiZoomControl::CBitmap::ConstructL( 
+        const TSize& aSize,
+        const TDisplayMode aMode )
+    {
+    CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap;
+    CleanupStack::PushL( bitmap );
+
+    User::LeaveIfError(
+        bitmap->Create( aSize, aMode ) );
+
+    CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( bitmap );
+    CleanupStack::PushL( device );
+
+    CFbsBitGc* context = NULL;
+    User::LeaveIfError( device->CreateContext( context ) );
+    User::LeaveIfNull( context );
+
+    CleanupStack::Pop( device );
+    CleanupStack::Pop( bitmap );
+
+    iContext = context;
+    iDevice = device;
+    iBitmap = bitmap;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::CBitmap::~CBitmap
+// -----------------------------------------------------------------------------
+//
+CVtUiZoomControl::CBitmap::~CBitmap()
+    {
+    delete iContext;
+    delete iDevice;
+    delete iBitmap;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::CBitmap::Bitmap
+// -----------------------------------------------------------------------------
+//
+inline CFbsBitmap* CVtUiZoomControl::CBitmap::Bitmap() const
+    {
+    return iBitmap;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiZoomControl::CBitmap::Context
+// -----------------------------------------------------------------------------
+//
+inline CFbsBitGc* CVtUiZoomControl::CBitmap::Context() const
+    {
+    return iContext;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/TVtUiCallParameters.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* 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 of the TVtUiCallParameters class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "TVtUiCallParameters.h"
+
+// CONSTANTS
+
+// Enumerates call parameter flags.
+enum TVtUiCallParameterFlags
+    {
+    // Audio status has been updated.
+    EVtUiCallParameterFlagHasAudio = 1,
+    // Audio status equals to ETrue.
+    EVtUiCallParameterFlagAudioEnabled = 2,
+    // Video status has been updated.
+    EVtUiCallParameterFlagHasVideo = 4,
+    // Video status equals to ETrue.
+    EVtUiCallParameterFlagVideoEnabled = 8,
+    // Selected camera has been updated.
+    EVtUiCallParameterFlagHasSelectedCamera = 16,
+    // Primary camera has been selected. Otherwise secondary has been selected.
+    EVtUiCallParameterFlagHasSelectedPrimary = 32,
+    };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TVtUiCallParameters::TVtUiCallParameters
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+TVtUiCallParameters::TVtUiCallParameters()
+    : iFlags( 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiCallParameters::Reset
+// -----------------------------------------------------------------------------
+//
+void TVtUiCallParameters::Reset()
+    {
+    iFlags = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiCallParameters::SetAudioStatus
+// -----------------------------------------------------------------------------
+//
+void TVtUiCallParameters::SetAudioStatus( const TBool aEnabled )
+    {
+    iFlags |= ( EVtUiCallParameterFlagAudioEnabled + 
+                EVtUiCallParameterFlagHasAudio );
+    if ( !aEnabled )
+        {
+        iFlags &= ~EVtUiCallParameterFlagAudioEnabled;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiCallParameters::GetAudioStatus
+// -----------------------------------------------------------------------------
+//
+TInt TVtUiCallParameters::GetAudioStatus( TBool& aEnabled ) const
+    {
+    TInt err = KErrNotFound;
+    if ( iFlags & EVtUiCallParameterFlagHasAudio )
+        {
+        err = KErrNone;
+        aEnabled = ( iFlags & EVtUiCallParameterFlagAudioEnabled );
+        }
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiCallParameters::SetVideoStatus
+// -----------------------------------------------------------------------------
+//
+void TVtUiCallParameters::SetVideoStatus( const TBool aEnabled )
+    {
+    iFlags |= ( EVtUiCallParameterFlagVideoEnabled + 
+                EVtUiCallParameterFlagHasVideo );
+    if ( !aEnabled )
+        {
+        iFlags &= ~EVtUiCallParameterFlagVideoEnabled;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiCallParameters::GetVideoStatus
+// -----------------------------------------------------------------------------
+//
+TInt TVtUiCallParameters::GetVideoStatus( TBool& aEnabled )
+    {
+    TInt err = KErrNotFound;
+    if ( iFlags & EVtUiCallParameterFlagHasVideo )
+        {
+        err = KErrNone;
+        aEnabled = ( iFlags & EVtUiCallParameterFlagVideoEnabled );
+        }
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiCallParameters::SetSelectedCamera
+// -----------------------------------------------------------------------------
+//
+void TVtUiCallParameters::SetSelectedCamera( const TBool aPrimary )
+    {
+    iFlags |= EVtUiCallParameterFlagHasSelectedCamera;
+    
+    if ( aPrimary )
+        {
+        iFlags |= EVtUiCallParameterFlagHasSelectedPrimary;
+        }
+    else
+        {
+        iFlags &= ~EVtUiCallParameterFlagHasSelectedPrimary;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiCallParameters::GetSelectedCamera
+// -----------------------------------------------------------------------------
+//
+TInt TVtUiCallParameters::GetSelectedCamera( TBool& aPrimary )
+    {
+    TInt err = KErrNotFound;
+    if ( iFlags & EVtUiCallParameterFlagHasSelectedCamera )
+        {
+        err = KErrNone;
+        aPrimary = ( iFlags & EVtUiCallParameterFlagHasSelectedPrimary );
+        }
+
+    return err;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/VtUiLayout.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,700 @@
+/*
+* Copyright (c) 2004, 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:  Implementation of the VtUiLayout class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "VtUiLayout.h"
+#include    "VtUiPanic.h"
+#include    <fbs.h>
+#include    <avkon.mbg>
+#include    <videotelui.mbg>
+#include    <aknsconstants.h>
+#include    <aknconsts.h>
+#include    <akniconutils.h>
+#include    <aknutils.h>
+
+#include    <aknlayout.cdl.h>
+#include    <applayout.cdl.h>
+#include    <aknlayoutscalable_apps.cdl.h>
+#include    <aknlayoutscalable_avkon.cdl.h>
+#include    <layoutmetadata.cdl.h>
+
+
+// DATA TYPES
+
+// Enumerates files in which there can be bitmaps.
+enum TVtUiBitmapFiles
+    {
+    // Video Telephone bitmap file.
+    EVtUiVideoBitmapFile,
+    // AVKON bitmap file.
+    EVtUiAvkonBitmapFile
+    };
+
+// Video Telephone application bitmaps
+_LIT( KVtUiVideoBitmapFileName,
+    "z:\\resource\\apps\\videotelui.mbm" );
+// Minimum step for zoom.
+const TInt KVtUiZoomMinStep = 1;
+
+// Maximum step for zoom.
+const TInt KVtUiZoomMaxStep = 11;
+
+// ============================ LOCAL FUNCTIONS ===============================
+
+inline TAknWindowComponentLayout DoCompose( TAknWindowComponentLayout aLine1,
+    TAknWindowComponentLayout aLine2 )
+    {
+    return TAknWindowComponentLayout::Compose( aLine1, aLine2 );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetApplicationParentRect
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetApplicationParentRect(
+        TRect& aRect )
+    {
+    // Calculate screen rectangle.
+    TSize screenSize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels();
+    TRect screenRect( screenSize );
+
+    // Calculate application window.
+    TAknLayoutRect appRect;
+    appRect.LayoutRect(
+        screenRect,
+        AknLayout::application_window( screenRect ) );
+    aRect = appRect.Rect();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetMainPaneLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetMainPaneLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    TRect parent;
+    GetApplicationParentRect( parent );
+    // Calculate main pane layout.
+    // First 1 = normal status pane, second 1 = control pane.
+    aLayout = AknLayout::main_pane( parent, 0, 1, 1 );
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetFirstWindowBackgroundLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetFirstWindowBackgroundLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    //aLayout = AppLayout::Uplink_video_image__large__Line_1();
+    TInt main_pane_variety( 0 );
+    TInt vid_upl_variety( 14 );
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        main_pane_variety = 4;
+        vid_upl_variety = 0;
+        }
+
+    TAknWindowComponentLayout layout1 =
+        AknLayoutScalable_Apps::main_pane( main_pane_variety );
+    TAknWindowComponentLayout layout2 =
+        AknLayoutScalable_Apps::main_video_tele_pane();
+    TAknWindowComponentLayout layout3 =
+        AknLayoutScalable_Apps::
+            call_video_uplink_pane_cp1( vid_upl_variety );
+    TAknWindowComponentLayout layout4 =
+        AknLayoutScalable_Apps::call_video_uplink_pane_g1();
+    aLayout =
+        DoCompose(
+            DoCompose( layout1, layout2 ),
+                DoCompose( layout3, layout4 ) ).LayoutLine();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetFirstWindowStreamLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetFirstWindowStreamLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    TInt main_pane_variety( 0 );
+    TInt vid_upl_variety( 14 );
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        main_pane_variety = 4;
+        vid_upl_variety = 0;
+        }
+
+    TAknWindowComponentLayout layout1 =
+        AknLayoutScalable_Apps::main_pane( main_pane_variety );
+    TAknWindowComponentLayout layout2 =
+        AknLayoutScalable_Apps::main_video_tele_pane();
+    TAknWindowComponentLayout layout3 =
+        AknLayoutScalable_Apps::
+            call_video_uplink_pane_cp1( vid_upl_variety );
+    TAknWindowComponentLayout layout4 =
+        AknLayoutScalable_Apps::video_uplink_pane();
+    aLayout =
+        DoCompose(
+            DoCompose( layout1, layout2 ),
+                DoCompose( layout3, layout4 ) ).LayoutLine();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetFirstWindowStreamDisabledIconLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetFirstWindowStreamDisabledIconLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    //aLayout = AppLayout::Uplink_video_image__large__Line_3();
+    TInt main_pane_variety( 0 );
+    TInt vid_upl_variety( 14 );
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        main_pane_variety = 4;
+        vid_upl_variety = 0;
+        }
+
+    TAknWindowComponentLayout layout1 =
+        AknLayoutScalable_Apps::main_pane( main_pane_variety );
+    TAknWindowComponentLayout layout2 =
+        AknLayoutScalable_Apps::main_video_tele_pane();
+    TAknWindowComponentLayout layout3 =
+        AknLayoutScalable_Apps::
+            call_video_uplink_pane_cp1( vid_upl_variety );
+    TAknWindowComponentLayout layout4 =
+        AknLayoutScalable_Apps::call_video_uplink_pane_g2();
+    aLayout =
+        DoCompose(
+            DoCompose( layout1, layout2 ),
+                DoCompose( layout3, layout4 ) ).LayoutLine();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetSecondWindowBackgroundLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetSecondWindowBackgroundLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    aLayout = AppLayout::Downlink_video_image_Line_1();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetSecondWindowStreamLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetSecondWindowStreamLayout(
+    TAknWindowLineLayout& aLayout, TBool aIsToolbar, TBool aIsSubQCIF )
+    {
+    if( aIsSubQCIF )
+        {
+        aLayout = AppLayout::video_down_subqcif_pane();
+        }
+    else
+        {
+        if ( aIsToolbar )
+            {
+            // non touch
+            TInt varietyPr = 8; // portrait
+	        TInt varietyLs = 10; // landscape
+            if ( AknLayoutUtils::PenEnabled() )
+                {
+                varietyPr = 11; // portrait
+	            varietyLs = 12; // landscape
+                }
+
+            TInt varietyIndex = Layout_Meta_Data::IsLandscapeOrientation()
+	           ? varietyLs : varietyPr ;
+            TAknWindowComponentLayout layout1 = AknLayoutScalable_Apps::
+                main_video_tele_pane();
+            TAknWindowComponentLayout layout2 = AknLayoutScalable_Apps::
+                video_down_crop_pane( varietyIndex );
+            aLayout = TAknWindowComponentLayout::Compose( layout1, layout2 ).
+                LayoutLine();
+
+            }
+        else
+            {
+            aLayout = AppLayout::downlink_stream();
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetSecondWindowStreamWholeLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetSecondWindowStreamWholeLayout(
+    TAknWindowLineLayout& aLayout, TBool aIsToolbar, TBool aIsSubQCIF )
+    {
+    if( aIsSubQCIF )
+        {
+        aLayout = AppLayout::video_down_subqcif_pane();
+        }
+    else
+        {
+        if ( aIsToolbar )
+            {
+            // non touch
+            TInt varietyPr = 5; // portrait
+	        TInt varietyLs = 7; // landscape
+            if ( AknLayoutUtils::PenEnabled() )
+                {
+                varietyPr = 8; // portrait
+	            varietyLs = 1; // landscape
+                }
+
+            TInt varietyIndex = Layout_Meta_Data::IsLandscapeOrientation()
+	           ? varietyLs : varietyPr;
+            TAknWindowComponentLayout layout1 = AknLayoutScalable_Apps::
+                main_video_tele_pane();
+            TAknWindowComponentLayout layout2 = AknLayoutScalable_Apps::
+                video_down_pane( varietyIndex );
+            aLayout = TAknWindowComponentLayout::Compose( layout1, layout2 )
+                .LayoutLine();
+            }
+        else
+            {
+            aLayout = AppLayout::downlink_stream_area();
+            }
+        }
+    }
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetSecondWindowDisabledIconLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetSecondWindowDisabledIconLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    aLayout = AppLayout::Downlink_video_image_Line_3();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetSecondWindowWaitingTextLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetSecondWindowWaitingTextLayout(
+        TAknTextLineLayout& aLayout,
+        const TBool aFirstLine )
+    {
+    TBool layoutFound = EFalse;
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        layoutFound = ETrue;
+
+        TAknWindowComponentLayout layout1 =
+            AknLayoutScalable_Apps::main_video_tele_pane();
+
+        TAknTextComponentLayout layout2 =
+            aFirstLine ?
+                AknLayoutScalable_Apps::call_video_pane_t1() :
+                AknLayoutScalable_Apps::call_video_pane_t2();
+
+        aLayout =
+            TAknWindowComponentLayout::ComposeText(
+                layout1, layout2 ).LayoutLine();
+        }
+
+    if ( !layoutFound )
+        {
+        const TInt line( ( aFirstLine ) ? 0 : 1 );
+        TAknWindowComponentLayout l1 = AknLayoutScalable_Apps::
+            main_video_tele_pane();
+        TAknTextComponentLayout l2;
+        if ( !line )
+            {
+            l2 = AknLayoutScalable_Apps::call_video_pane_t1( 1 );
+            }
+        else
+            {
+            l2 = AknLayoutScalable_Apps::call_video_pane_t2( 1 );
+            }
+        aLayout = TAknWindowComponentLayout::ComposeText( l1, l2 );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetNumberEntryAreaLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetNumberEntryAreaLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0;
+
+    TAknWindowComponentLayout layout1 =
+        AknLayoutScalable_Apps::main_call_pane();
+    TAknWindowComponentLayout layout2 =
+        AknLayoutScalable_Apps::popup_number_entry_window( variety );
+
+    aLayout =
+        TAknWindowComponentLayout::Compose( layout1, layout2 ).LayoutLine();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetAudioRoutingIconLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetAudioRoutingIconLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    aLayout = AppLayout::Navipane_elements_and_descendant_panes_Line_1();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetCallDurationTextLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetCallDurationTextLayout(
+        TAknTextLineLayout& aLayout )
+    {
+    aLayout = AppLayout::Navipanetexts_Line_1();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetMutedTextLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetMutedTextLayout(
+        TAknTextLineLayout& aLayout )
+    {
+    aLayout = AppLayout::Navipanetexts_Line_2();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetZoomPaneLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetZoomPaneLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    aLayout = AppLayout::zooming_pane();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetZoomDirLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetZoomDirLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    aLayout = AppLayout::Zooming_pane_elements_Line_1();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetZoomAreaLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetZoomAreaLayout(
+        TAknWindowLineLayout& aLayout )
+    {
+    aLayout = AppLayout::Zooming_pane_elements_Line_2();
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::GetZoomStepLayout
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::GetZoomStepLayout(
+        TAknWindowLineLayout& aLayout,
+        TInt aZoomStep )
+    {
+    aZoomStep = Max( Min( aZoomStep, KVtUiZoomMaxStep ), KVtUiZoomMinStep );
+    aZoomStep--; // 1 .. 11 is mapped to 0 .. 10.
+
+    // Function pointer table would be more efficient, but AppLayout methods
+    // are inline.
+
+    switch ( aZoomStep )
+        {
+        case 0:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_1();
+            break;
+
+        case 1:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_2();
+            break;
+
+        case 2:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_3();
+            break;
+
+        case 3:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_4();
+            break;
+
+        case 4:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_5();
+            break;
+
+        case 5:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_6();
+            break;
+
+        case 6:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_7();
+            break;
+
+        case 7:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_8();
+            break;
+
+        case 8:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_9();
+            break;
+
+        case 9:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_10();
+            break;
+
+        case 10:
+        default:
+            aLayout = AppLayout::Zooming_steps_sizes_Line_11();
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::MapBitmapToSkinId
+// -----------------------------------------------------------------------------
+//
+TAknsItemID VtUiLayout::MapBitmapToSkinId( TVtUiBitmapId aId )
+    {
+    TAknsItemID skinId = KAknsIIDNone;
+
+    switch ( aId )
+        {
+        case EVtUiBitmap_qgn_graf_call_video_out_bg:
+            skinId = KAknsIIDQgnGrafCallVideoOutBg;
+            break;
+
+        case EVtUiBitmap_qgn_indi_call_video_blind_in:
+            skinId = KAknsIIDQgnIndiCallVideoBlindIn;
+            break;
+
+        case EVtUiBitmap_qgn_indi_call_video_blind_out:
+            skinId = KAknsIIDQgnIndiCallVideoBlindOut;
+            break;
+
+        case EVtUiBitmap_qgn_indi_call_video_blind_in_mask_icon:
+            skinId = KAknsIIDQgnIndiCallVideoBlindInMaskIcon;
+            break;
+
+        case EVtUiBitmap_qgn_indi_call_video_blind_out_mask_icon:
+            skinId = KAknsIIDQgnIndiCallVideoBlindOutMaskIcon;
+            break;
+
+        case EVtUiBitmap_qgn_indi_earpiece:
+            skinId = KAknsIIDQgnIndiEarpiece;
+            break;
+
+        case EVtUiBitmap_qgn_indi_speaker:
+            skinId = KAknsIIDQgnIndiSpeaker;
+            break;
+
+        case EVtUiBitmap_qgn_indi_zoom_dir:
+            skinId = KAknsIIDQgnIndiZoomDir;
+            break;
+
+        case EVtUiBitmap_qgn_graf_zoom_area:
+            skinId = KAknsIIDQgnGrafZoomArea;
+            break;
+
+        case EVtUiBitmap_qgn_indi_zoom_min:
+            skinId = KAknsIIDQgnIndiZoomMin;
+            break;
+
+        case EVtUiBitmap_qgn_indi_zoom_max:
+            skinId = KAknsIIDQgnIndiZoomMax;
+            break;
+
+        case EVtUiBitmap_qgn_prop_sub_current:
+        case EVtUiBitmap_qgn_prop_sub_current_mask:
+            skinId = KAknsIIDQgnPropSubCurrent;
+            break;
+
+        default:
+            // Default value is OK.
+            break;
+        }
+
+    return skinId;
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::MapBitmapToColorId
+// -----------------------------------------------------------------------------
+//
+TBool VtUiLayout::MapBitmapToColorId(
+        TVtUiBitmapId aId,
+        TAknsItemID& aColorId,
+        TInt& aColorIndex )
+    {
+    TBool result = EFalse;
+
+    aColorId = KAknsIIDNone;
+    aColorIndex = KErrNotFound;
+
+    switch ( aId )
+        {
+        case EVtUiBitmap_qgn_indi_earpiece:
+        case EVtUiBitmap_qgn_indi_earpiece_mask:
+        case EVtUiBitmap_qgn_indi_speaker:
+        case EVtUiBitmap_qgn_indi_speaker_mask:
+        case EVtUiBitmap_qgn_indi_zoom_dir:
+        case EVtUiBitmap_qgn_indi_zoom_dir_mask:
+            result = ETrue;
+            aColorId = KAknsIIDQsnIconColors;
+            aColorIndex = EAknsCIQsnIconColorsCG7;
+            break;
+
+        default:
+            // Default value is OK.
+            break;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::Resolve
+// -----------------------------------------------------------------------------
+//
+void VtUiLayout::Resolve(
+        TVtUiBitmapId aId,
+        TFileName& aFileName,
+        TInt& aIndex )
+    {
+    TInt index = KErrNotFound;
+    TVtUiBitmapFiles file = EVtUiVideoBitmapFile;
+
+    switch ( aId )
+        {
+        case EVtUiBitmap_qgn_graf_call_video_out_bg:
+            index = EMbmVideoteluiQgn_graf_call_video_out_bg;
+            break;
+
+        case EVtUiBitmap_qgn_graf_call_video_out_bg_mask:
+            index = EMbmVideoteluiQgn_graf_call_video_out_bg_mask;
+            break;
+
+        case EVtUiBitmap_qgn_indi_call_video_blind_in:
+            index = EMbmVideoteluiQgn_indi_call_video_blind_in;
+            break;
+
+        case EVtUiBitmap_qgn_indi_call_video_blind_out:
+            index = EMbmVideoteluiQgn_indi_call_video_blind_out;
+            break;
+
+        case EVtUiBitmap_qgn_indi_earpiece:
+            file = EVtUiAvkonBitmapFile;
+            index = EMbmAvkonQgn_indi_earpiece;
+            break;
+
+        case EVtUiBitmap_qgn_indi_earpiece_mask:
+            file = EVtUiAvkonBitmapFile;
+            index = EMbmAvkonQgn_indi_earpiece_mask;
+            break;
+
+        case EVtUiBitmap_qgn_indi_speaker:
+            file = EVtUiAvkonBitmapFile;
+            index = EMbmAvkonQgn_indi_speaker;
+            break;
+
+        case EVtUiBitmap_qgn_indi_speaker_mask:
+            file = EVtUiAvkonBitmapFile;
+            index = EMbmAvkonQgn_indi_speaker_mask;
+            break;
+
+        case EVtUiBitmap_qgn_graf_zoom_area:
+            index = EMbmVideoteluiQgn_graf_zoom_area;
+            break;
+
+        case EVtUiBitmap_qgn_indi_zoom_dir:
+            index = EMbmVideoteluiQgn_indi_zoom_dir;
+            break;
+
+        case EVtUiBitmap_qgn_indi_zoom_dir_mask:
+            index = EMbmVideoteluiQgn_indi_zoom_dir_mask;
+            break;
+
+        case EVtUiBitmap_qgn_indi_zoom_min:
+            index = EMbmVideoteluiQgn_indi_zoom_min;
+            break;
+
+        case EVtUiBitmap_qgn_indi_zoom_max:
+            index = EMbmVideoteluiQgn_indi_zoom_max;
+            break;
+
+        case EVtUiBitmap_qgn_indi_call_video_blind_in_mask_icon:
+            index = EMbmVideoteluiQgn_indi_call_video_blind_in_mask_icon;
+            break;
+
+        case EVtUiBitmap_qgn_indi_call_video_blind_out_mask_icon:
+            index = EMbmVideoteluiQgn_indi_call_video_blind_out_mask_icon;
+            break;
+
+        case EVtUiBitmap_qgn_prop_sub_current:
+            file = EVtUiAvkonBitmapFile;
+            index = EMbmAvkonQgn_prop_sub_current;
+            break;
+
+        case EVtUiBitmap_qgn_prop_sub_current_mask:
+            file = EVtUiAvkonBitmapFile;
+            index = EMbmAvkonQgn_prop_sub_current_mask;
+            break;
+
+        default:
+            VtUiPanic::Panic( EVtUiPanicInvalidBitmapId );
+            break;
+        }
+
+    aIndex = index;
+    switch ( file )
+        {
+        case EVtUiVideoBitmapFile:
+            aFileName = KVtUiVideoBitmapFileName;
+            break;
+
+        case EVtUiAvkonBitmapFile:
+            aFileName = AknIconUtils::AvkonIconFileName();
+            break;
+
+        default:
+            VtUiPanic::Panic( EVtUiPanicInvalidBitmapFile );
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiLayout::IsLandscapeOrientation
+// -----------------------------------------------------------------------------
+//
+TBool VtUiLayout::IsLandscapeOrientation()
+    {
+    return Layout_Meta_Data::IsLandscapeOrientation();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/VtUiPanic.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* 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 of the VtUiPanic class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "VtUiPanic.h"
+
+// CONSTANTS
+
+// Panic category for Video Telephone application.
+_LIT( KVtUiPanicCategory, "Videotelui" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// VtUiPanic::Panic
+// -----------------------------------------------------------------------------
+//
+void VtUiPanic::Panic( TVtUiPanicReason aReason )
+    {
+    User::Panic( KVtUiPanicCategory, aReason );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/VtUiUtility.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,336 @@
+/*
+* 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 of the VtUiUtility class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "VtUiUtility.h"
+#include    "VtUiPanic.h"
+#include    <featmgr.h>
+#include    <mvtengmedia.h>
+#include    <cvtlogger.h>
+#include    <aknutils.h>
+#include 	"tVtuifeaturevariation.h"
+
+// Characters to open number entry.
+_LIT( KVtUiDTMFCharacters, "0123456789*#" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::GetAudioRoutingAvailability
+// -----------------------------------------------------------------------------
+//
+void VtUiUtility::GetAudioRoutingAvailability(
+        MVtEngAudio& aAudio,
+        TInt& aAvailable )
+    {
+    aAvailable = 0;
+    TVtUiBTVariation btvariation;
+    const TBool bluetoothAudioSupported =
+        btvariation.IsBTSupported();
+
+    MVtEngAudio::TAudioRoutingState routingState;
+    if ( aAudio.GetRoutingState( routingState ) == KErrNone )
+        {
+        // Deactivate BT handsfree.
+        if ( bluetoothAudioSupported &&
+             IsAudioRoutingAvailable(
+                aAudio,
+                routingState,
+                MVtEngAudio::EAudioBT,
+                MVtEngAudio::EAudioHandset ) )
+            {
+            aAvailable |= EDeactivateBtHandsfree;
+            }
+
+        // Activate BT handsfree.
+        if ( bluetoothAudioSupported &&
+             ( IsAudioRoutingAvailable(
+                 aAudio,
+                 routingState,
+                 MVtEngAudio::EAudioHandset,
+                 MVtEngAudio::EAudioBT ) ||
+               IsAudioRoutingAvailable(
+                aAudio,
+                routingState,
+                MVtEngAudio::EAudioLoudspeaker,
+                MVtEngAudio::EAudioBT ) ) )
+            {
+            aAvailable |= EActivateBtHandsfree;
+            }
+
+        // Deactivate loudspeaker
+        if ( IsAudioRoutingAvailable(
+                aAudio,
+                routingState,
+                MVtEngAudio::EAudioLoudspeaker,
+                MVtEngAudio::EAudioHandset ) )
+            {
+            aAvailable |= EDeactivateLoudspeaker;
+            }
+
+        // Activate loudspeaker
+        if ( IsAudioRoutingAvailable(
+                aAudio,
+                routingState,
+                MVtEngAudio::EAudioHandset,
+                MVtEngAudio::EAudioLoudspeaker ) ||
+             ( bluetoothAudioSupported && 
+               IsAudioRoutingAvailable( 
+                   aAudio,
+                   routingState, 
+                   MVtEngAudio::EAudioBT, 
+                   MVtEngAudio::EAudioLoudspeaker ) ) )
+            {
+            aAvailable |= EActivateLoudspeaker;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::GetOutgoingMediaState
+// -----------------------------------------------------------------------------
+//
+void VtUiUtility::GetOutgoingMediaState(
+        MVtEngMedia& aMedia,
+        TInt& aAvailable )
+    {
+    TInt outgoingMediaState;
+    const TInt err =
+        aMedia.GetMediaState(
+            MVtEngMedia::EMediaOutgoing,
+            outgoingMediaState );
+    if ( err == KErrNone )
+        {
+        // If source is still image, then video sending is off.
+        MVtEngMedia::TMediaSource source;
+        if ( aMedia.GetSource( source ) == KErrNone )
+            {
+            if ( source == MVtEngMedia::EMediaStillImage )
+                {
+                outgoingMediaState &= ~MVtEngMedia::EMediaVideo;
+                }
+            }
+        TBool freezeSupported;
+        if( aMedia.GetFreezeSupported( freezeSupported ) == KErrNone )
+            {
+            TBool isFrozen;
+            if( freezeSupported && aMedia.GetFreezeState( isFrozen ) == KErrNone )
+                {
+                if( isFrozen )
+                    {
+                    outgoingMediaState &= ~MVtEngMedia::EMediaVideo;
+                    }
+                }
+            }
+        }
+    else
+        {
+        outgoingMediaState =
+            ( MVtEngMedia::EMediaAudio | MVtEngMedia::EMediaVideo );
+        }
+    aAvailable = outgoingMediaState;
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::GetIncomingMediaState
+// -----------------------------------------------------------------------------
+//
+void VtUiUtility::GetIncomingMediaState(
+        MVtEngMedia& aMedia,
+        TInt& aAvailable )
+    {
+    TInt mediaState;
+    const TInt err =
+        aMedia.GetMediaState(
+            MVtEngMedia::EMediaIncoming,
+            mediaState );
+    if ( err != KErrNone )
+        {
+        mediaState =
+            ( MVtEngMedia::EMediaAudio | MVtEngMedia::EMediaVideo );
+        }
+
+    aAvailable = mediaState;
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::HasStillImage
+// -----------------------------------------------------------------------------
+//
+TBool VtUiUtility::HasStillImage(
+        MVtEngMedia& aMedia )
+    {
+    TInt caps;
+    const TInt capsErr = aMedia.GetSourcesCaps( caps );
+    return ( capsErr == KErrNone ) &&
+           ( caps & MVtEngMedia::ESourceCapsStillImage );
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::GetFreezeState
+// -----------------------------------------------------------------------------
+//
+TBool VtUiUtility::GetFreezeState(
+        MVtEngMedia& aMedia )
+    {
+    TBool isFrozen;
+    const TInt err = aMedia.GetFreezeState( isFrozen );
+    if ( err == KErrNone )
+        {
+        return isFrozen;
+        }
+    else //provider was not ready
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::IsFreezeSupported
+// -----------------------------------------------------------------------------
+//
+TBool VtUiUtility::IsFreezeSupported(
+        MVtEngMedia& aMedia )
+    {
+    TBool isFreezeSupported;
+    const TInt err = aMedia.GetFreezeSupported( isFreezeSupported );
+    if ( err == KErrNone )
+        {
+        return isFreezeSupported;
+        }
+    else //provider was not ready
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::GetVideoQuality
+// -----------------------------------------------------------------------------
+//
+void VtUiUtility::GetVideoQuality(
+        	MVtEngMedia& aMedia,
+        	MVtEngMedia::TVideoQuality& aVideoQuality )
+    {
+    aMedia.GetVideoQuality( aVideoQuality );
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::GetObjectSharingState
+// -----------------------------------------------------------------------------
+//
+void VtUiUtility::GetObjectSharingState(
+    MVtEngMedia& aMedia,
+    MVtEngMedia::TShareObjectState& aShareObjectState )
+    {
+    aMedia.GetObjectSharingState( aShareObjectState );
+    }
+
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::IsZoomAllowed
+// -----------------------------------------------------------------------------
+//
+TBool VtUiUtility::IsZoomAllowed(
+        MVtEngMedia& aMedia )
+    {
+    TBool result = EFalse;
+
+    TInt currentStep;
+    if ( aMedia.GetCurrentZoomStep( currentStep ) == KErrNone )
+        {
+        TInt max;
+        if ( aMedia.GetMaxZoomStep( max ) == KErrNone )
+            {
+            // Zooming is allowed if maximum zoom step is greater than
+            // zero and camera is in use (and not still image / none).
+            TInt avail;
+            GetOutgoingMediaState( aMedia, avail );
+
+            result = ( max > 0 ) && ( avail & MVtEngMedia::EMediaVideo );
+            }
+        }
+
+    __VTPRINT2( DEBUG_GEN, "Ui.AllowZoom.%d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::HasCameras
+// -----------------------------------------------------------------------------
+//
+TBool VtUiUtility::HasCameras( MVtEngMedia& aMedia )
+    {
+    TInt sourceCaps;
+    if ( aMedia.GetSourcesCaps( sourceCaps ) != KErrNone )
+        {
+        sourceCaps = 0;
+        }
+    return ( sourceCaps & MVtEngMedia::ESourceCapsPrimaryCamera ) ||
+           ( sourceCaps & MVtEngMedia::ESourceCapsSecondaryCamera );
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::IsAudioRoutingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool VtUiUtility::IsAudioRoutingAvailable(
+        MVtEngAudio& aAudio,
+        const MVtEngAudio::TAudioRoutingState aCurrent,
+        const MVtEngAudio::TAudioRoutingState aSource,
+        const MVtEngAudio::TAudioRoutingState aTarget )
+    {
+    TBool result = EFalse;
+    if ( aCurrent == aSource )
+        {
+        TBool available = EFalse;
+        TInt err = aAudio.GetRoutingAvailability( aTarget, available );
+
+        result = ( ( err == KErrNone ) && ( available ) );
+        }
+
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::IsDTMFEvent
+// -----------------------------------------------------------------------------
+//
+TBool VtUiUtility::IsDTMFEvent( const TKeyEvent& aKeyEvent, TChar& aDtmfTone )
+    {
+    TBuf<1> buffer; // one character
+    buffer.Append( aKeyEvent.iCode );
+    AknTextUtils::ConvertDigitsTo( buffer, EDigitTypeWestern );
+    aDtmfTone = buffer[ 0 ];
+    return
+        ( KVtUiDTMFCharacters().Locate( buffer[ 0 ] ) != KErrNotFound );
+    }
+
+// -----------------------------------------------------------------------------
+// VtUiUtility::IsDTMFCharacter
+// -----------------------------------------------------------------------------
+//
+TBool VtUiUtility::IsDTMFCharacter( const TChar aChar )
+    {
+    return
+        ( KVtUiDTMFCharacters().Locate( aChar ) != KErrNotFound );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuicmdbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* 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:  UI command bases class implementation.
+*
+*/
+
+
+#include "cvtuicmdbase.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// FindCVtUiCmdBaseById
+// ---------------------------------------------------------------------------
+//
+TInt FindCVtUiCmdBaseById( const CVtUiCmdBase& aC1, const CVtUiCmdBase& aC2 )
+    {
+    return ( aC1.CommandId() - aC2.CommandId() );
+    }
+
+// ---------------------------------------------------------------------------
+// FindCVtUiCmdBaseByKey
+// ---------------------------------------------------------------------------
+//
+TInt FindCVtUiCmdBaseByKey( const TInt* aKey, const CVtUiCmdBase& aC )
+    {
+    return ( *aKey - aC.CommandId() );
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdBase::CommandId
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiCmdBase::CommandId() const
+    {
+    return iCommandId;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdBase::LinearOrder
+// ---------------------------------------------------------------------------
+//
+TLinearOrder< CVtUiCmdBase > CVtUiCmdBase::LinearOrder()
+    {
+    return TLinearOrder< CVtUiCmdBase >( ::FindCVtUiCmdBaseById );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdBase::LinearOrder
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdBase::TKeyOrder CVtUiCmdBase::KeyOrder()
+    {
+    return ::FindCVtUiCmdBaseByKey;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdBase::CVtUiCmdBase
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdBase::CVtUiCmdBase( TInt aCommandId ) : iCommandId( aCommandId )
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuicmdcontext.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,209 @@
+/*
+* 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:  Command context base class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicmdcontext.h"
+#include "cvtuicmdvalidatorbase.h"
+#include "cvtuicmdvalidationactionbase.h"
+#include "mvtuicommandmanager.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Compare routine used by InsertInOrder() and FindInOrder() to sort validator
+// instances by priority.
+// ---------------------------------------------------------------------------
+//
+TInt ValidatorPriCmpFunc( const CVtUiCmdValidatorBase& aV1,
+    const CVtUiCmdValidatorBase& aV2 )
+    {
+    return aV1.Priority() - aV2.Priority();
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::~CVtUiCmdContext
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdContext::~CVtUiCmdContext()
+    {
+    __VTPRINTENTER( "CmdCtx.~" )
+    iValidators.Reset();
+    __VTPRINTEXIT( "CmdCtx.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::ReferencePriority
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiCmdContext::ReferencePriority() const
+    {
+    __VTPRINTENTER( "CmdCtx.ReferencePriority" )
+    __VTPRINTEXITR( "CmdCtx.ReferencePriority %d", iReferencePriority )
+    return iReferencePriority;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::ContextType
+// ---------------------------------------------------------------------------
+//
+TVtUiCmdContextType CVtUiCmdContext::ContextType() const
+    {
+    __VTPRINTENTER( "CmdCtx.ContextType" )
+    __VTPRINTEXITR( "CmdCtx.ContextType %d", iContextType )
+    return iContextType;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::AddValidator
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiCmdContext::AddValidator( CVtUiCmdValidatorBase& aValidator )
+    {
+    __VTPRINTENTER( "CmdCtx.AddValidator" )
+    TInt result( KErrNone );
+    if ( !aValidator.ValidatesContext( iContextType ) )
+        {
+        result = KErrNotSupported;
+        }
+    else
+        {
+        result = iValidators.InsertInOrderAllowRepeats( &aValidator,
+            TLinearOrder< CVtUiCmdValidatorBase >( ::ValidatorPriCmpFunc ) );
+        }
+    __VTPRINTEXITR( "CmdCtx.AddValidator %d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::RemoveValidator
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdContext::RemoveValidator( const CVtUiCmdValidatorBase& aValidator )
+    {
+    __VTPRINTENTER( "CmdCtx.RemoveValidator" )
+    TInt idx( iValidators.FindInOrder( &aValidator,
+        TLinearOrder< CVtUiCmdValidatorBase >( ::ValidatorPriCmpFunc ) ) );
+
+    if ( idx != KErrNotFound )
+        {
+        iValidators.Remove( idx );
+        }
+    __VTPRINTEXIT( "CmdCtx.RemoveValidator" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::CVtUiCmdContext
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdContext::CVtUiCmdContext( MVtUiCommandManager& aCommandManager,
+    TVtUiCmdContextType aCtxType, TInt aReferencePriority )
+    : iCommandManager( aCommandManager ),
+      iReferencePriority( aReferencePriority ), iContextType( aCtxType )
+    {
+    __VTPRINTENTER( "CmdCtx.ctor" )
+    __VTPRINTEXIT( "CmdCtx.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::ValidateMenuItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdContext::ValidateMenuItemsL(
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdCtx.ValidateMenuItemsL" )
+    __VTPRINT2( DEBUG_GEN, "    count = %d", iValidators.Count() )
+    for ( TInt i = iValidators.Count() - 1; i >= 0; i-- )
+        {
+        iValidators[ i ]->ValidateMenuItemsL( aAction, iReferencePriority );
+        }
+    __VTPRINTEXIT( "CmdCtx.ValidateMenuItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::ValidateSoftkeyItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdContext::ValidateSoftkeyItemsL(
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdCtx.ValidateSoftkeyItemsL" )
+    __VTPRINT2( DEBUG_GEN, "    count = %d", iValidators.Count() )
+    for ( TInt i = iValidators.Count() - 1; i >= 0; i-- )
+        {
+        iValidators[ i ]->ValidateSoftkeyItemsL( aAction, iReferencePriority );
+        }
+    __VTPRINTEXIT( "CmdCtx.ValidateSoftkeyItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::ValidateToolbarItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdContext::ValidateToolbarItemsL(
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdCtx.ValidateToolbarItemsL" )
+    __VTPRINT2( DEBUG_GEN, "    count = %d", iValidators.Count() )
+    for ( TInt i = iValidators.Count() - 1; i >= 0; i-- )
+        {
+        iValidators[ i ]->ValidateToolbarItemsL( aAction, iReferencePriority );
+        }
+    __VTPRINTEXIT( "CmdCtx.ValidateToolbarItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::CustomValidationL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdContext::CustomValidationL(
+    CVtUiCmdCustomValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdCtx.CustomValidationL" )
+    __VTPRINT2( DEBUG_GEN, "    count = %d", iValidators.Count() )
+    for ( TInt i = iValidators.Count() - 1; i >= 0; i-- )
+        {
+        iValidators[ i ]->CustomValidationL( aAction, iReferencePriority );
+        }
+    __VTPRINTEXIT( "CmdCtx.CustomValidationL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::RegisterCommandContextL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdContext::RegisterCommandContextL()
+    {
+    __VTPRINTENTER( "CmdCtx.RegisterCommandContextL" )
+    User::LeaveIfError( iCommandManager.RegisterCommandContext( *this ) );
+    __VTPRINTEXIT( "CmdCtx.RegisterCommandContextL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdContext::UnregisterCommandContext
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdContext::UnregisterCommandContext()
+    {
+    __VTPRINTENTER( "CmdCtx.UnregisterCommandContext" )
+    iCommandManager.UnregisterCommandContext( *this );
+    __VTPRINTEXIT( "CmdCtx.UnregisterCommandContext" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuicmdcustomvalidationactionbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* 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:  Custom command validation action base class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicmdcustomvalidationactionbase.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdCustomValidationActionBase::CustomTypeId
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdCustomValidationActionBase::TCustomTypeId
+CVtUiCmdCustomValidationActionBase::CustomTypeId() const
+    {
+    return iCustomTypeId;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdCustomValidationActionBase::BeginProcess
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdCustomValidationActionBase::CVtUiCmdCustomValidationActionBase(
+    TCustomTypeId aCustomTypeId )
+    : iCustomTypeId( aCustomTypeId )
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuicmdstatecheckaction.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* 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:  Menu item dimmer action class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicmdstatecheckaction.h"
+#include "tvtuicmdvalidatorcallback.h"
+#include "tvtuicmdcontexttype.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdStateCheckAction::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdStateCheckAction* CVtUiCmdStateCheckAction::NewL()
+    {
+    __VTPRINTENTER( "CmdStChkAct.NewL" )
+    CVtUiCmdStateCheckAction* self =
+        new ( ELeave ) CVtUiCmdStateCheckAction();
+    __VTPRINTEXIT( "CmdStChkAct.NewL" )
+    return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdStateCheckAction::SetCommand
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdStateCheckAction::SetCommand( TInt aCommandId )
+    {
+    __VTPRINTENTER( "CmdStChkAct.SetCommand" )
+    iCommandId = aCommandId;
+    iIsCommandAllowed = EFalse;
+    __VTPRINTEXIT( "CmdStChkAct.SetCommand" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdStateCheckAction::IsCommandAllowed
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiCmdStateCheckAction::IsCommandAllowed() const
+    {
+    return iIsCommandAllowed;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdStateCheckAction::ProcessL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdStateCheckAction::ProcessL(
+    const MVtUiCmdValidatorCallBack& aCallBack )
+    {
+    __VTPRINTENTER( "CmdStChkAct.ProcessL" )
+	if ( !IsCommandHandled( iCommandId ) )
+	    {
+        if ( aCallBack.Call( iCommandId ) )
+            {
+    	    CommandHandledL( iCommandId );
+    	    iIsCommandAllowed = ETrue;
+            }
+	    }
+    __VTPRINTEXIT( "CmdStChkAct.ProcessL" )
+	}
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdStateCheckAction::CVtUiCmdStateCheckAction
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdStateCheckAction::CVtUiCmdStateCheckAction()
+    : CVtUiCmdCustomValidationActionBase( EVtUiCmdContextTypeExecution )
+    {
+    __VTPRINTENTER( "CmdStChkAct.ctor" )
+    __VTPRINTEXIT( "CmdStChkAct.ctor" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuicmdvalidationactionbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* 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:  Command validation action base class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicmdvalidationactionbase.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdValidationActionBase::~CVtUiCmdValidationActionBase
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdValidationActionBase::~CVtUiCmdValidationActionBase()
+    {
+    __VTPRINTENTER( "ValActBase.~" )
+    iHandledCommands.Reset();
+    __VTPRINTEXIT( "ValActBase.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdValidationActionBase::BeginProcess
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdValidationActionBase::BeginProcess()
+    {
+    __VTPRINTENTER( "ValActBase.BeginProcess" )
+    iHandledCommands.Reset();
+    __VTPRINTEXIT( "ValActBase.BeginProcess" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdValidationActionBase::EndProcess
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdValidationActionBase::EndProcess()
+    {
+    __VTPRINTENTER( "ValActBase.EndProcess" )
+    __VTPRINTEXIT( "ValActBase.EndProcess" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdValidationActionBase::CommandHandledL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdValidationActionBase::CommandHandledL( TInt aCommandId )
+    {
+    __VTPRINTENTER( "ValActBase.CommandHandledL" )
+    __VTPRINT2( DEBUG_GEN, "    cmdId = %d", aCommandId );
+    User::LeaveIfError( iHandledCommands.InsertInOrder( aCommandId ) );
+    __VTPRINTEXIT( "ValActBase.CommandHandledL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdValidationActionBase::IsCommandHandled
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiCmdValidationActionBase::IsCommandHandled( TInt aCommandId ) const
+    {
+    __VTPRINTENTER( "ValActBase.IsCommandHandled" )
+    TBool result( iHandledCommands.FindInOrder( aCommandId ) != KErrNotFound );
+    __VTPRINTEXITR( "ValActBase.IsCommandHandled %d", result )
+    return result;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuicmdvalidatorbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* 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:  Command validator base class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicmdvalidatorbase.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdValidatorBase::Priority
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiCmdValidatorBase::Priority() const
+    {
+    __VTPRINTENTER( "ValidatorBase.Priority" )
+    __VTPRINTEXITR( "ValidatorBase.Priority %d", iPriority )
+    return iPriority;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdValidatorBase::CVtUiCmdValidatorBase
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdValidatorBase::CVtUiCmdValidatorBase( TInt aPriority )
+    : iPriority( aPriority )
+    {
+    __VTPRINTENTER( "ValidatorBase.ctor" )
+    __VTPRINTEXIT( "ValidatorBase.ctor" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuicommandmanager.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,421 @@
+/*
+* 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:  Command manager class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicmdbase.h"
+#include "cvtuicommandmanager.h"
+#include "cvtuicommandpolicymanager.h"
+#include "cvtuiprimarycmdpolicy.h"
+#include "cvtuiexecutioncontext.h"
+#include "cvtuimenuitemdimmeraction.h"
+#include "tvtuistates.h"
+#include "mvtuicommandui.h"
+#include "cvtuicommandmodifybase.h"
+#include "cvtuicmdstatecheckaction.h"
+
+// Default array granularity.
+static const TInt KVtUiArrayGranularity = 1;
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::NewL
+// -----------------------------------------------------------------------------
+//
+CVtUiCommandManager* CVtUiCommandManager::NewL( const TVtUiStates& aUiStates,
+    CVtUiAppUi& aAppUi )
+    {
+    __VTPRINTENTER( "CmdMgr.NewL" )
+    CVtUiCommandManager* self = new ( ELeave ) CVtUiCommandManager( aUiStates,
+        aAppUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "CmdMgr.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::~CVtUiCommandManager
+// -----------------------------------------------------------------------------
+//
+CVtUiCommandManager::~CVtUiCommandManager()
+    {
+    __VTPRINTENTER( "CmdMgr.~" )
+    iCommands.Reset();
+    iCommandUis.Reset();
+    iCommandModifiers.Reset();
+    delete iExecutionContext;
+    delete iCmdStateCheckAction;
+    delete iCmdPolicyMgr;
+    __VTPRINTEXIT( "CmdMgr.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::UiStates
+// -----------------------------------------------------------------------------
+//
+const TVtUiStates& CVtUiCommandManager::UiStates() const
+    {
+    return iUiStates;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::AppUi
+// -----------------------------------------------------------------------------
+//
+const CVtUiAppUi& CVtUiCommandManager::AppUi() const
+    {
+    return iAppUi;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::VideoTelephonyVariation
+// -----------------------------------------------------------------------------
+//
+const TVtUiVideoTelephonyVariation&
+CVtUiCommandManager::VideoTelephonyVariation() const
+    {
+    return iVtVariation;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::HandleCommandL
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::HandleCommandL( TInt aCommandId )
+    {
+    TInt index( iCommands.FindInOrder( aCommandId, CVtUiCmdBase::KeyOrder() ) );
+    if ( index != KErrNotFound )
+        {
+        iCommands[ index ]->HandleL();
+        }
+    /*
+
+    This was commented out, because current CVtUiAppUi silently ignores
+    commands that are not handled, changed this to emulate same kind of
+    behaviour.
+
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    */
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::AddCommandUi
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiCommandManager::AddCommandUi( MVtUiCommandUi& aCommandUi )
+    {
+    __VTPRINTENTER( "CmdMgr.AddCommandUi" )
+    TInt result( KErrAlreadyExists );
+    TInt idx( iCommandUis.Find( &aCommandUi ) );
+    if ( idx == KErrNotFound )
+        {
+        result = iCommandUis.Append( &aCommandUi );
+        if ( result == KErrNone )
+            {
+            result = CommandUiAdded( aCommandUi );
+            }
+        }
+    __VTPRINTEXITR( "CmdMgr.AddCommandUi %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::RemoveCommandUi
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::RemoveCommandUi( MVtUiCommandUi& aCommandUi )
+    {
+    __VTPRINTENTER( "CmdMgr.RemoveCommandUi" )
+    TInt idx( iCommandUis.Find( &aCommandUi ) );
+    if ( idx != KErrNotFound )
+        {
+        iCommandUis.Remove( idx );
+        CommandUiRemoved( aCommandUi );
+        }
+    __VTPRINTEXIT( "CmdMgr.RemoveCommandUi" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::ValidateMenuItemsL
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::ValidateMenuItemsL(
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdMgr.ValidateMenuItemsL" )
+    iCmdPolicyMgr->ValidateMenuItemsL( aAction );
+    __VTPRINTEXIT( "CmdMgr.ValidateMenuItemsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::ValidateSoftkeyItemsL
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::ValidateSoftkeyItemsL(
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdMgr.ValidateSoftkeyItemsL" )
+    iCmdPolicyMgr->ValidateSoftkeyItemsL( aAction );
+    __VTPRINTEXIT( "CmdMgr.ValidateSoftkeyItemsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::ValidateToolbarItemsL
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::ValidateToolbarItemsL(
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdMgr.ValidateToolbarItemsL" )
+    iCmdPolicyMgr->ValidateToolbarItemsL( aAction );
+    __VTPRINTEXIT( "CmdMgr.ValidateToolbarItemsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::IsCommandAllowedL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiCommandManager::IsCommandAllowedL( TInt aCommandId )
+    {
+    __VTPRINTENTER( "CmdMgr.IsCommandAllowedL" )
+    TInt index( iCommands.FindInOrder( aCommandId, CVtUiCmdBase::KeyOrder() ) );
+    if ( index == KErrNotFound )
+        {
+        iCmdStateCheckAction->SetCommand( aCommandId );
+        iCmdPolicyMgr->CustomValidateL( *iCmdStateCheckAction );
+        }
+    else
+        {
+        return iCommands[ index ]->IsEnabled();
+        }
+    __VTPRINTEXIT( "CmdMgr.IsCommandAllowedL" )
+    return iCmdStateCheckAction->IsCommandAllowed();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::RegisterCommandContext
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiCommandManager::RegisterCommandContext( CVtUiCmdContext& aContext )
+    {
+    __VTPRINTENTER( "CmdMgr.RegisterCommandContext" )
+    TInt result( iCmdPolicyMgr->RegisterCommandContext( aContext ) );
+    __VTPRINTEXITR( "CmdMgr.RegisterCommandContext %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::UnregisterCommandContext
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::UnregisterCommandContext( CVtUiCmdContext& aContext )
+    {
+    __VTPRINTENTER( "CmdMgr.UnregisterCommandContext" )
+    iCmdPolicyMgr->UnregisterCommandContext( aContext );
+    __VTPRINTEXIT( "CmdMgr.UnregisterCommandContext" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::AddValidator
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiCommandManager::AddValidator( CVtUiCmdValidatorBase& aValidator )
+    {
+    __VTPRINTENTER( "CmdMgr.AddValidator" )
+    TInt result( iCmdPolicyMgr->AddValidator( aValidator ) );
+    __VTPRINTEXITR( "CmdMgr.AddValidator %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::RemoveValidator
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::RemoveValidator(
+    CVtUiCmdValidatorBase& aValidator )
+    {
+    __VTPRINTENTER( "CmdMgr.RemoveValidator" )
+    iCmdPolicyMgr->RemoveValidator( aValidator );
+    __VTPRINTEXIT( "CmdMgr.RemoveValidator" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::RefreshL
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::RefreshL()
+    {
+    __VTPRINTENTER( "CmdMgr.RefreshL" )
+    for ( TInt i = iCommandUis.Count() - 1; i >= 0; i-- )
+        {
+        iCommandUis[ i ]->RefreshL();
+        }
+    __VTPRINTEXIT( "CmdMgr.RefreshL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::AddCommandModifier
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiCommandManager::AddCommandModifier(
+    CVtUiCommandModifyBase& aModifier )
+    {
+    __VTPRINTENTER( "CmdMgr.AddCommandModifier" )
+    TInt result(
+        iCommandModifiers.InsertInOrder( &aModifier,
+            CVtUiCommandModifyBase::PriorityOrder() ) );
+    if ( result == KErrNone )
+        {
+        result = CommandModifierAdded( aModifier );
+        }
+    __VTPRINTEXITR( "CmdMgr.AddCommandModifier %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::RemoveCommandModifier
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::RemoveCommandModifier(
+    CVtUiCommandModifyBase& aModifier )
+    {
+    __VTPRINTENTER( "CmdMgr.RemoveCommandModifier" )
+    TInt idx( iCommandModifiers.FindInOrder( &aModifier,
+        CVtUiCommandModifyBase::PriorityOrder() ) );
+    if ( idx != KErrNotFound )
+        {
+        iCommandModifiers.Remove( idx );
+        CommandModifierRemoved( aModifier );
+        }
+    __VTPRINTEXIT( "CmdMgr.RemoveCommandModifier" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::RegisterCommandL
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::RegisterCommandL( CVtUiCmdBase& aCommand )
+    {
+    __VTPRINTENTER( "CmdMgr.RegisterCommandL" )
+    iCommands.InsertInOrderL( &aCommand, CVtUiCmdBase::LinearOrder() );
+    __VTPRINTEXIT( "CmdMgr.RegisterCommandL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::UnregisterCommand
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::UnregisterCommand( const CVtUiCmdBase& aCommand )
+    {
+    __VTPRINTENTER( "CmdMgr.UnregisterCommand" )
+    TInt index( iCommands.FindInOrder( &aCommand,
+        CVtUiCmdBase::LinearOrder() ) );
+    if ( index != KErrNotFound )
+        {
+        iCommands.Remove( index );
+        }
+    __VTPRINTEXIT( "CmdMgr.UnregisterCommand" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::CVtUiCommandManager
+// -----------------------------------------------------------------------------
+//
+CVtUiCommandManager::CVtUiCommandManager( const TVtUiStates& aUiStates, 
+    CVtUiAppUi& aAppUi )
+: iCommandUis( KVtUiArrayGranularity ),
+  iCommandModifiers( KVtUiArrayGranularity ),
+  iCommands( KVtUiArrayGranularity ),
+  iUiStates( aUiStates ),
+  iAppUi( aAppUi )
+    {
+    __VTPRINTENTER( "CmdMgr.ctor" )
+    __VTPRINTEXIT( "CmdMgr.ctor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::ConstructL()
+    {
+    __VTPRINTENTER( "CmdMgr.ConstructL" )
+    iVtVariation.ReadL();
+    iCmdPolicyMgr = CVtUiCommandPolicyManager::NewL( *this );
+    iCmdStateCheckAction = CVtUiCmdStateCheckAction::NewL();
+    iExecutionContext = CVtUiExecutionContext::NewL( *this );
+    __VTPRINTEXIT( "CmdMgr.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::CommandModifierAdded
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiCommandManager::CommandModifierAdded(
+    CVtUiCommandModifyBase& aModifier )
+    {
+    TInt error( KErrNone );
+    for ( TInt i = iCommandUis.Count() - 1; !error && i >= 0; i-- )
+        {
+        error = iCommandUis[ i ]->AddCommandModifier( aModifier );
+        }
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::CommandModifierRemoved
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::CommandModifierRemoved(
+    CVtUiCommandModifyBase& aModifier )
+    {
+    for ( TInt i = iCommandUis.Count() - 1; i >= 0; i-- )
+        {
+        iCommandUis[ i ]->RemoveCommandModifier( aModifier );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::CommandUiAdded
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiCommandManager::CommandUiAdded( MVtUiCommandUi& aCommandUi )
+    {
+    TInt error( KErrNone );
+    for ( TInt i = iCommandModifiers.Count() - 1; !error && i >= 0; i-- )
+        {
+        error = aCommandUi.AddCommandModifier( *iCommandModifiers[ i ] );
+        }
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiCommandManager::CommandUiRemoved
+// -----------------------------------------------------------------------------
+//
+void CVtUiCommandManager::CommandUiRemoved( MVtUiCommandUi& aCommandUi )
+    {
+    for ( TInt i = iCommandModifiers.Count() - 1; i >= 0; i-- )
+        {
+        aCommandUi.RemoveCommandModifier( *iCommandModifiers[ i ] );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuicommandmodifybase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* 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:  Command context base class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicommandmodifybase.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandModifyBase::CVtUiCommandModifyBase
+// ---------------------------------------------------------------------------
+//
+CVtUiCommandModifyBase::CVtUiCommandModifyBase( TInt aPriority )
+    : iPriority( aPriority )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandModifyBase::PriorityOrder
+// ---------------------------------------------------------------------------
+//
+TLinearOrder< CVtUiCommandModifyBase > CVtUiCommandModifyBase::PriorityOrder()
+    {
+    return TLinearOrder< CVtUiCommandModifyBase >( PriorityOrderFunc );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandModifyBase::PriorityOrderFunc
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiCommandModifyBase::PriorityOrderFunc(
+    const CVtUiCommandModifyBase& aM1, const CVtUiCommandModifyBase& aM2 )
+    {
+    return aM1.iPriority - aM2.iPriority;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuicommandpolicymanager.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,334 @@
+/*
+* 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:  Command policy manager class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicommandpolicymanager.h"
+#include "cvtuicmdcontext.h"
+#include "cvtuicmdvalidatorbase.h"
+#include "cvtuicmdvalidationactionbase.h"
+#include "cvtuicmdcustomvalidationactionbase.h"
+#include "cvtuiprimarycmdpolicy.h"
+#include "cvtuicommandmanager.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Used in InsertInOrder() method to compare two instances of CVtUiCmdContext.
+// ---------------------------------------------------------------------------
+//
+TInt ContextTypeCmpFunc( const CVtUiCmdContext& aV1,
+    const CVtUiCmdContext& aV2 )
+    {
+    return static_cast< TInt >( aV1.ContextType() ) -
+        static_cast< TInt >( aV2.ContextType() );
+    }
+
+// ---------------------------------------------------------------------------
+// Used in FindInOrder() method to compare instances of CVtUiCmdContext versus
+// given key value.
+// ---------------------------------------------------------------------------
+//
+TInt ContextTypeCmpFuncVsKey( const TVtUiCmdContextType* aKey,
+    const CVtUiCmdContext& aValue )
+    {
+    return static_cast< TInt > ( *aKey ) -
+        static_cast< TInt >( aValue.ContextType() );
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiCommandPolicyManager*
+CVtUiCommandPolicyManager::NewL( const CVtUiCommandManager& aCmdManager )
+    {
+    CVtUiCommandPolicyManager* self =
+        new ( ELeave ) CVtUiCommandPolicyManager( aCmdManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::~CVtUiCommandPolicyManager
+// ---------------------------------------------------------------------------
+//
+CVtUiCommandPolicyManager::~CVtUiCommandPolicyManager()
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.~" )
+    iContexts.Reset();
+    iValidators.Reset();
+    delete iPrimaryCommandPolicy;
+    __VTPRINTEXIT( "CmdPolicyMgr.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::RegisterCommandContext
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiCommandPolicyManager::RegisterCommandContext(
+    CVtUiCmdContext& aContext )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.RegisterCommandContext" )
+    TLinearOrder< CVtUiCmdContext > cmpFunc( ::ContextTypeCmpFunc );
+    TInt result( KErrNone );
+    TInt index( iContexts.FindInOrder( &aContext, cmpFunc ) );
+    if ( index == KErrNotFound )
+        {
+        TInt error( iContexts.InsertInOrder( &aContext, cmpFunc ) );
+        if ( !error )
+            {
+            CommandContextRegistered( aContext );
+            }
+        result = error;
+        }
+    else
+        {
+        result = KErrAlreadyExists;
+        }
+    __VTPRINTEXITR( "CmdPolicyMgr.RegisterCommandContext %d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::UnregisterCommandContext
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::UnregisterCommandContext(
+    CVtUiCmdContext& aContext )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.UnregisterCommandContext" )
+    TLinearOrder< CVtUiCmdContext > cmpFunc( ::ContextTypeCmpFunc );
+    TInt index( iContexts.FindInOrder( &aContext, cmpFunc ) );
+    if ( index != KErrNotFound )
+        {
+        iContexts.Remove( index );
+        CommandContextUnregistered( aContext );
+        }
+    __VTPRINTEXIT( "CmdPolicyMgr.UnregisterCommandContext" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::AddValidator
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiCommandPolicyManager::AddValidator(
+    CVtUiCmdValidatorBase& aValidator )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.AddValidator" )
+    TInt error( iValidators.Append( &aValidator ) );
+    if ( !error )
+        {
+        ValidatorAdded( aValidator );
+        }
+    __VTPRINTEXITR( "CmdPolicyMgr.AddValidator %d", error )
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::RemoveValidator
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::RemoveValidator(
+    CVtUiCmdValidatorBase& aValidator )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.RemoveValidator" )
+    TInt index( iValidators.Find( &aValidator ) );
+    if ( index != KErrNotFound )
+        {
+        iValidators.Remove( index );
+        ValidatorRemoved( aValidator );
+        }
+    __VTPRINTEXIT( "CmdPolicyMgr.RemoveValidator" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::ValidateMenuItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::ValidateMenuItemsL(
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.ValidateMenuItemsL" )
+    ValidateL( EVtUiCmdContextTypeMenu, aAction );
+    __VTPRINTEXIT( "CmdPolicyMgr.ValidateMenuItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::ValidateSoftkeyItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::ValidateSoftkeyItemsL(
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.ValidateSoftkeyItemsL" )
+    ValidateL( EVtUiCmdContextTypeSoftkey, aAction );
+    __VTPRINTEXIT( "CmdPolicyMgr.ValidateSoftkeyItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::ValidateToolbarItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::ValidateToolbarItemsL(
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.ValidateToolbarItemsL" )
+    ValidateL( EVtUiCmdContextTypeToolbar, aAction );
+    __VTPRINTEXIT( "CmdPolicyMgr.ValidateToolbarItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::CustomValidateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::CustomValidateL(
+    CVtUiCmdCustomValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.CustomValidateL" )
+    ValidateL( EVtUiCmdContextTypeExecution, aAction );
+    __VTPRINTEXIT( "CmdPolicyMgr.CustomValidateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::CVtUiCommandPolicyManager
+// ---------------------------------------------------------------------------
+//
+CVtUiCommandPolicyManager::CVtUiCommandPolicyManager(
+    const CVtUiCommandManager& aCmdManager ) : iCommandManager( aCmdManager )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.ctor" )
+    __VTPRINTEXIT( "CmdPolicyMgr.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::ConstructL()
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.ConstructL" )
+    iPrimaryCommandPolicy =
+        CVtUiPrimaryCmdPolicy::NewL( iCommandManager.UiStates(),
+        iCommandManager.AppUi() );
+    User::LeaveIfError( AddValidator( *iPrimaryCommandPolicy ) );
+    __VTPRINTEXIT( "CmdPolicyMgr.ConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::CommandContextRegistered
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::CommandContextRegistered(
+    CVtUiCmdContext& aContext )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.CommandContextRegistered" )
+    for ( TInt i = iValidators.Count() - 1 ; i >= 0; i-- )
+        {
+        aContext.AddValidator( *iValidators[ i ] );
+        }
+    __VTPRINTEXIT( "CmdPolicyMgr.CommandContextRegistered" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::CommandContextUnregistered
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::CommandContextUnregistered(
+    CVtUiCmdContext& aContext )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.CommandContextUnregistered" )
+    for ( TInt i = iValidators.Count() - 1 ; i >= 0; i-- )
+        {
+        aContext.RemoveValidator( *iValidators[ i ] );
+        }
+    __VTPRINTEXIT( "CmdPolicyMgr.CommandContextUnregistered" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::ValidatorAdded
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::ValidatorAdded(
+    CVtUiCmdValidatorBase& aValidator )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.ValidatorAdded" )
+    for ( TInt i = iContexts.Count() - 1 ; i >= 0; i-- )
+        {
+        iContexts[ i ]->AddValidator( aValidator );
+        }
+    __VTPRINTEXIT( "CmdPolicyMgr.ValidatorAdded" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::ValidatorRemoved
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::ValidatorRemoved(
+    CVtUiCmdValidatorBase& aValidator )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.ValidatorRemoved" )
+    for ( TInt i = iContexts.Count() - 1 ; i >= 0; i-- )
+        {
+        iContexts[ i ]->RemoveValidator( aValidator );
+        }
+    __VTPRINTEXIT( "CmdPolicyMgr.ValidatorRemoved" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::FindCommandContextByType
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdContext* CVtUiCommandPolicyManager::FindCommandContextByType(
+        TVtUiCmdContextType aContextType )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.FindCommandContextByType" )
+    CVtUiCmdContext* result = NULL;
+    TInt index( iContexts.FindInOrder( aContextType,
+        ::ContextTypeCmpFuncVsKey ) );
+    if ( index != KErrNotFound )
+        {
+        result = iContexts[ index ];
+        }
+    __VTPRINTEXIT( "CmdPolicyMgr.FindCommandContextByType" )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCommandPolicyManager::ValidateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCommandPolicyManager::ValidateL( TVtUiCmdContextType aContextType,
+    CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "CmdPolicyMgr.ValidateL" )
+    CVtUiCmdContext* context =
+        FindCommandContextByType( aContextType );
+    if ( context )
+        {
+        aAction.BeginProcess();
+        context->ValidateL( aAction );
+        aAction.EndProcess();
+        }
+    __VTPRINTEXIT( "CmdPolicyMgr.ValidateL" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuiexecutioncontext.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* 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:  Execution context class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuiexecutioncontext.h"
+#include "cvtuicmdcustomvalidationactionbase.h"
+
+/** Execution context reference priority */
+static const TInt KVtUiExecutionContextPriority = 1000;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiExecutionContext::~CVtUiExecutionContext
+// ---------------------------------------------------------------------------
+//
+CVtUiExecutionContext::~CVtUiExecutionContext()
+    {
+    __VTPRINTENTER( "ExecCtx.~" )
+    UnregisterCommandContext();
+    __VTPRINTEXIT( "ExecCtx.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiExecutionContext::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiExecutionContext* CVtUiExecutionContext::NewL(
+    MVtUiCommandManager& aCommandManager )
+    {
+    __VTPRINTENTER( "ExecCtx.NewL" )
+    CVtUiExecutionContext* self =
+        new ( ELeave ) CVtUiExecutionContext( aCommandManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "ExecCtx.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiExecutionContext::ValidateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiExecutionContext::ValidateL( CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "ExecCtx.ValidateL" )
+    CustomValidationL(
+        static_cast< CVtUiCmdCustomValidationActionBase& >( aAction ) );
+    __VTPRINTEXIT( "ExecCtx.ValidateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiExecutionContext::CVtUiExecutionContext
+// ---------------------------------------------------------------------------
+//
+CVtUiExecutionContext::CVtUiExecutionContext(
+    MVtUiCommandManager& aCommandManager )
+    : CVtUiCmdContext( aCommandManager, EVtUiCmdContextTypeExecution,
+      KVtUiExecutionContextPriority )
+    {
+    __VTPRINTENTER( "ExecCtx.ctor" )
+    __VTPRINTEXIT( "ExecCtx.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiExecutionContext::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiExecutionContext::ConstructL()
+    {
+    __VTPRINTENTER( "ExecCtx.ConstructL" )
+    RegisterCommandContextL();
+    __VTPRINTEXIT( "ExecCtx.ConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuifeaturecmdbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* 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:  Feature based UI command base class implementation.
+*
+*/
+
+
+#include "cvtuifeaturecmdbase.h"
+#include "mvtuifeature.h"
+
+// ---------------------------------------------------------------------------
+// CVtUiFeatureCmdBase::HandleL
+// ---------------------------------------------------------------------------
+//
+void CVtUiFeatureCmdBase::HandleL()
+    {
+    iFeature.StartL();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiFeatureCmdBase::IsEnabled
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiFeatureCmdBase::IsEnabled() const
+    {
+    return ( iFeature.State() == MVtUiFeature::EReady ) ||
+        ( iFeature.State() == MVtUiFeature::EUnprepared );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiFeatureCmdBase::CVtUiFeatureCmdBase
+// ---------------------------------------------------------------------------
+//
+CVtUiFeatureCmdBase::CVtUiFeatureCmdBase( MVtUiFeature& aFeature,
+    TInt aCommandId ) : CVtUiCmdBase( aCommandId ), iFeature( aFeature )
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/cvtuiprimarycmdpolicy.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,532 @@
+/*
+* 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:  Primary policy class.
+*
+*/
+
+
+#include <featmgr.h>
+#include <avkon.hrh>
+#include <cvtlogger.h>
+#include <videotelui.rsg>
+#include <avkon.rsg>
+
+#include "cvtuiprimarycmdpolicy.h"
+#include "cvtuicmdvalidationactionbase.h"
+#include "cvtuicmdcustomvalidationactionbase.h"
+#include "tvtuicmdvalidatorcallback.h"
+#include "tvtuistates.h"
+#include "videotelui.hrh"
+#include "tVtuifeaturevariation.h"
+#include "CVtUiAppUi.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiPrimaryCmdPolicy* CVtUiPrimaryCmdPolicy::NewL(
+    const TVtUiStates& aUiStates, const CVtUiAppUi& aAppUi )
+    {
+    __VTPRINTENTER( "PrimaryCmdPolicy.NewL" )
+    CVtUiPrimaryCmdPolicy* self =
+        new ( ELeave ) CVtUiPrimaryCmdPolicy( aUiStates, aAppUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "PrimaryCmdPolicy.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::~CVtUiPrimaryCmdPolicy
+// ---------------------------------------------------------------------------
+//
+CVtUiPrimaryCmdPolicy::~CVtUiPrimaryCmdPolicy()
+    {
+    __VTPRINTENTER( "PrimaryCmdPolicy.~" )
+    __VTPRINTEXIT( "PrimaryCmdPolicy.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ValidateMenuItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrimaryCmdPolicy::ValidateMenuItemsL(
+    CVtUiCmdValidationActionBase& aAction, TInt )
+    {
+    __VTPRINTENTER( "PrimaryCmdPolicy.ValidateMenuItemsL" )
+    aAction.ProcessL(
+        TVtUiCmdValidatorCallBack< CVtUiPrimaryCmdPolicy >( *this,
+            ValidateMenuCommand ) );
+    __VTPRINTEXIT( "PrimaryCmdPolicy.ValidateMenuItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ValidateSoftkeyItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrimaryCmdPolicy::ValidateSoftkeyItemsL(
+    CVtUiCmdValidationActionBase& aAction, TInt )
+    {
+    __VTPRINTENTER( "PrimaryCmdPolicy.ValidateSoftkeyItemsL" )
+    aAction.ProcessL(
+        TVtUiCmdValidatorCallBack< CVtUiPrimaryCmdPolicy >( *this,
+            ValidateSoftkey ) );
+    __VTPRINTEXIT( "PrimaryCmdPolicy.ValidateSoftkeyItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ValidateSoftkeyItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrimaryCmdPolicy::ValidateToolbarItemsL(
+    CVtUiCmdValidationActionBase& aAction, TInt )
+    {
+    __VTPRINTENTER( "PrimaryCmdPolicy.ValidateToolbarItemsL" )
+    aAction.ProcessL(
+        TVtUiCmdValidatorCallBack< CVtUiPrimaryCmdPolicy >( *this,
+            ValidateToolbarCommand ) );
+    __VTPRINTEXIT( "PrimaryCmdPolicy.ValidateToolbarItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::CustomValidationL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrimaryCmdPolicy::CustomValidationL(
+    CVtUiCmdCustomValidationActionBase& aAction, TInt )
+    {
+    __VTPRINTENTER( "PrimaryCmdPolicy.CustomValidationL" )
+    switch ( aAction.CustomTypeId() )
+        {
+    // Command state validation
+    case EVtUiCmdContextTypeExecution:
+        aAction.ProcessL( TVtUiCmdValidatorCallBack< CVtUiPrimaryCmdPolicy >(
+            *this, ValidateCommandState ) );
+        break;
+
+    default:
+        __VTPRINT2( DEBUG_GEN,
+            "PrimaryCmdPolicy.CustomValidationL unknown typeId = %d",
+            aAction.CustomTypeId() );
+        break;
+        }
+    __VTPRINTEXIT( "PrimaryCmdPolicy.CustomValidationL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ValidatesContext
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiPrimaryCmdPolicy::ValidatesContext(
+    const TVtUiCmdContextType& aCtxType ) const
+    {
+    __VTPRINTENTER( "PrimaryCmdPolicy.ValidatesContext" )
+
+    TBool result( EFalse );
+
+    switch ( aCtxType )
+        {
+    case EVtUiCmdContextTypeMenu:
+    case EVtUiCmdContextTypeSoftkey:
+    case EVtUiCmdContextTypeToolbar:
+    case EVtUiCmdContextTypeExecution:
+        result = ETrue;
+        break;
+
+    default:
+        break;
+        }
+
+    __VTPRINTEXITR( "PrimaryCmdPolicy.ValidatesContext %d", result )
+
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::CVtUiPrimaryCmdPolicy
+// ---------------------------------------------------------------------------
+//
+CVtUiPrimaryCmdPolicy::CVtUiPrimaryCmdPolicy( const TVtUiStates& aUiStates,
+    const  CVtUiAppUi& aAppUi )
+    : CVtUiCmdValidatorBase( EVtUiCmdPolicyPriorityPrimary ),
+      iUiStates( aUiStates ), iAppUi( aAppUi )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrimaryCmdPolicy::ConstructL()
+    {
+    TVtUiActiveIdleVariation activeIdleVariation;
+    iAIEnabled = activeIdleVariation.IsActiveIdleEnabled();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ValidateMenuCommand
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiPrimaryCmdPolicy::ValidateMenuCommand( TInt aCommandId ) const
+    {
+    TBool handled;
+    return ValidateCommand( aCommandId, handled );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ValidateSoftkey
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiPrimaryCmdPolicy::ValidateSoftkey( TInt aResourceId ) const
+    {
+    __VTPRINTENTER( "PrimaryCmdPolicy.ValidateSoftkey" )
+    TBool result( EFalse );
+    switch ( aResourceId )
+        {
+    case R_VIDEOTELUI_SOFTKEYS_EMPTY_ACTIVE_COMMAND:
+        result = iUiStates.IsCommandActivating();
+        break;
+
+    case R_VIDEOTELUI_SOFTKEYS_EMPTY_DIALEREXIT:
+        result = iUiStates.IsDialerActivating();
+        break;
+
+    case R_VIDEOTELUI_SOFTKEYS_SHARE_OBJECT_IMAGE:
+        result = iUiStates.MediaState().IsSharing();
+        break;
+
+    case R_VIDEOTELUI_SOFTKEYS_CAPTURE_VIDEO:
+        result = iUiStates.IsCaptureModeOn();
+        break;
+
+    case R_VIDEOTELUI_SOFTKEYS_ENABLE_AUDIO:
+        result = !iUiStates.AudioState().IsAudio();
+        break;
+
+    case R_VIDEOTELUI_SOFTKEYS_ENABLE_VIDEO:
+        result = !iUiStates.MediaState().IsVideo() &&
+            iUiStates.MediaState().HasCamera() &&
+            ( iUiStates.ExecState() == TVtUiStates::EExecStateRunning );
+        break;
+
+    case R_VIDEOTELUI_SOFTKEYS_DIALER:
+    case R_VIDEOTELUI_SOFTKEYS_BT_HANDSFREE:
+    case R_VIDEOTELUI_SOFTKEYS_LOUDSPEAKER:
+    case R_VIDEOTELUI_SOFTKEYS_HANDSET_B:
+        {
+        if ( FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) &&
+             ( iUiStates.ExecState() == TVtUiStates::EExecStateRunning ) )
+            {
+            switch ( aResourceId )
+                {
+            case R_VIDEOTELUI_SOFTKEYS_DIALER:
+                result = ETrue;
+                break;
+                }
+            }
+        else
+            {
+            switch ( aResourceId )
+                {
+            case R_VIDEOTELUI_SOFTKEYS_BT_HANDSFREE:
+                result = iUiStates.AudioState().CanActivateBtHf();
+                break;
+
+            case R_VIDEOTELUI_SOFTKEYS_LOUDSPEAKER:
+                result = iUiStates.AudioState().CanActivateLoudspeaker();
+                break;
+
+            case R_VIDEOTELUI_SOFTKEYS_HANDSET_B:
+                result = iUiStates.AudioState().CanDeactivateLoudspeaker();
+                break;
+                }
+            }
+        }
+        break;
+
+    case R_VIDEOTELUI_SOFTKEYS_END_CALL:
+        result = ETrue;
+        break;
+        }
+    __VTPRINTEXITR( "PrimaryCmdPolicy.ValidateSoftkey %d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ValidateToolbarCommand
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiPrimaryCmdPolicy::ValidateToolbarCommand( TInt aCommandId ) const
+    {
+     __VTPRINTENTER( "PrimaryCmdPolicy.ValidateToolbarCommand" )
+    __VTPRINT2( DEBUG_GEN, "cmdId = %d", aCommandId )
+    TBool result( ETrue );
+    switch( aCommandId )
+        {
+        case EVtUiCmdZoom:
+        case EVtUiCmdShareObjectImage:
+        case EVtUiCmdSwapImagesPlaces:
+        //case EVtUiCmdSnapshot:
+
+            result = EFalse;
+            break;
+
+        default:
+            result = ValidateMenuCommand( aCommandId );
+            break;
+        }
+    __VTPRINTEXITR( "PrimaryCmdPolicy.ValidateToolbarCommand %d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ValidateCommandState
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiPrimaryCmdPolicy::ValidateCommandState( TInt aCommandId ) const
+    {
+     __VTPRINTENTER( "PrimaryCmdPolicy.ValidateCommandState" )
+    TBool handled;
+    TBool allowed( !ValidateCommand( aCommandId, handled ) );
+    if ( !handled )
+        {
+        switch ( aCommandId )
+            {
+        case EVtUiCmdCapture:
+        case EVtUiCmdCancelCapture:
+            allowed = iUiStates.IsCaptureModeOn();
+            break;
+
+        case EVtUiCmdStopSharingObjectImage:
+            allowed = iUiStates.MediaState().IsSharing() &&
+                !iUiStates.MediaState().IsVideoPermanentlyStopped();
+            break;
+
+        default:
+            allowed = ETrue;
+            break;
+            }
+        }
+    __VTPRINTEXITR( "PrimaryCmdPolicy.ValidateCommandState %d", allowed )
+    return allowed;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrimaryCmdPolicy::ValidateCommand
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiPrimaryCmdPolicy::ValidateCommand( TInt aCommandId,
+    TBool& aHandled ) const
+    {
+    __VTPRINTENTER( "PrimaryCmdPolicy.ValidateCommand" )
+
+    __VTPRINT2( DEBUG_GEN, "    cmdId = %d", aCommandId )
+
+    TBool result( ETrue );
+
+    aHandled = ETrue;
+
+    const TVtUiMediaState& mediaState( iUiStates.MediaState() );
+    const TVtUiAudioState& audioState( iUiStates.AudioState() );
+    const TBool disabledVideo( !mediaState.IsVideo() ||
+        mediaState.IsSharing() );
+    const TBool disabledAudio( !audioState.IsAudio() );
+    const TBool disableVideoOptions( !mediaState.HasCamera() );
+    const TBool freezeSupported( mediaState.IsFreezeSupported() );
+    const TBool frozen( mediaState.IsFrozen() );
+
+    const TBool videoPermStopped( mediaState.IsVideoPermanentlyStopped() );
+    const TBool audioPermStopped( audioState.IsAudioPermanentlyStopped() );
+
+    switch( aCommandId )
+        {
+    case EVtUiCmdSnapshot:
+        result = ( disabledVideo && !frozen ) ||
+                   disableVideoOptions ||
+                   !freezeSupported;
+        break;
+
+    case EVtUiCmdUsePrimaryCamera:
+        result = mediaState.IsPrimaryCameraInUse() || frozen ||
+            !mediaState.HasPrimaryCamera() || mediaState.IsSharing() ||
+            videoPermStopped;
+        break;
+
+    case EVtUiCmdUseSecondaryCamera:
+        result = mediaState.IsSecondaryCameraInUse() || frozen ||
+            !mediaState.HasSecondaryCamera() || mediaState.IsSharing() ||
+            videoPermStopped;
+        break;
+
+    case EVtUiCmdDeactivateBT:
+        result = !audioState.CanDeactivateBtHf();
+        break;
+
+    case EVtUiCmdSwitchFromBTToIHF:
+        result = !audioState.CanDeactivateBtHf() ||
+            !audioState.CanActivateLoudspeaker();
+        break;
+
+    case EVtUiCmdActivateBT:
+        result = !audioState.CanActivateBtHf();
+        break;
+
+    case EVtUiCmdDeactivateLoudspeaker:
+        result = !audioState.CanDeactivateLoudspeaker();
+        break;
+
+    case EVtUiCmdActivateLoudspeaker:
+        result = !audioState.CanActivateLoudspeaker();
+        break;
+
+    case EVtUiCmdSwapImagesPlaces:
+        // Swap image places is always shown in menu.
+        result = EFalse;
+        break;
+
+    case EVtUiCmdAdjustVideo:
+        // Adjust video is always shown in menu.
+        result = EFalse;
+        break;
+
+    case EVtUiCmdAdjustVideoVideoQuality:
+        result = EFalse;
+        break;
+
+    case EVtUiCmdAdjustVideoWhiteBalance:
+        result = !iUiStates.IsWhiteBalanceSettingAvailable() || frozen;
+        break;
+
+    case EVtUiCmdAdjustVideoBrightness:
+          result =!iUiStates.IsBrightnessSettingAvailable() || frozen;
+        break;
+
+    case EVtUiCmdAdjustVideoContrast:
+        result =!iUiStates.IsContrastSettingAvailable() || frozen;
+        break;
+
+    case EVtUiCmdAdjustVideoColourTone:
+        result = !iUiStates.IsColorToneSettingAvailable() || frozen;
+
+        break;
+    case EVtUiCmdZoom:
+        result = frozen || disableVideoOptions || disabledVideo;
+        break;
+
+    case EVtUiCmdCreateVoice:
+        // Downgrading to voice call is not possible if remote end MSISDN
+        // is unavailable or there is waiting call.
+        result = !iUiStates.IsCLIReceived() || iUiStates.IsWaitingCall();
+        break;
+
+    case EVtUiCmdGoToIdle:
+#ifndef RD_BOOT_CUSTOMIZABLE_AI
+        result = !iAIEnabled;
+#else
+        // When RD_BOOT_CUSTOMIZABLE_AI is defined, active idle is always
+        // shown in menu
+        result = EFalse;
+#endif //RD_BOOT_CUSTOMIZABLE_AI
+        break;
+
+    case EAknCmdHelp:
+    	{
+    	TVtUiHelpVariation hlpvariation;
+        result = !hlpvariation.IsHelpSupported();
+        }
+        break;
+
+    case EAknCmdExit:
+        // Exit option is disabled by default. Change ETrue to EFalse
+        // and it is in the menu.
+        break;
+
+    case EVtUiCmdEndActiveCall:
+        // End active call always shown in menu.
+        result = EFalse;
+        break;
+
+    case EVtUiCmdShareObjectImage:
+        result = frozen || mediaState.IsNotAbleToShare() ||
+            mediaState.IsInitializingShare() || videoPermStopped ||
+            iAppUi.IsActiveCommand( EVtUiCmdShareObjectImage );
+        break;
+
+    case EVtUiCmdEnableMain:
+        result = (  iAppUi.IsActiveCommand( EVtUiCmdEnableVideo ) ||
+                    iAppUi.IsActiveCommand( EVtUiCmdDisableVideo ) ||
+                 !disabledVideo || disableVideoOptions || videoPermStopped )
+                  && ( iAppUi.IsActiveCommand ( EVtUiCmdEnableAudio ) ||
+                  !disabledAudio || audioPermStopped );
+        break;
+
+    case EVtUiCmdEnableVideo:
+        result = !disabledVideo || disableVideoOptions ||
+            videoPermStopped;
+        break;
+
+    case EVtUiCmdEnableAudio:
+        result = !disabledAudio || audioPermStopped;
+        break;
+
+    case EVtUiCmdEnableBoth:
+        result = !disabledVideo || !disabledAudio || disableVideoOptions ||
+            videoPermStopped || audioPermStopped;
+        break;
+
+    case EVtUiCmdDisableMain:
+        result = ( iAppUi.IsActiveCommand( EVtUiCmdDisableVideo ) ||
+                   iAppUi.IsActiveCommand( EVtUiCmdEnableVideo ) ||
+                 disabledVideo || disableVideoOptions || videoPermStopped ) &&
+                ( iAppUi.IsActiveCommand( EVtUiCmdDisableAudio ) ||
+                disabledAudio || audioPermStopped );
+        break;
+
+    case EVtUiCmdDisableVideo:
+        result = disabledVideo || disableVideoOptions || videoPermStopped;
+        break;
+
+    case EVtUiCmdDisableAudio:
+        result = disabledAudio || audioPermStopped;
+        break;
+
+    case EVtUiCmdDisableBoth:
+        result = disableVideoOptions || disabledVideo || disabledAudio ||
+            videoPermStopped || audioPermStopped;
+        break;
+
+    case EVtUiCmdSendDTMF:
+        if ( FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) )
+            {
+            result = EFalse;
+            }
+        else
+            {
+            result = ETrue;
+            }
+        break;
+
+    default:
+        aHandled = EFalse;
+        break;
+        }
+
+    __VTPRINTEXITR( "PrimaryCmdPolicy.ValidateCommand %d", result )
+
+    return result;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/tVtuifeaturevariation.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* 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:  Video Telephone feature variation class definition.
+*
+*/
+
+
+#include "tVtuifeaturevariation.h"
+
+// TVtUiFeatureVariationBase
+
+// -----------------------------------------------------------------------------
+// TVtUiFeatureVariationBase::IsFeatureSupported
+// -----------------------------------------------------------------------------
+//   
+TBool TVtUiFeatureVariationBase::IsFeatureSupported( const TUint32 aId ) const
+		{
+		return FeatureManager::FeatureSupported( aId );		
+		}
+
+//TVtUiHelpVariation
+// -----------------------------------------------------------------------------
+// TVtUiHelpVariation::FeatureId
+// -----------------------------------------------------------------------------
+//  	
+TUint32 TVtUiHelpVariation::FeatureId() const
+		{
+		return KFeatureIdHelp;	
+		}
+// -----------------------------------------------------------------------------
+// TVtUiHelpVariation::IsHelpSupported
+// -----------------------------------------------------------------------------
+//		
+TBool TVtUiHelpVariation::IsHelpSupported() const
+		{
+		return IsFeatureSupported( FeatureId() );	
+		}
+//TVtUiDPVariation
+// -----------------------------------------------------------------------------
+// TVtUiDPVariation::FeatureId
+// -----------------------------------------------------------------------------
+//  	
+TUint32 TVtUiDPVariation::FeatureId() const
+		{
+		return KFeatureIdDisplayPost;	
+		}
+// -----------------------------------------------------------------------------
+// TVtUiDPVariation::IsDPSupported
+// -----------------------------------------------------------------------------
+//		
+TBool TVtUiDPVariation::IsDPSupported() const
+		{
+		return IsFeatureSupported( FeatureId() );	
+		}
+//TVtUiBTVariation
+// -----------------------------------------------------------------------------
+// TVtUiBTVariation::FeatureId
+// -----------------------------------------------------------------------------
+//  	
+TUint32 TVtUiBTVariation::FeatureId() const
+		{
+		return KFeatureIdBt;	
+		}
+// -----------------------------------------------------------------------------
+// TVtUiBTVariation::IsBTSupported
+// -----------------------------------------------------------------------------
+//		
+TBool TVtUiBTVariation::IsBTSupported() const
+		{
+		return IsFeatureSupported( FeatureId() );	
+		}		
+//TVtUiSideVolumeKeysVariation
+// -----------------------------------------------------------------------------
+// TVtUiSideVolumeKeysVariation::FeatureId
+// -----------------------------------------------------------------------------
+//  	
+TUint32 TVtUiSideVolumeKeysVariation::FeatureId() const
+		{
+		return KFeatureIdSideVolumeKeys;	
+		}
+// -----------------------------------------------------------------------------
+// TVtUiSideVolumeKeysVariation::IsSideVolumeKeysSupported
+// -----------------------------------------------------------------------------
+//		
+TBool TVtUiSideVolumeKeysVariation::IsSideVolumeKeysSupported() const
+		{
+		return IsFeatureSupported( FeatureId() );	
+		}
+//TVtUiActiveIdleFetManVariation
+// -----------------------------------------------------------------------------
+// TVtUiActiveIdleFetManVariation::FeatureId
+// -----------------------------------------------------------------------------
+//  	
+TUint32 TVtUiActiveIdleFetManVariation::FeatureId() const
+		{
+		return KFeatureIdActiveIdle;	
+		}
+// -----------------------------------------------------------------------------
+// TVtUiActiveIdleFetManVariation::IsActiveIdleFetManSupported
+// -----------------------------------------------------------------------------
+//		
+TBool TVtUiActiveIdleFetManVariation::IsActiveIdleFetManSupported() const
+		{
+		return IsFeatureSupported( FeatureId() );	
+		}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/tvtuiaudiostate.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* 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:  Audio state class.
+*
+*/
+
+#include <cvtlogger.h>
+#include <cvtengmodel.h>
+
+#include "tvtuiaudiostate.h"
+#include "VtUiUtility.h"
+
+// -----------------------------------------------------------------------------
+// TVtUiAudioState::UpdateFlags
+// -----------------------------------------------------------------------------
+//
+void TVtUiAudioState::UpdateFlags()
+    {
+    __VTPRINTENTER( "AudioState.UpdateFlags" )
+    TInt avail( 0 );
+
+    VtUiUtility::GetAudioRoutingAvailability( iModel.Audio(), avail );
+
+    const TBool videoCallConnected ( iModel.Media().VideoCallConnected());
+    //Before update AudioRouting, video call state must to be checked.
+    //AudioRouting can not be changed if call is not in EConnected state.
+    if ( videoCallConnected )
+        {
+        __VTPRINT( DEBUG_GEN, " videoCallConnected " )
+        if ( avail & VtUiUtility::EDeactivateBtHandsfree )
+            {
+            SetFlag( ECanDeactivateBtHf );
+            }
+        if ( avail & VtUiUtility::EActivateBtHandsfree )
+            {
+            SetFlag( ECanActivateBtHf );
+            }
+        if ( avail & VtUiUtility::EDeactivateLoudspeaker )
+            {
+            SetFlag( ECanDeactivateLoudspeaker );
+            }
+        if ( avail & VtUiUtility::EActivateLoudspeaker )
+            {
+            SetFlag( ECanActivateLoudspeaker );
+            }
+        }
+
+    VtUiUtility::GetOutgoingMediaState( iModel.Media(), avail );
+
+    if ( avail & MVtEngMedia::EMediaAudio )
+        {
+        SetFlag( EIsAudio );
+        }
+
+    TInt status ( 0 );
+    iModel.Media().GetMediaState( MVtEngMedia::EMediaOutgoing, status );
+    if ( !(status & MVtEngMedia::EMediaAudioChannelOpen ) )
+        {
+        SetFlag( EIsAudioPermanentlyStopped );
+        }
+
+    __VTPRINTEXITR( "AudioState.UpdateFlags bits = %b", Value() )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/tvtuilocalvariation.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* 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:  Video Telephone local variation class.
+*
+*/
+
+
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h>
+#include <cvtlogger.h>
+
+#include "VideoTelephonyInternalCRKeys.h"
+#include "tvtuilocalvariation.h"
+#include "tVtuifeaturevariation.h"
+
+// TVtUiVariationBase
+
+// -----------------------------------------------------------------------------
+// TVtUiVariationBase::ReadL
+// -----------------------------------------------------------------------------
+//    
+void TVtUiVariationBase::ReadL( const TInt adefault ) 
+    {
+    __VTPRINTENTER( "VtUi.LocalVariation.ReadL" )
+    CRepository* repository = CRepository::NewL( Uid() );
+    TInt value( 0 );
+    if ( !repository->Get( Key(), value ) )
+        {
+        SetValue( value );
+        }
+    // incase of error    
+    else
+    	{ 
+    	// If default is set
+    	if ( adefault != -1 )
+    		{
+    		__VTPRINT2( DEBUG_GEN, "VtUi.LocalVariation.ReadL def=%d", adefault )    
+    		SetValue( adefault );    
+    		}
+    	}
+    delete repository;
+    __VTPRINTEXIT( "VtUi.LocalVariation.ReadL" )
+    }    
+// -----------------------------------------------------------------------------
+// TVtUiVariationBase::Value
+// -----------------------------------------------------------------------------
+//
+TUint32 TVtUiVariationBase::ReceiveValue() const
+	{
+	__VTPRINTENTER( "VtUi.LocalVariation.ReceiveValue" )
+	__VTPRINTEXIT( "VtUi.LocalVariation.ReceiveValue" )
+	return Value();
+	}
+	
+// TVtUiVideoTelephonyVariation
+// -----------------------------------------------------------------------------
+// TVtUiVideoTelephonyVariation::Uid
+// -----------------------------------------------------------------------------
+//
+const TUid& TVtUiVideoTelephonyVariation::Uid() const
+    {
+    return KCRUidVTVariation;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiVideoTelephonyVariation::Key
+// -----------------------------------------------------------------------------
+//
+TUint32 TVtUiVideoTelephonyVariation::Key() const
+    {
+    return KVTLocalVariationFlags;
+    }
+
+// TVtUiActiveIdleVariation
+// -----------------------------------------------------------------------------
+// TVtUiActiveIdleVariation::IsActiveIdleEnabled
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiActiveIdleVariation::IsActiveIdleEnabled() 
+    {
+    __VTPRINTENTER( "VtUi.LocalVariation.AI.IsActiveIdleEnabled" )
+    #ifndef RD_BOOT_CUSTOMIZABLE_AI
+    	TVtUiActiveIdleFetManVariation featman;
+    	TRAP_IGNORE( ReadL() );
+    	__VTPRINTEXIT( "VtUi.LocalVariation.AI.IsActiveIdleEnabled" )
+    	return featman.IsActiveIdleFetManSupported() && Value();
+    	// AI 2 implementation always true
+    #else
+    	__VTPRINTEXIT( "VtUi.LocalVariation.AI.IsActiveIdleEnabled" )
+    	return ETrue;
+    #endif // RD_BOOT_CUSTOMIZABLE_AI
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiActiveIdleVariation::Uid
+// -----------------------------------------------------------------------------
+//
+const TUid& TVtUiActiveIdleVariation::Uid() const
+    {
+    return KCRUidPersonalizationSettings;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiActiveIdleVariation::Key
+// -----------------------------------------------------------------------------
+//
+TUint32 TVtUiActiveIdleVariation::Key() const
+    {
+    return KSettingsActiveIdleState;
+    }
+    
+// TVtUiGsMuteVariation
+// -----------------------------------------------------------------------------
+// TVtUiGsMuteVariation::GsMuteState
+// -----------------------------------------------------------------------------
+//
+TUint32 TVtUiGsMuteVariation::GsMuteState() 
+    {
+    __VTPRINTENTER( "VtUi.LocalVariation.Gs.GsMuteState" )
+    TRAP_IGNORE( ReadL( KAllwaysQuery ) );
+    __VTPRINTEXIT( "VtUi.LocalVariation.Gs.GsMuteState" )
+    return ReceiveValue();
+    }
+// -----------------------------------------------------------------------------
+// TVtUiGsMuteVariation::Uid
+// -----------------------------------------------------------------------------
+//
+const TUid& TVtUiGsMuteVariation::Uid() const
+    {
+    return KCRUidTelephonySettings;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiActiveIdleVariation::Key
+// -----------------------------------------------------------------------------
+//
+TUint32 TVtUiGsMuteVariation::Key() const
+    {
+    return KSettingsVTVideoSending;
+    }
+// TVtUiToolbarVariation
+// -----------------------------------------------------------------------------
+// TVtUiToolbarVariation::NumberOfButtons
+// -----------------------------------------------------------------------------
+//
+TUint32 TVtUiToolbarVariation::NumberOfButtons() 
+    {
+    __VTPRINTENTER( "VtUi.LocalVariation.Tb.NumberOfButtons" )
+    TRAP_IGNORE( ReadL( KNumberOfTbButtons ) );
+    __VTPRINTEXIT( "VtUi.LocalVariation.Tb.NumberOfButtons" )
+    return ReceiveValue();
+    }
+// -----------------------------------------------------------------------------
+// TVtUiToolbarVariation::Uid
+// -----------------------------------------------------------------------------
+//
+const TUid& TVtUiToolbarVariation::Uid() const
+    {
+    return KCRUidVTConfiguration;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiActiveIdleVariation::Key
+// -----------------------------------------------------------------------------
+//
+TUint32 TVtUiToolbarVariation::Key() const
+    {
+    return KVTToolbarCommands;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/tvtuimediastate.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* 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:  Media state class.
+*
+*/
+
+
+#include <cvtlogger.h>
+#include <mvtengmedia.h>
+#include <mvtengcommandhandler.h>
+
+#include "tvtuimediastate.h"
+#include "VtUiUtility.h"
+
+// -----------------------------------------------------------------------------
+// TVtUiMediaState::UpdateFlags
+// -----------------------------------------------------------------------------
+//
+void TVtUiMediaState::UpdateFlags()
+    {
+    __VTPRINTENTER( "MediaState.UpdateFlags" )
+    TInt avail( 0 );
+
+    VtUiUtility::GetOutgoingMediaState( iMedia, avail );
+
+    if ( avail & MVtEngMedia::EMediaVideo )
+        {
+        SetFlag( EIsVideo );
+        }
+
+    if ( VtUiUtility::HasCameras( iMedia ) )
+        {
+        SetFlag( EHasCamera );
+        }
+
+    if ( VtUiUtility::IsFreezeSupported( iMedia ) )
+        {
+        SetFlag( EIsFreezeSupported );
+        }
+
+    if ( VtUiUtility::GetFreezeState( iMedia ) )
+        {
+        SetFlag( EIsFrozen );
+        }
+
+    MVtEngMedia::TShareObjectState shareObjectState;
+    VtUiUtility::GetObjectSharingState( iMedia, shareObjectState );
+
+    if ( shareObjectState == MVtEngMedia::ESharingImage )
+        {
+        SetFlag( EIsSharing );
+        }
+    else if ( ( shareObjectState == MVtEngMedia::EInitializingShareImage ) ||
+         ( shareObjectState == MVtEngMedia::EInitializingShareVideoClip ) )
+        {
+        SetFlag( EIsInitializingShare );
+        }
+    else if ( shareObjectState == MVtEngMedia::ENotAbleToShare )
+        {
+        SetFlag( EIsNotAbleToShare );
+        }
+    // Camera configuration
+
+    MVtEngMedia::TCameraId cameraId;
+    TInt err = iMedia.GetCurrentCameraId( cameraId );
+
+    // Don't care if camera is not ready, just what is selected camera
+    if ( err == KErrNone || err == KErrNotReady )
+        {
+        SetFlag( ( cameraId == MVtEngMedia::EPrimaryCamera ) ?
+            EIsPrimaryCameraInUse : EIsSecondaryCameraInUse );
+        }
+
+    TInt sourcesCaps( 0 );
+    iMedia.GetSourcesCaps( sourcesCaps );
+    if ( sourcesCaps & MVtEngMedia::ESourceCapsPrimaryCamera )
+        {
+        SetFlag( EHasPrimaryCamera );
+        }
+    if ( sourcesCaps & MVtEngMedia::ESourceCapsSecondaryCamera )
+        {
+        SetFlag( EHasSecondaryCamera );
+        }
+       
+    TInt status ( 0 ); 
+    iMedia.GetMediaState( MVtEngMedia::EMediaOutgoing, status );
+    if ( !( status & MVtEngMedia::EMediaVideoChannelOpen ) )
+        {        
+        SetFlag( EIsVideoPermanentlyStopped );
+        }      
+
+    __VTPRINTEXITR( "MediaState.UpdateFlags bits = %b", Value() )
+
+    // Video preferences
+/*
+    TInt caps( iCommandHandler.GetCommandCaps( KVtEngSetContrast ) );
+    if ( caps & MVtEngCommandHandler::EAttribEnabled )
+        {
+        SetFlag( EIsContrastSupported );
+        }
+
+    caps = iCommandHandler.GetCommandCaps( KVtEngSetBrightness );
+    if ( caps & MVtEngCommandHandler::EAttribEnabled )
+        {
+        SetFlag( EIsBrightnessSupported );
+        }
+
+    caps = iCommandHandler.GetCommandCaps( KVtEngSetWhiteBalance );
+    if ( caps & MVtEngCommandHandler::EAttribEnabled )
+        {
+        SetFlag( EIsWhiteBalanceSupported );
+        }
+
+    caps = iCommandHandler.GetCommandCaps( KVtEngSetColorTone );
+    if ( caps & MVtEngCommandHandler::EAttribEnabled )
+        {
+        SetFlag( EIsColorToneSupported );
+        }
+
+*/
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/commands/tvtuistates.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2006 - 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 UI states class.
+*
+*/
+
+
+#include <cvtengmodel.h>
+#include <mvtengcamerapreferences.h>
+#include <cvtlogger.h>
+
+#include "tvtuistates.h"
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::TVtUiStates
+// -----------------------------------------------------------------------------
+//
+TVtUiStates::TVtUiStates( CVtEngModel& aModel )
+    : iMediaState( aModel.Media(), aModel.CommandHandler() ), iAudioState( aModel ),
+    iModel( aModel ), iExecState( EExecStateStarting),
+    iCommandActivatingRefCount( 0 )
+    {
+    // get camera preferences
+    iCameraPref = static_cast<MVtEngCameraPreferences*>
+        ( iModel.Extension( KVtEngExtensionCameraPreferences ) );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::Update
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::Update()
+    {
+    iMediaState.Update();
+    iAudioState.Update();
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsColorToneSettingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsColorToneSettingAvailable() const
+    {
+    __VTPRINTENTER( "TVtUiStates.IsColorToneSettingAvailable" )
+    TUint32 supportedModes;
+    // Get supported whitebalance modes
+    if ( iCameraPref )
+    	{
+	    if ( iCameraPref->GetSupportedColorTones( supportedModes ) )
+	        {
+	        // error occured
+	        __VTPRINTEXIT( "TVtUiStates.IsColorToneSettingAvailableErr" )
+	        return EFalse;
+	        }
+    	}
+
+    // Clean the flag, flags that are possible are
+    // A bitfield of suported colortones
+    // ENormal         = 0x00,
+    // ESepia          = 0x01,
+    // EGrayscale      = 0x02,
+    // ENegative       = 0x04
+    supportedModes &= 0x07;
+
+    // If supported modes is 0 automatic,then return EFalse
+    return supportedModes;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsWhiteBalanceSettingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsWhiteBalanceSettingAvailable() const
+    {
+    __VTPRINTENTER( "TVtUiStates.IsWhiteBalanceSettingAvailable" )
+    TUint32 supportedModes;
+    // Get supported whitebalance modes
+    if ( iCameraPref )
+    	{
+	    if ( iCameraPref->GetSupportedWhiteBalanceModes( supportedModes ) )
+	        {
+	        // error occured
+	        __VTPRINTEXIT( "TVtUiStates.IsWhiteBalanceSettingAvailableErr" )
+	        return EFalse;
+	        }
+    	}
+    __VTPRINT2( DEBUG_GEN, "IsWhiteBalanceSettingAvailable=%d", supportedModes )
+    // If supported modes is 0 ,then return EFalse
+    __VTPRINTEXIT( "TVtUiStates.IsWhiteBalanceSettingAvailable2" )
+ 	return supportedModes;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsContrastSettingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsContrastSettingAvailable() const
+    {
+    __VTPRINTENTER( "TVtUiStates.IsContrastSettingAvailable" )
+    TBool ret( ETrue );
+    if ( iCameraPref )
+        {
+        TInt temp;
+	    ret = !iCameraPref->GetBrightness( temp );
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::IsBrightnessSettingAvailable
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStates::IsBrightnessSettingAvailable() const
+    {
+    __VTPRINTENTER( "TVtUiStates.IsBrightnessSettingAvailable" )
+    TBool ret( ETrue );
+    if ( iCameraPref )
+	     {
+	     TInt temp;
+	     ret = !iCameraPref->GetBrightness( temp );
+         }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetExecState
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetExecState( const TVtUiExecState aState )
+    {
+    iExecState = aState;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::SetIsCommandActivating
+// -----------------------------------------------------------------------------
+//
+void TVtUiStates::SetIsCommandActivating( TBool aSet )
+    {
+    if ( aSet )
+        {
+        iCommandActivatingRefCount++;
+        }
+    else if ( iCommandActivatingRefCount > 0 )
+        {
+        iCommandActivatingRefCount--;    
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStates::ExecState
+// -----------------------------------------------------------------------------
+//
+TVtUiStates::TVtUiExecState TVtUiStates::ExecState() const
+    {
+    return iExecState;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/compman/cvtuicomponentmanager.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,777 @@
+/*
+* 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:  Component manager implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicomponentmanager.h"
+#include "mvtuiwindowservereventobserver.h"
+#include "mvtuiresourcechangeobserver.h"
+#include "mvtuikeyeventobserver.h"
+#include "mvtuilayoutchangeobserver.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CmpByPtr
+// ---------------------------------------------------------------------------
+//
+template < class T >
+TInt CmpByPtr( const T& aObj1, const T& aObj2 )
+    {
+    return reinterpret_cast< TInt >( &aObj1 ) -
+        reinterpret_cast< TInt >( &aObj2 );
+    }
+
+// ---------------------------------------------------------------------------
+// FindByPtr
+// ---------------------------------------------------------------------------
+//
+template < class T >
+TInt FindByPtr( const TInt* aPtr, const T& aObj )
+    {
+    return *aPtr - reinterpret_cast< TInt >( &aObj );
+    }
+
+// ---------------------------------------------------------------------------
+// CmpMVtUiComponent
+// ---------------------------------------------------------------------------
+//
+TInt CmpMVtUiComponent( const MVtUiComponent& aC1, const MVtUiComponent& aC2 )
+    {
+    return ( aC1.ComponentId() - aC2.ComponentId() );
+    }
+
+// ---------------------------------------------------------------------------
+// CmpTVtUiComponentState
+// ---------------------------------------------------------------------------
+//
+TInt CmpTVtUiComponentState( const TVtUiComponentState& aC1,
+    const TVtUiComponentState& aC2 )
+    {
+    return ( aC1.Component().ComponentId() - aC2.Component().ComponentId() );
+    }
+
+// ---------------------------------------------------------------------------
+// CmpTVtUiComponentStateByKey
+// ---------------------------------------------------------------------------
+//
+TInt CmpTVtUiComponentStateByKey( const MVtUiComponent::TComponentId* aKey,
+    const TVtUiComponentState& aC )
+    {
+    return ( *aKey - aC.Component().ComponentId() );
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiComponentManager* CVtUiComponentManager::NewL()
+    {
+    __VTPRINTENTER( "CompMgr.NewL" )
+    CVtUiComponentManager* self = new ( ELeave ) CVtUiComponentManager();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "CompMgr.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::~CVtUiComponentManager
+// ---------------------------------------------------------------------------
+//
+CVtUiComponentManager::~CVtUiComponentManager()
+    {
+    __VTPRINTENTER( "CompMgr.~" )
+    iWsEventObservers.Close();
+    iResourceChangeObservers.Close();
+    iKeyEventObservers.Close();
+    iLayoutChangeObservers.Close();
+    iComponents.Close();
+    __VTPRINTEXIT( "CompMgr.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::HandleWsEventL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::HandleWsEventL( const TWsEvent& aEvent,
+    CCoeControl* aDestination )
+    {
+    for ( TInt i = iWsEventObservers.Count() - 1; i >= 0; i-- )
+        {
+        iWsEventObservers[ i ]->HandleWsEventL( aEvent, aDestination );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::HandleResourceChangeL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::HandleResourceChangeL( TInt aType )
+    {
+    for ( TInt i = iResourceChangeObservers.Count() - 1; i >= 0; i-- )
+        {
+        iResourceChangeObservers[ i ]->HandleResourceChangeL( aType );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager:OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CVtUiComponentManager::OfferKeyEventL(
+    const TKeyEvent& aEvent, TEventCode aCode )
+    {
+    TKeyResponse response( EKeyWasNotConsumed );
+    for ( TInt i = iKeyEventObservers.Count() - 1; i >= 0; i-- )
+        {
+        response = iKeyEventObservers[ i ]->OfferKeyEventL( aEvent, aCode );
+        if ( response == EKeyWasConsumed )
+            {
+            break;
+            }
+        }
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::HandleLayoutChangeL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::HandleLayoutChangeL()
+    {
+    for ( TInt i = iLayoutChangeObservers.Count() - 1; i >= 0; i-- )
+        {
+        iLayoutChangeObservers[ i ]->HandleLayoutChangeL();
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::ChangeWsEventRegistration
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::ChangeWsEventRegistration(
+    MVtUiWindowServerEventObserver& aObserver, TAction aAction )
+    {
+    return AddOrRemoveComponent( iWsEventObservers, &aObserver, aAction );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::ChangeResourceChangeRegistration
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::ChangeResourceChangeRegistration(
+    MVtUiResourceChangeObserver& aObserver, TAction aAction )
+    {
+    return AddOrRemoveComponent( iResourceChangeObservers, &aObserver,
+        aAction );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::ChangeKeyEventRegistration
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::ChangeKeyEventRegistration(
+    MVtUiKeyEventObserver& aObserver, TAction aAction )
+    {
+    return AddOrRemoveComponent( iKeyEventObservers, &aObserver, aAction );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::ChangeLayoutChangeRegistration
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::ChangeLayoutChangeRegistration(
+    MVtUiLayoutChangeObserver& aObserver, TAction aAction )
+    {
+    return AddOrRemoveComponent( iLayoutChangeObservers, &aObserver, aAction );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::ChangeComponentRegistration
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::ChangeComponentRegistration(
+    TVtUiComponentState& aComponentState, TAction aAction )
+    {
+    __VTPRINTENTER( "CompMgr.ChangeComponentRegistrationL" )
+    TInt result( KErrNone );
+    if ( aAction == ERegister )
+        {
+        result =
+            iComponents.InsertInOrder( &aComponentState,
+                ComponentStateOrder() );
+        }
+    else
+        {
+        TInt index( iComponents.FindInOrder(
+            &aComponentState, ComponentStateOrder() ) );
+        if ( index != KErrNotFound )
+            {
+            iComponents.Remove( index );
+            }
+        }
+    __VTPRINTEXITR( "CompMgr.ChangeComponentRegistrationL %d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::RequestActivationL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::RequestActivationL(
+    MVtUiComponent::TComponentId aId )
+    {
+    __VTPRINTENTER( "CompMgr.RequestActivationL" )
+    TInt index( iComponents.FindInOrder( aId, ::CmpTVtUiComponentStateByKey ) );
+    if ( index == KErrNotFound )
+        {
+        User::Leave( index );
+        }
+    else
+        {
+        TVtUiComponentState& state( *iComponents[ index ] );
+        if ( state.State() == TVtUiComponentState::EActive )
+            {
+            User::Leave( KErrNotReady );
+            }
+        else
+            {
+            DoActivationL( state, TVtUiComponentState::EActive );
+            }
+        }
+    __VTPRINTEXIT( "CompMgr.RequestActivationL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::DeActivateComponentL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::DeActivateComponentL(
+    MVtUiComponent::TComponentId aId )
+    {
+    __VTPRINTENTER( "CompMgr.DeActivateComponentL" )
+    TInt index( iComponents.FindInOrder( aId, ::CmpTVtUiComponentStateByKey ) );
+    if ( index == KErrNotFound )
+        {
+        User::Leave( index );
+        }
+    else
+        {
+        TVtUiComponentState& state( *iComponents[ index ] );
+        if ( state.State() == TVtUiComponentState::EInactive )
+            {
+            User::Leave( KErrNotReady );
+            }
+        else
+            {
+            DoDeactivationL( state, TVtUiComponentState::EInactive );
+            }
+        }
+    __VTPRINTEXIT( "CompMgr.DeActivateComponentL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::DoActivationL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::DoActivationL(
+	TVtUiComponentState& aComponentState,
+	TVtUiComponentState::TState aNewState )
+    {
+    __VTPRINTENTER( "CompMgr.DoActivationL" )
+    TStateList stateList;
+    ConstructStateListL( stateList );
+    TInt index( stateList.FindItem(
+    	aComponentState.Component().ComponentId() ) );
+    if ( index != KErrNotFound )
+        {
+        TStateListItem& sli( stateList.At( index ) );
+        TVtUiBlockListBitField exclList;
+        for ( TInt i = stateList.ItemCount() - 1; i >= 0; i-- )
+        	{
+        	TStateListItem& sli2( stateList.At( i ) );
+        	if ( sli2.ComponentId() != sli.ComponentId() )
+        		{
+        		if ( sli2.State() == TVtUiComponentState::EActive &&
+        			 !sli.BlockList().Contains( sli2.ComponentId() ) )
+        			{
+        			exclList.Union( sli2.BlockList() );
+        			}
+        		}
+        	}
+       	sli.SetRoot();
+        sli.SetState( aNewState );
+        CalculateActivationL( sli.BlockList(), exclList, stateList, EHide );
+        }
+    CommitStateListL( stateList );
+    __VTPRINTEXIT( "CompMgr.DoActivationL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::DoDeactivationL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::DoDeactivationL(
+    TVtUiComponentState& aComponentState,
+    TVtUiComponentState::TState aNewState )
+    {
+    __VTPRINTENTER( "CompMgr.DoDeactivationL" )
+    TStateList stateList;
+    ConstructStateListL( stateList );
+    TInt index( stateList.FindItem(
+        aComponentState.Component().ComponentId() ) );
+    if ( index != KErrNotFound )
+        {
+        TStateListItem& sli( stateList.At( index ) );
+        TVtUiBlockListBitField exclList;
+        if ( sli.State() == TVtUiComponentState::EActive )
+        	{
+	        for ( TInt i = stateList.ItemCount() - 1; i >= 0; i-- )
+	        	{
+	        	TStateListItem& sli2( stateList.At( i ) );
+	        	if ( sli2.ComponentId() != sli.ComponentId() )
+	        		{
+	        		if ( sli2.State() == TVtUiComponentState::EActive )
+	        			{
+	        			exclList.Union( sli2.BlockList() );
+	        			}
+	        		}
+	        	}
+        	}
+        sli.SetRoot();
+        sli.SetState( aNewState );
+        CalculateActivationL( sli.BlockList(), exclList, stateList, EShow );
+        }
+    CommitStateListL( stateList );
+    __VTPRINTEXIT( "CompMgr.DoDeactivationL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::CommitStateListL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::CommitStateListL( TStateList& aList )
+    {
+    __VTPRINTENTER( "CompMgr.CommitStateListL" )
+    // Sort list by component state. Components will first deactivated, then
+    // blocked and finally activated.
+    aList.Sort( TStateListItem::StateOrder() );
+    for ( TInt i = 0; i < aList.ItemCount(); i++ )
+        {
+        const TStateListItem& sli( aList.At( i ) );
+        TInt index( iComponents.FindInOrder( sli.ComponentId(),
+            ::CmpTVtUiComponentStateByKey ) );
+        if ( index != KErrNotFound )
+            {
+            TVtUiComponentState& cs( *iComponents[ index ] );
+            if ( cs.State() != sli.State() )
+                {
+                switch ( sli.State() )
+                    {
+                case TVtUiComponentState::EInactive:
+                    cs.DeActivateComponentL();
+                    break;
+
+                case TVtUiComponentState::EActive:
+                    cs.ActivateComponentL();
+                    break;
+
+                case TVtUiComponentState::EWaiting:
+                    cs.BlockComponentL();
+                    break;
+
+                default:
+                    User::Leave( KErrArgument );
+                    break;
+                    }
+                }
+            }
+        }
+    __VTPRINTEXIT( "CompMgr.CommitStateListL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::CalculateActivationL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::CalculateActivationL(
+    const TVtUiBlockList& aBlockList,
+    const TVtUiBlockList& aExclList,
+    TStateList& aStateList, TActivationAction aAction )
+    {
+    __VTPRINTENTER( "CompMgr.CalculateActivationL" )
+    __VTPRINT2( DEBUG_GEN, "aAction = %d", (TInt)aAction )
+    TVtUiBlockListBitField blockList;
+    CVtUiBlockListIterator* iterator = aBlockList.IteratorLC();
+    while ( iterator->HasNext() )
+        {
+        MVtUiComponent::TComponentId cid( iterator->Next() );
+		if ( aExclList.Contains( cid ) )
+			{
+			continue;
+			}
+        TInt index( aStateList.FindItem( cid ) );
+        if ( index != KErrNotFound )
+            {
+            TStateListItem& sli( aStateList.At( index ) );
+            __VTPRINT3( DEBUG_GEN, "@1, Id = %d, state = %d", (TInt)sli.ComponentId(), (TInt)sli.State() )
+            if ( !sli.IsRoot() )
+                {
+                if ( aAction == EShow )
+                    {
+                    // if action == EShow and component is being blocked,
+                    // then activate component
+                    if ( sli.State() == TVtUiComponentState::EWaiting )
+                        {
+                        sli.SetState( TVtUiComponentState::EActive );
+                        if ( !sli.IsVisited() )
+                            {
+                            blockList.Union( sli.BlockList() );
+                            }
+                        sli.SetVisited();
+                        }
+                    }
+                else // aAction == EHide
+                    {
+                    // if action == EHide and component is active, then
+                    // block component
+                    if ( sli.State() == TVtUiComponentState::EActive )
+                        {
+                        sli.SetState( TVtUiComponentState::EWaiting );
+                        if ( !sli.IsVisited() )
+                            {
+                            blockList.Union( sli.BlockList() );
+                            }
+                        sli.SetVisited();
+                        }
+                    }
+                }
+			__VTPRINT3( DEBUG_GEN, "@2, Id = %d, state = %d", (TInt)sli.ComponentId(), (TInt)sli.State() )
+            }
+        }
+    CleanupStack::PopAndDestroy(); // iterator
+    if ( !blockList.IsEmpty() )
+        {
+        CalculateActivationL( blockList, aExclList, aStateList,
+            ( aAction == EShow ) ? EHide : EShow );
+        }
+    __VTPRINTEXIT( "CompMgr.CalculateActivationL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::ConstructStateListL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::ConstructStateListL( TStateList& aList )
+    {
+    for ( TInt i = iComponents.Count() - 1; i >= 0; i-- )
+        {
+        TStateListItem sli( *iComponents[ i ] );
+        aList.AddItemL( sli );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::CVtUiComponentManager
+// ---------------------------------------------------------------------------
+//
+CVtUiComponentManager::CVtUiComponentManager()
+    : iWsEventObservers( 1 ), iResourceChangeObservers( 1 ),
+      iKeyEventObservers( 1 ),iLayoutChangeObservers( 1 ), iComponents( 1 )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::AddOrRemoveComponent
+// ---------------------------------------------------------------------------
+//
+template < class T >
+TInt CVtUiComponentManager::AddOrRemoveComponent( RPointerArray< T >& aArray,
+    T* aComponent, TAction aAction )
+    {
+    __VTPRINTENTER( "CompMgr.AddOrRemoveComponent" )
+    TInt result( KErrNone );
+    if ( aAction == ERegister )
+        {
+        result = aArray.InsertInOrder( aComponent, ::CmpByPtr );
+        }
+    else
+        {
+        TInt index( aArray.FindInOrder( aComponent, ::CmpByPtr ) );
+        if ( index != KErrNotFound )
+            {
+            aArray.Remove( index );
+            }
+        }
+    __VTPRINTEXITR( "CompMgr.AddOrRemoveComponent %d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::ComponentOrder
+// ---------------------------------------------------------------------------
+//
+TLinearOrder< MVtUiComponent > CVtUiComponentManager::ComponentOrder()
+    {
+    return TLinearOrder< MVtUiComponent >( ::CmpMVtUiComponent );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::ComponentStateOrder
+// ---------------------------------------------------------------------------
+//
+TLinearOrder< TVtUiComponentState > CVtUiComponentManager::ComponentStateOrder()
+    {
+    return TLinearOrder< TVtUiComponentState >( ::CmpTVtUiComponentState );
+    }
+
+// Implementation of CVtUiComponentManager::TStateListItem
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::TStateListItem
+// ---------------------------------------------------------------------------
+//
+CVtUiComponentManager::TStateListItem::TStateListItem(
+    const TVtUiComponentState& aState )
+    : iComponentId( aState.Component().ComponentId() ),
+      iState( aState.State() ), iIsRoot( EFalse ), iIsVisited( EFalse )
+    {
+    iBlockList.Union( aState.BlockList() );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::ComponentId
+// ---------------------------------------------------------------------------
+//
+MVtUiComponent::TComponentId
+CVtUiComponentManager::TStateListItem::ComponentId() const
+    {
+    return iComponentId;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::State
+// ---------------------------------------------------------------------------
+//
+TVtUiComponentState::TState CVtUiComponentManager::TStateListItem::State() const
+    {
+    return iState;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::SetState
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::TStateListItem::SetState(
+    TVtUiComponentState::TState aState )
+    {
+    iState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::BlockList
+// ---------------------------------------------------------------------------
+//
+const TVtUiBlockList& CVtUiComponentManager::TStateListItem::BlockList() const
+    {
+    return iBlockList;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::SetRoot
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::TStateListItem::SetRoot()
+    {
+    iIsRoot = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::IsRoot
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiComponentManager::TStateListItem::IsRoot() const
+    {
+    return iIsRoot;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::SetVisited
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::TStateListItem::SetVisited()
+    {
+    iIsVisited = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::IsVisited
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiComponentManager::TStateListItem::IsVisited() const
+    {
+    return iIsVisited;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::KeyOrder
+// ---------------------------------------------------------------------------
+//
+CVtUiComponentManager::TStateListItem::TKeyCmpFunc
+CVtUiComponentManager::TStateListItem::KeyOrder()
+    {
+    return KeyCmpFunc;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::LinearOrder
+// ---------------------------------------------------------------------------
+//
+TLinearOrder< CVtUiComponentManager::TStateListItem >
+CVtUiComponentManager::TStateListItem::LinearOrder()
+    {
+    return TLinearOrder< TStateListItem >( ItemCmpFunc );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::StateOrder
+// ---------------------------------------------------------------------------
+//
+TLinearOrder< CVtUiComponentManager::TStateListItem >
+CVtUiComponentManager::TStateListItem::StateOrder()
+    {
+    return TLinearOrder< TStateListItem >( StateCmpFunc );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::ItemCmpFunc
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::TStateListItem::ItemCmpFunc(
+    const TStateListItem& aItem1, const TStateListItem& aItem2 )
+    {
+    return ( aItem1.ComponentId() - aItem2.ComponentId() );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::KeyCmpFunc
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::TStateListItem::KeyCmpFunc(
+    const MVtUiComponent::TComponentId* aKey, const TStateListItem& aItem )
+    {
+    return ( *aKey - aItem.ComponentId() );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateListItem::StateCmpFunc
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::TStateListItem::StateCmpFunc(
+    const TStateListItem& aItem1, const TStateListItem& aItem2 )
+    {
+    return ( aItem1.State() - aItem2.State() );
+    }
+// Implementation of CVtUiComponentManager::TStateList
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateList::TStateList
+// ---------------------------------------------------------------------------
+//
+CVtUiComponentManager::TStateList::TStateList() : iItems( 1 )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateList::~TStateList
+// ---------------------------------------------------------------------------
+//
+CVtUiComponentManager::TStateList::~TStateList()
+    {
+    iItems.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateList::AddItemL
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::TStateList::AddItemL( TStateListItem& aItem )
+    {
+    iItems.InsertInOrderL( aItem, TStateListItem::LinearOrder() );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateList::ItemCount
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::TStateList::ItemCount() const
+    {
+    return iItems.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateList::FindItem
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiComponentManager::TStateList::FindItem(
+    MVtUiComponent::TComponentId aComponentId ) const
+    {
+    return iItems.FindInOrder( aComponentId, TStateListItem::KeyOrder() );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateList::At
+// ---------------------------------------------------------------------------
+//
+CVtUiComponentManager::TStateListItem&
+CVtUiComponentManager::TStateList::At( TInt aIndex )
+    {
+    return iItems[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateList::At
+// ---------------------------------------------------------------------------
+//
+const CVtUiComponentManager::TStateListItem&
+CVtUiComponentManager::TStateList::At( TInt aIndex ) const
+    {
+    return iItems[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiComponentManager::TStateList::Sort
+// ---------------------------------------------------------------------------
+//
+void CVtUiComponentManager::TStateList::Sort(
+    TLinearOrder< CVtUiComponentManager::TStateListItem > aOrder )
+    {
+    iItems.Sort( aOrder );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/compman/tvtuiblocklists.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* 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:  Component ID block lists implementation.
+*
+*/
+
+
+#include "tvtuiblocklists.h"
+
+const static TUint KNullBlockMask = 0;
+
+// Implementation for TVtUiBlockList
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockList::~TVtUiBlockList
+// -----------------------------------------------------------------------------
+//
+TVtUiBlockList::~TVtUiBlockList()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockList::TVtUiBlockList
+// -----------------------------------------------------------------------------
+//
+TVtUiBlockList::TVtUiBlockList()
+    {
+    }
+
+// Implementation for TVtUiBlockListBitField
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::TVtUiBlockListBitField
+// -----------------------------------------------------------------------------
+//
+TVtUiBlockListBitField::TVtUiBlockListBitField() : iBlockMask( KNullBlockMask )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::TVtUiBlockListBitField
+// -----------------------------------------------------------------------------
+//
+TVtUiBlockListBitField::TVtUiBlockListBitField( TUint aBlockMask )
+    : iBlockMask( aBlockMask )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::IsEmpty
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiBlockListBitField::IsEmpty() const
+    {
+    return !iBlockMask;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::Contains
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiBlockListBitField::Contains( MVtUiComponent::TComponentId aId ) const
+    {
+    return ( iBlockMask & aId ) && ( aId != MVtUiComponent::EComponentIdNull );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::Union
+// -----------------------------------------------------------------------------
+//
+void TVtUiBlockListBitField::Union( const TVtUiBlockList& aBlockList )
+    {
+    iBlockMask |=
+        static_cast< const TVtUiBlockListBitField& >( aBlockList ).iBlockMask;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::IteratorLC
+// -----------------------------------------------------------------------------
+//
+CVtUiBlockListIterator* TVtUiBlockListBitField::IteratorLC() const
+    {
+    return TVtUiBlockListBitField::CVtUiBListIteratorBF::NewLC( iBlockMask );
+    }
+
+// Implementation for TVtUiBlockListBitField::CVtUiBListIteratorBF
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::CVtUiBListIteratorBF::NewLC
+// -----------------------------------------------------------------------------
+//
+TVtUiBlockListBitField::CVtUiBListIteratorBF*
+TVtUiBlockListBitField::CVtUiBListIteratorBF::NewLC(
+    const TUint& aBlockMask )
+    {
+    CVtUiBListIteratorBF* self = new ( ELeave )
+        CVtUiBListIteratorBF( aBlockMask );
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::CVtUiBListIteratorBF::CVtUiBListIteratorBF
+// -----------------------------------------------------------------------------
+//
+TVtUiBlockListBitField::CVtUiBListIteratorBF::CVtUiBListIteratorBF(
+    const TUint& aBlockMask ) : iBlockMask( aBlockMask ), iCurrent( 1 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::CVtUiBListIteratorBF::HasNext
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiBlockListBitField::CVtUiBListIteratorBF::HasNext() const
+    {
+    return ( iCurrent && ( iCurrent <= iBlockMask ) );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiBlockListBitField::CVtUiBListIteratorBF::Next
+// -----------------------------------------------------------------------------
+//
+MVtUiComponent::TComponentId
+TVtUiBlockListBitField::CVtUiBListIteratorBF::Next()
+    {
+    MVtUiComponent::TComponentId id( MVtUiComponent::EComponentIdNull );
+
+    while ( HasNext() && !( iCurrent & iBlockMask ) )
+        {
+        iCurrent <<= 1;
+        }
+
+    if ( iCurrent )
+        {
+        id = static_cast< MVtUiComponent::TComponentId >( iCurrent );
+        }
+
+	iCurrent <<= 1;
+
+    return id;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/compman/tvtuicomponentstate.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* 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:  Component state base class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "tvtuicomponentstate.h"
+
+// -----------------------------------------------------------------------------
+// TVtUiComponentState::ActivateComponentL
+// -----------------------------------------------------------------------------
+//
+void TVtUiComponentState::ActivateComponentL()
+    {
+    __VTPRINTENTER( "CompState.ActivateComponentL" )
+    iComponent.DoActivateL();
+    iState = EActive;
+    __VTPRINTEXITR( "CompState.ActivateComponentL %d", iState )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiComponentState::BlockComponentL
+// -----------------------------------------------------------------------------
+//
+void TVtUiComponentState::BlockComponentL()
+    {
+    __VTPRINTENTER( "CompState.BlockComponentL" )
+    iComponent.DoDeactivateL();
+    iState = EWaiting;
+    __VTPRINTEXITR( "CompState.BlockComponentL %d", iState )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiComponentState::DeActivateComponentL
+// -----------------------------------------------------------------------------
+//
+void TVtUiComponentState::DeActivateComponentL()
+    {
+    __VTPRINTENTER( "CompState.DeActivateComponentL" )
+    iComponent.DoDeactivateL();
+    iState = EInactive;
+    __VTPRINTEXITR( "CompState.DeActivateComponentL %d", iState )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiComponentState::State
+// -----------------------------------------------------------------------------
+//
+TVtUiComponentState::TState TVtUiComponentState::State() const
+    {
+    return iState;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiComponentState::Component
+// -----------------------------------------------------------------------------
+//
+const MVtUiComponent& TVtUiComponentState::Component() const
+    {
+    return iComponent;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiComponentState::BlockMask
+// -----------------------------------------------------------------------------
+//
+const TVtUiBlockList& TVtUiComponentState::BlockList() const
+    {
+    return iBlockList;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiComponentState::BlockMask
+// -----------------------------------------------------------------------------
+//
+TVtUiBlockList& TVtUiComponentState::BlockList()
+    {
+    return iBlockList;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiComponentState::InformDeactivation
+// -----------------------------------------------------------------------------
+//
+TVtUiComponentState::TVtUiComponentState( MVtUiComponent& aComponent,
+    const TVtUiBlockList& aBlockList )
+    : iComponent( aComponent ), iState( EInactive )
+    {
+    __VTPRINTENTER( "CompState.ctor" )
+    
+    if( MVtUiComponent::EComponentIdToolbar == iComponent.ComponentId() )
+        return;
+        
+    iBlockList.Union( aBlockList );
+    __VTPRINTEXIT( "CompState.ctor" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/cvtuiappshutter.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,257 @@
+/*
+* 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:  Class responsible for application exit.
+*
+*/
+
+
+#include "cvtuiappshutter.h"
+#include "mvtuishutterobserver.h"
+#include "mvtuistatecontext.h"
+#include "mvtuinumbersource.h"
+#include "tvtuilocalvariation.h"
+#include <cvtlogger.h>
+#include <eikenv.h>
+#include <aknutils.h>
+#include <aknnotewrappers.h>
+#include <stringloader.h>
+
+// singleton instance
+static CVtUiAppShutter* iAppShutter = NULL;
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::InstanceL
+// -----------------------------------------------------------------------------
+//
+CVtUiAppShutter* CVtUiAppShutter::InstanceL(
+    MVtUiShutterObserver& aObserver )
+    {
+    __VTPRINTENTER( "CVtUiAppShutter.InstanceL" )
+    if ( iAppShutter == NULL )
+        {
+        iAppShutter = new ( ELeave )
+            CVtUiAppShutter( aObserver );
+        }
+    __VTPRINTEXIT( "CVtUiAppShutter.InstanceL" )
+    return iAppShutter;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::CVtUiAppShutter
+// -----------------------------------------------------------------------------
+//
+CVtUiAppShutter::CVtUiAppShutter(
+    MVtUiShutterObserver& aObserver ) :
+    iPendingStateFlags( 0 ),
+    iObserver( aObserver )
+    {
+    iPendingStateFlags.Set( EShutterWaitingStart );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::~CVtUiAppShutter
+// -----------------------------------------------------------------------------
+//
+CVtUiAppShutter::~CVtUiAppShutter()
+    {
+    __VTPRINTENTER( "CVtUiAppShutter.~" )
+    // mark singleton null
+    iAppShutter = NULL;
+    delete iCallback;
+    __VTPRINTEXIT( "CVtUiAppShutter.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::StartShutdown
+// Called when application may exit, i.e TVtUiStateResetting state receives
+// ShutdownDoneL message.
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppShutter::StartShutdown()
+    {
+    __VTPRINTENTER( "CVtUiAppShutter.StartShutdown" )
+    iPendingStateFlags.Clear( EShutterWaitingStart );
+    ShutdownIfReadyAndDestroy();
+    __VTPRINTEXITR( "CVtUiAppShutter.StartShutdown flags %d",
+        iPendingStateFlags.Value() )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::ShutdownWithEmergencyCallL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppShutter::ShutdownWithEmergencyCallL(
+    MVtUiStateContext& aStateContext )
+    {
+    // Leaves if other than emergency number is supplied...
+    CEmergencyCaller* emergency = CEmergencyCaller::DialEmergencyL( *this,
+        aStateContext );
+    // therefore the flag and member variable must not be set before above call.
+    iPendingStateFlags.Set( EShutterWaitingEmergencyCallback );
+    iEmergencyCaller = emergency;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::EmergencyCallDoneL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppShutter::EmergencyCallDoneL()
+    {
+    // Destruction of emergency handler is done asynchrounously to avoid
+    // problems that might
+    iPendingStateFlags.Clear( EShutterWaitingEmergencyCallback );
+    TCallBack cb( EmergencyResponseCallback, this );
+    EnqueCallbackL( cb );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::EmergencyResponseCallback
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiAppShutter::EmergencyResponseCallback( TAny* aAny )
+    {
+    CVtUiAppShutter* shutter =
+        reinterpret_cast<CVtUiAppShutter*>( aAny );
+    // delete callback
+    delete shutter->iCallback;
+    shutter->iCallback = NULL;
+    // delete emergency caller
+    delete shutter->iEmergencyCaller;
+    shutter->iEmergencyCaller = NULL;
+
+    shutter->ShutdownIfReadyAndDestroy();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::EnqueCallbackL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppShutter::EnqueCallbackL( TCallBack& aCallback )
+    {
+    __VTPRINTENTER( "CVtUiAppShutter.EnqueAsyncCommsCommandL" )
+    if ( !iCallback )
+        {
+        iCallback = new ( ELeave ) CAsyncCallBack( aCallback, EPriorityHigh );
+        }
+    iCallback->Call();
+    __VTPRINTEXIT( "CVtUiAppShutter.EnqueAsyncCommsCommandL" )
+    __VTPRINTEXIT( "CVtUiAppShutter.EnqueCallbackL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::ShutdownIfReadyAndDestroy
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppShutter::ShutdownIfReadyAndDestroy()
+    {
+    __VTPRINTENTER( "CVtUiAppShutter.ShutdownIfReadyAndDestroy" )
+    __VTPRINT2( DEBUG_GEN, "  shutter flags %d",
+        iPendingStateFlags.Value() );
+    if ( !iPendingStateFlags.Value() )
+        {
+        iObserver.HandleShutdownReady();
+        delete this;
+        }
+    __VTPRINTEXIT( "CVtUiAppShutter.ShutdownIfReadyAndDestroy" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::CEmergencyCaller::DialEmergencyL
+// -----------------------------------------------------------------------------
+//
+CVtUiAppShutter::CEmergencyCaller* CVtUiAppShutter::CEmergencyCaller::
+    DialEmergencyL(
+    CVtUiAppShutter& aObserver,
+    MVtUiStateContext& aStateContext )
+    {
+    __VTPRINTENTER( "CEmergencyCaller.DialEmergencyL" )
+    CVtUiAppShutter::CEmergencyCaller* self = new ( ELeave )
+        CVtUiAppShutter::CEmergencyCaller( aObserver, aStateContext );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __VTPRINTEXIT( "CEmergencyCaller.DialEmergencyL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::CEmergencyCaller::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppShutter::CEmergencyCaller::ConstructL()
+    {
+    __VTPRINTENTER( "CEmergencyCaller.ConstructL" )
+    const MVtUiNumberSource* source = iStateContext.NumberSource();
+    if ( source )
+        {
+        source->GetContents( iNumber );
+        AknTextUtils::ConvertDigitsTo( iNumber, EDigitTypeWestern );
+        User::LeaveIfError( iServer.Connect() );
+    	iEmergency = CPhCltEmergencyCall::NewL( this );
+        TBool isEmergenyNumber = EFalse;
+        const TInt err =
+        	iEmergency->FindEmergencyPhoneNumber( iNumber, isEmergenyNumber );
+
+        if ( err == KErrNone && isEmergenyNumber )
+            {
+            __VTPRINT( DEBUG_GEN, "iEmergency->DialEmergencyCallL")
+            iEmergency->DialEmergencyCallL( iNumber );
+            }
+        if ( !isEmergenyNumber || err )
+            {
+            __VTPRINT( DEBUG_GEN, "  not EC number => leave" )
+            // Not an emergency call number. Abort emergency call process.
+            User::Leave( KErrArgument );
+            }
+        }
+    __VTPRINTEXIT( "CEmergencyCaller.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::CEmergencyCaller::CEmergencyCaller
+// -----------------------------------------------------------------------------
+//
+CVtUiAppShutter::CEmergencyCaller::CEmergencyCaller(
+    CVtUiAppShutter& aObserver,
+    MVtUiStateContext& aStateContext ) :
+    iObserver( aObserver ),
+    iStateContext( aStateContext )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::CEmergencyCaller::~CEmergencyCaller
+// -----------------------------------------------------------------------------
+//
+CVtUiAppShutter::CEmergencyCaller::~CEmergencyCaller()
+    {
+    __VTPRINTENTER( "CEmergencyCaller.~" )
+    delete iEmergency;
+    iServer.Close();
+    __VTPRINTEXIT( "CEmergencyCaller.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiAppShutter::CEmergencyCaller::HandleEmergencyDialL
+// -----------------------------------------------------------------------------
+//
+void CVtUiAppShutter::CEmergencyCaller::HandleEmergencyDialL(
+    const TInt )
+    {
+    __VTPRINTENTER( "CEmergencyCaller.HandleEmergencyDialL" )
+    iObserver.EmergencyCallDoneL();
+    __VTPRINTEXIT( "CEmergencyCaller.HandleEmergencyDialL" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/cvtuidtmfbuffer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,218 @@
+/*
+* 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:   Implementation of DTMF buffer class
+*
+*/
+
+
+#include <coemain.h>
+#include <cvtlogger.h>
+#include "cvtuidtmfbuffer.h"
+#include "tvtuiwsevent.h"
+#include "VtUiUtility.h"
+
+// Time after which buffer will be automatically reset (4 seconds).
+const TInt KBufferResetInterval = 4 * 1000000;
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiDTMFBuffer* CVtUiDTMFBuffer::NewL( const CCoeEnv& aCoeEnv )
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.NewL" )
+    CVtUiDTMFBuffer* self = new ( ELeave ) CVtUiDTMFBuffer( aCoeEnv );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::~CVtUiDTMFBuffer
+// ---------------------------------------------------------------------------
+//
+CVtUiDTMFBuffer::~CVtUiDTMFBuffer()
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.~" )
+    Cancel();
+    iTimer.Close();
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::Append
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiDTMFBuffer::Append( TChar aChar )
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.Append" )
+    TBool result( EFalse );
+    if ( VtUiUtility::IsDTMFCharacter( aChar ) )
+        {
+        if ( iBuffer.Length() == iBuffer.MaxLength() )
+            {
+            iBuffer = iBuffer.Right( 1 );
+            }
+        iBuffer.Append( aChar );
+        StartTimer();
+        result = ETrue;
+        }
+    __VTPRINTEXITR( "CVtUiDTMFBuffer.Append %d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::Reset
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::Reset()
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.Reset" )
+    Cancel();
+    ResetBuffer();
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.Reset" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::Activate
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::Activate()
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.Activate" )
+    TVtUiWsEvent< MVtUiNumberSource > event(
+        EVtUiWsEventNumberSourceActivate, this );
+    iCoeEnv.WsSession().SendEventToWindowGroup(
+        iCoeEnv.RootWin().WindowGroupId(), event );
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.Activate" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::Deactivate
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::Deactivate()
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.Deactivate" )
+    TVtUiWsEvent< MVtUiNumberSource > event(
+        EVtUiWsEventNumberSourceDeactivate, this );
+    iCoeEnv.WsSession().SendEventToWindowGroup(
+        iCoeEnv.RootWin().WindowGroupId(), event );
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.Deactivate" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::GetContents
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::GetContents( TDes& aContents ) const
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.GetContents" )
+    const TInt length( aContents.MaxLength() < iBuffer.Length() ?
+            aContents.MaxLength() : iBuffer.Length() );
+    if ( length )
+        {
+        aContents = iBuffer.Mid( 0, length );
+        }
+    else
+        {
+        aContents.Zero();
+        }
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.GetContents" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::DoCancel()
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.DoCancel" )
+    iTimer.Cancel();
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.DoCancel" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::RunL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::RunL()
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.RunL" )
+    TimerExpired( iStatus.Int() );
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.RunL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::CVtUiDTMFBuffer
+// ---------------------------------------------------------------------------
+//
+CVtUiDTMFBuffer::CVtUiDTMFBuffer( const CCoeEnv& aCoeEnv ) :
+    CActive( EPriorityStandard ), iCoeEnv( aCoeEnv )
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.ctor" )
+    CActiveScheduler::Add( this );
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.ConstructL" )
+    User::LeaveIfError( iTimer.CreateLocal() );
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.ConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::StartTimer
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::StartTimer()
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.StartTimer" )
+    Cancel();
+    SetActive();
+    iTimer.After( iStatus, KBufferResetInterval );
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.StartTimer" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::TimerExpired
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::TimerExpired( TInt aError )
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.TimerExpired" )
+    if ( aError != KErrCancel )
+        {
+        ResetBuffer();
+        }
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.TimerExpired" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDTMFBuffer::ResetBuffer
+// ---------------------------------------------------------------------------
+//
+void CVtUiDTMFBuffer::ResetBuffer()
+    {
+    __VTPRINTENTER( "CVtUiDTMFBuffer.ResetBuffer" )
+    iBuffer.Zero();
+    __VTPRINTEXIT( "CVtUiDTMFBuffer.ResetBuffer" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/cvtuivideocontrolbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,781 @@
+/*
+* 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:  Video control base class implementation.
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    <featmgr.h>
+#include    <aknsdrawutils.h>
+#include    <aknsutils.h>
+#include    <aknbiditextutils.h>
+#include    <stringloader.h>
+#include    <videotelui.rsg>
+
+#include     <aknsbasicbackgroundcontrolcontext.h>
+#include    <aknstatuspaneutils.h>
+#include    "cvtuivideocontrolbase.h"
+#include    "mvtuicomponentmanager.h"
+#include    "VtUiLayout.h"
+
+// CONSTANTS
+
+// Index of white color.
+const TInt KVtUiColorWhite = 0;
+
+// Amount of characters reserved per line.
+const TInt KVtUiWaitingExtraSpacePerLine = KAknBidiExtraSpacePerLine + 1;
+
+// Amount of lines used for 'waiting text'
+const TInt KVtUiWaitingLineCount = 2;
+
+// Implementation of CVtUiVideoControlBase
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::~CVtUiVideoControlBase
+// ---------------------------------------------------------------------------
+//
+CVtUiVideoControlBase::~CVtUiVideoControlBase()
+    {
+    __VTPRINTENTER( "VidCtrlBase.~" )
+    AknsUtils::DeregisterControlPosition( this );
+    iStreamBitmap = NULL; // not owned.
+    delete iWaitingTextWrappedArray;
+    delete iWaitingTextWrapped;
+    delete iBgContext;
+    __VTPRINTEXIT( "VidCtrlBase.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::CVtUiVideoControlBase
+// ---------------------------------------------------------------------------
+//
+CVtUiVideoControlBase::CVtUiVideoControlBase(
+    CVtUiBitmapManager& aBitmapManager ) :
+    iBitmapManager( &aBitmapManager )
+    {
+    __VTPRINTENTER( "VidCtrlBase.ctor" )
+    __VTPRINTEXIT( "VidCtrlBase.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::BaseConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::BaseConstructL()
+    {
+    __VTPRINTENTER( "VidCtrlBase.BaseConstructL" )
+    iBgContext = CAknsBasicBackgroundControlContext::NewL(
+                       KAknsIIDQsnBgAreaMain, Rect(), ETrue );
+    CreateWindowL();
+    SetExtent( TPoint(), TSize() );
+    ActivateL();
+    // Disable fading when using DP (eliminates nasty color error)
+    if ( FeatureManager::FeatureSupported( KFeatureIdDisplayPost ) )
+        {
+        Window().SetNonFading( ETrue );
+        }
+    WrapOnDemand();
+    __VTPRINTEXIT( "VidCtrlBase.BaseConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::SetRenderingHint
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::SetRenderingHint( TRenderingHint aHint )
+    {
+    __VTPRINTENTER( "VidCtrlBase.SetRenderingHint" )
+    __VTPRINT2( DEBUG_GEN, "VidCtrlBase.SetRenderingHint aHint = %d", aHint )
+    iHints.Set( aHint );
+    __VTPRINTEXIT( "VidCtrlBase.SetRenderingHint" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::ClearRenderingHint
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::ClearRenderingHint( TRenderingHint aHint )
+    {
+    __VTPRINTENTER( "VidCtrlBase.ClearRenderingHint" )
+    __VTPRINT2( DEBUG_GEN, "VidCtrlBase.ClearRenderingHint aHint = %d", aHint )
+    iHints.Clear( aHint );
+    __VTPRINTEXIT( "VidCtrlBase.ClearRenderingHint" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::BitmapManager
+// ---------------------------------------------------------------------------
+//
+CVtUiBitmapManager& CVtUiVideoControlBase::BitmapManager() const
+    {
+    return *iBitmapManager;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::Bitmap
+// ---------------------------------------------------------------------------
+//
+CFbsBitmap* CVtUiVideoControlBase::Bitmap( TVtUiBitmapPoolId aId ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.Bitmap" )
+    CFbsBitmap* bitmap = NULL;
+    iBitmapManager->GetBitmap( aId, bitmap );
+    __VTPRINTEXITR( "VidCtrlBase.Bitmap %d", TInt( bitmap ) )
+    return bitmap;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::AdjustPointForDP
+// ---------------------------------------------------------------------------
+//
+TPoint CVtUiVideoControlBase::AdjustPointForDP( const TPoint aPoint ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.AdjustPointForDP" )
+    TPoint result( aPoint );
+    if ( FeatureManager::FeatureSupported( KFeatureIdDisplayPost ) )
+        {
+        if ( result.iX & 1 )
+            {
+            result.iX++;
+            }
+        }
+    __VTPRINTEXIT( "VidCtrlBase.AdjustPointForDP" )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::AdjustRectForDP
+// ---------------------------------------------------------------------------
+//
+TRect CVtUiVideoControlBase::AdjustRectForDP( const TRect aRect ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.AdjustRectForDP" )
+    TRect result( aRect );
+    if ( FeatureManager::FeatureSupported( KFeatureIdDisplayPost ) )
+        {
+        if ( result.iTl.iX & 1 )
+            {
+            result.Move( 1, 0 );
+            result.SetWidth( Max( 0, result.Width() - 1 ) );
+            }
+        if ( result.Width() & 1 )
+            {
+            result.SetWidth( result.Width() - 1 );
+            }
+        }
+    __VTPRINTEXIT( "VidCtrlBase.AdjustRectForDP" )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::WaitingTextLayout
+// ---------------------------------------------------------------------------
+//
+TAknTextLineLayout CVtUiVideoControlBase::WaitingTextLayout( TInt )
+    {
+    return TAknTextLineLayout();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::HandleSizeChanged
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::HandleSizeChanged()
+    {
+    __VTPRINTENTER( "VidCtrlBase.HandleSizeChanged" )
+    __VTPRINTEXIT( "VidCtrlBase.HandleSizeChanged" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DrawSkinnedBackground
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::DrawSkinnedBackground( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.DrawSkinnedBackground" )
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+    AknsDrawUtils::Background( skin, cc, this, aGc, Rect() );
+    __VTPRINTEXIT( "VidCtrlBase.DrawSkinnedBackground" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVideoControlBase::MopSupplyObject
+// -----------------------------------------------------------------------------
+//
+
+TTypeUid::Ptr CVtUiVideoControlBase::MopSupplyObject( TTypeUid aId )
+ {
+     __VTPRINTENTER( "VidCtrlBase.MopSupplyObject" )
+ // Required during rendering of the background skin in Draw()
+ if (aId.iUid == MAknsControlContext::ETypeId)
+     {
+      __VTPRINTEXIT( "VidCtrlBase.MopSupplyObject.1" )
+     return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+     }
+    __VTPRINTEXIT( "VidCtrlBase.MopSupplyObject.2" )
+ return CCoeControl::MopSupplyObject( aId );
+ }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DrawColoredBackground
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::DrawColoredBackground( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.DrawColoredBackground" )
+    aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+    aGc.SetPenStyle( CGraphicsContext::ENullPen );
+    aGc.SetBrushColor( AKN_LAF_COLOR( KVtUiColorWhite ) );
+    aGc.DrawRect( Rect() );
+    aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
+    __VTPRINTEXIT( "VidCtrlBase.DrawColoredBackground" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DrawWaitingText
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiVideoControlBase::DrawWaitingText( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.DrawWaitingText" )
+    const TInt count( iWaitingTextWrappedArray->Count() );
+    if ( count > 0 )
+        {
+        aGc.SetClippingRect( StreamClippingRect() );
+        aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        TRgb color( iWaitingTextLine1Layout.Color() );
+        AknsUtils::GetCachedColor(
+            skin,
+            color,
+            KAknsIIDQsnTextColors,
+            EAknsCIQsnTextColorsCG6 );
+        iWaitingTextLine1Layout.DrawText(
+            aGc,
+            iWaitingTextWrappedArray->At( 0 ), // first line
+            EFalse,
+            color );
+        if ( count > 1 ) // two lines
+            {
+            iWaitingTextLine2Layout.DrawText(
+                aGc,
+                iWaitingTextWrappedArray->At( 1 ), // second line
+                EFalse,
+                color );
+            }
+        }
+    __VTPRINTEXITR( "VidCtrlBase.DrawWaitingText %d", ETrue )
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DrawBlind
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::DrawBlind( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.DrawBlind" )
+    CFbsBitmap* icon = BlindImage();
+    if ( icon )
+        {
+        CFbsBitmap* mask = BlindMask();
+        if ( mask )
+            {
+            aGc.BitBltMasked(
+                BlindBlitPosition(),
+                icon,
+                TRect( icon->SizeInPixels() ),
+                mask,
+                ETrue );
+            }
+        else
+            {
+            aGc.BitBlt(
+                BlindBlitPosition(),
+                icon );
+            }
+        }
+    __VTPRINTEXIT( "VidCtrlBase.DrawBlind" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DrawStream
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::DrawStream( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.DrawStream" )
+    aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
+    aGc.SetClippingRect( StreamClippingRect() );
+    aGc.BitBlt( StreamBlitPosition(), iStreamBitmap );
+    aGc.CancelClippingRect();
+    __VTPRINTEXIT( "VidCtrlBase.DrawStream" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::StreamBlitPosition
+// ---------------------------------------------------------------------------
+//
+TPoint CVtUiVideoControlBase::StreamBlitPosition() const
+    {
+    __VTPRINTENTER( "VidCtrlBase.StreamBlitPosition" )
+    __VTPRINTEXIT( "VidCtrlBase.StreamBlitPosition" )
+    return Rect().iTl;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::StreamClippingRect
+// ---------------------------------------------------------------------------
+//
+TRect CVtUiVideoControlBase::StreamClippingRect() const
+    {
+    __VTPRINTENTER( "VidCtrlBase.StreamClippingRect" )
+    __VTPRINTEXIT( "VidCtrlBase.StreamClippingRect" )
+    return Rect();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::BlindImage
+// ---------------------------------------------------------------------------
+//
+CFbsBitmap* CVtUiVideoControlBase::BlindImage() const
+    {
+    __VTPRINTENTER( "VidCtrlBase.BlindImage" )
+    __VTPRINTEXIT( "VidCtrlBase.BlindImage" )
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::BlindMask
+// ---------------------------------------------------------------------------
+//
+CFbsBitmap* CVtUiVideoControlBase::BlindMask() const
+    {
+    __VTPRINTENTER( "VidCtrlBase.BlindMask" )
+    __VTPRINTEXIT( "VidCtrlBase.BlindMask" )
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::BlindBlitPosition
+// ---------------------------------------------------------------------------
+//
+TPoint CVtUiVideoControlBase::BlindBlitPosition() const
+    {
+    __VTPRINTENTER( "VidCtrlBase.BlindBlitPosition" )
+    __VTPRINTEXIT( "VidCtrlBase.BlindBlitPosition" )
+    return TPoint();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::Reset
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::Reset()
+    {
+    __VTPRINTENTER( "VidCtrlBase.Reset" )
+    iBlindStatus = EFalse;
+    iStreamBitmap = NULL;
+    iWaitingTextShow = EFalse;
+    __VTPRINTEXIT( "VidCtrlBase.Reset" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::SetBlind
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::SetBlind( TBool aBlindStatus )
+    {
+    __VTPRINTENTER( "VidCtrlBase.SetBlind" )
+    if ( iBlindStatus != aBlindStatus )
+        {
+        iBlindStatus = aBlindStatus;
+        DrawNow();
+        }
+    __VTPRINTEXITR( "VidCtrlBase.SetBlind %d", iBlindStatus )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVideoControlBase::IsAlphaZero
+// Checks if the alpha has been set to zero.
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiVideoControlBase::IsAlphaZero() const
+    {
+    __VTPRINTENTER( "VidCtrlBase.IsAlphaZero" )
+    TBool isZero( EFalse );
+    const CWsScreenDevice& sdev(
+        *static_cast< CWsScreenDevice*>( SystemGc().Device() ) );
+    if ( sdev.DisplayMode() == EColor16MA )
+        {
+        TRgb color;
+        TPoint point( Rect().Center() );
+        sdev.GetPixel( color, point );
+        isZero = ( color.Alpha() == 0 );
+        }
+    __VTPRINTEXITR( "VidCtrlBase.IsAlphaZero %d", isZero )
+    return isZero;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVideoControlBase::SetAlpha
+// Sets alpha.
+// -----------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::SetAlpha( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.SetAlpha" )
+    aGc.SetDrawMode( CGraphicsContext::EDrawModeOR );
+    aGc.SetBrushColor( TRgb( 0, 0, 0, 255 ) );
+    aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+    aGc.Clear();
+    aGc.Reset();
+    __VTPRINTEXIT( "VidCtrlBase.SetAlpha" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::SetStreamBitmap
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::SetStreamBitmap( CFbsBitmap* aStreamBitmap )
+    {
+    __VTPRINTENTER( "VidCtrlBase.SetStreamBitmap" )
+    __VTPRINT2( DEBUG_GEN, "VidCtrlBase.SetStreamBitmap %d",
+        (TInt) aStreamBitmap )
+    const CFbsBitmap* oldBitmap( iStreamBitmap );
+    iStreamBitmap = aStreamBitmap;
+    iSetAlpha = IsAlphaZero();
+    if ( iStreamBitmap )
+        {
+        RedrawStream();
+        }
+    else if ( oldBitmap )
+        {
+        DrawNow();
+        }
+    __VTPRINTEXIT( "VidCtrlBase.SetStreamBitmap" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::SetStreamBitmapReserve
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::SetStreamBitmapReserve(
+    CFbsBitmap* aStreamBitmap )
+    {
+    __VTPRINTENTER( "VidCtrlBase.SetStreamBitmapReserve" )
+    __VTPRINT2( DEBUG_GEN, "VidCtrlBase.SetStreamBitmapReserve %d",
+        (TInt) aStreamBitmap )
+    const CFbsBitmap* oldBitmap( iStreamBitmap );
+    iStreamBitmap = aStreamBitmap;
+    if ( iStreamBitmap )
+        {
+        RedrawStream();
+        }
+    else if ( oldBitmap )
+        {
+        DrawNow();
+        }
+    __VTPRINTEXIT( "VidCtrlBase.SetStreamBitmapReserve" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::SetWaiting
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::SetWaiting( TBool aShowWaitingText )
+    {
+    __VTPRINTENTER( "VidCtrlBase.SetWaiting" )
+    if ( iWaitingTextShow != aShowWaitingText )
+        {
+        iWaitingTextShow = aShowWaitingText;
+        WrapOnDemand();
+        DrawNow();
+        }
+    __VTPRINTEXITR( "VidCtrlBase.SetWaiting %d", iWaitingTextShow )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::Redraw
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::Redraw()
+    {
+    __VTPRINTENTER( "VidCtrlBase.Redraw" )
+    if ( iStreamBitmap )
+        {
+        __VTPRINT( DEBUG_GEN, "VidCtrlBase.Redraw drawing" );
+        DrawNow();
+        }
+    __VTPRINTEXIT( "VidCtrlBase.Redraw" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::Draw
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::Draw( const TRect& ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.Draw" )
+    DoDraw( SystemGc() );
+    __VTPRINTEXIT( "VidCtrlBase.Draw" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVideoControlBase::SizeChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::SizeChanged()
+    {
+    __VTPRINTENTER( "VidCtrlBase.SizeChanged" )
+    AknsUtils::RegisterControlPosition( this );
+
+    TRect bgRect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, bgRect );
+    iBgContext->SetRect( bgRect );
+
+    HandleSizeChanged();
+    TRect parent( Rect() );
+    if ( !parent.IsEmpty() )
+        {
+        TAknTextLineLayout text( WaitingTextLayout( 0 ) );
+        iWaitingTextLine1Layout.LayoutText( parent, text );
+        text = WaitingTextLayout( 1 );
+        iWaitingTextLine2Layout.LayoutText( parent, text );
+        delete iWaitingTextWrapped;
+        iWaitingTextWrapped = NULL;
+        delete iWaitingTextWrappedArray;
+        iWaitingTextWrappedArray = NULL;
+        WrapOnDemand();
+        }
+    __VTPRINTEXIT( "VidCtrlBase.SizeChanged" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVideoControlBase::PositionChanged
+// -----------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::PositionChanged()
+    {
+    __VTPRINTENTER( "VidCtrlBase.SizeChanged" )
+    AknsUtils::RegisterControlPosition( this );
+    __VTPRINTEXIT( "VidCtrlBase.SizeChanged" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::RedrawStream
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::RedrawStream()
+    {
+    __VTPRINTENTER( "VidCtrlBase.RedrawStream" )
+    const TRect clippingRect( StreamClippingRect() );
+    Window().Invalidate( clippingRect );
+    Window().BeginRedraw( clippingRect );
+    ActivateGc();
+    CWindowGc& gc = SystemGc();
+    if ( iSetAlpha )
+        {
+        SetAlpha( gc );
+        iSetAlpha = EFalse;
+        }
+    DoDrawStream( gc );
+    DoDrawBlind( gc );
+    DeactivateGc();
+    Window().EndRedraw();
+    __VTPRINTEXIT( "VidCtrlBase.RedrawStream" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVideoControlBase::WrapOnDemand
+// -----------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::WrapOnDemand()
+    {
+    __VTPRINTENTER( "VidCtrlBase.WrapOnDemand" )
+    if ( iWaitingTextShow && !iWaitingTextWrapped )
+        {
+        TRAP_IGNORE( WrapWaitingTextL() );
+        }
+    __VTPRINTEXIT( "VidCtrlBase.WrapOnDemand" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVideoControlBase::WrapWaitingTextL
+// -----------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::WrapWaitingTextL()
+    {
+    __VTPRINTENTER( "VidCtrlBase.WrapWaitingTextL" )
+    HBufC* waitingText =
+        StringLoader::LoadLC( R_VIDEOTELUI_QTN_INCAL_WAITING_IMAGE );
+
+    CArrayFix< TInt >* lines =
+        new ( ELeave ) CArrayFixFlat< TInt >( KVtUiWaitingLineCount );
+    CleanupStack::PushL( lines );
+    lines->AppendL( iWaitingTextLine1Layout.TextRect().Width() );
+    lines->AppendL( iWaitingTextLine2Layout.TextRect().Width() );
+
+    CArrayFix<TPtrC>* wrap =
+        new ( ELeave ) CArrayFixFlat< TPtrC >( KVtUiWaitingLineCount );
+    CleanupStack::PushL( wrap );
+    wrap->AppendL( TPtrC() );
+    wrap->AppendL( TPtrC() );
+
+    HBufC* waitingTextWrapped =
+        HBufC::NewLC(
+            waitingText->Length() +
+            lines->Count() * KVtUiWaitingExtraSpacePerLine );
+
+    TPtr textBuf = waitingTextWrapped->Des();
+    textBuf.Zero();
+    textBuf.Append( *waitingText );
+
+    AknBidiTextUtils::ConvertToVisualAndWrapToArrayL(
+        textBuf,
+        *lines,
+        *iWaitingTextLine1Layout.Font(),
+        *wrap,
+        ETrue );
+
+    CleanupStack::Pop( waitingTextWrapped );
+    iWaitingTextWrapped = waitingTextWrapped;
+
+    CleanupStack::Pop( wrap );
+    iWaitingTextWrappedArray = wrap;
+
+    CleanupStack::PopAndDestroy( lines );
+    CleanupStack::PopAndDestroy( waitingText );
+    __VTPRINTEXIT( "VidCtrlBase.WrapWaitingTextL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DoDraw
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::DoDraw( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.Draw(gc)" )
+    if ( iSetAlpha )
+        {
+        SetAlpha( aGc );
+        iSetAlpha = EFalse;
+        }
+    DoDrawBackground( aGc );
+    if ( !DoDrawWaitingText( aGc ) )
+        {
+        DoDrawStream( aGc );
+        DoDrawBlind( aGc );
+        }
+    __VTPRINTEXIT( "VidCtrlBase.Draw(gc)" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DoDrawBackground
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::DoDrawBackground( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.DoDrawBackground" )
+    if ( iHints.IsSet( ESkinnedBackground ) )
+        {
+        DrawSkinnedBackground( aGc );
+        }
+    else if ( iHints.IsSet( EColoredBackground ) )
+        {
+        DrawColoredBackground( aGc );
+        }
+    __VTPRINTEXIT( "VidCtrlBase.DoDrawBackground" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DoDrawWaitingText
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiVideoControlBase::DoDrawWaitingText( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.DoDrawWaitingText" )
+    TBool wasDrawn( EFalse );
+    if ( iHints.IsClear( ENoWaitingText ) && iWaitingTextShow &&
+         iWaitingTextWrapped && iWaitingTextWrappedArray )
+        {
+        wasDrawn = DrawWaitingText( aGc );
+        }
+    __VTPRINTEXITR( "VidCtrlBase.DoDrawWaitingText %d", wasDrawn )
+    return wasDrawn;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DoDrawBlind
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::DoDrawBlind( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.DoDrawBlind" )
+    if ( iBlindStatus && iHints.IsClear( ENoBlindIcon ) )
+        {
+        DrawBlind( aGc );
+        }
+    __VTPRINTEXIT( "VidCtrlBase.DoDrawBlind" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::DoDrawStream
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::DoDrawStream( CWindowGc& aGc ) const
+    {
+    __VTPRINTENTER( "VidCtrlBase.DoDrawStream" )
+    if ( iStreamBitmap )
+        {
+        DrawStream( aGc );
+        }
+    __VTPRINTEXIT( "VidCtrlBase.DoDrawStream" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::SetRemoteVideoControl
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase::SetRemoteVideoControl( CCoeControl* aRemoteControl )
+    {
+    __VTPRINTENTER( "VidCtrlBase.SetRemoteVideoControl" )
+    iRemoteVideoControl = aRemoteControl;
+    __VTPRINTEXIT( "VidCtrlBase.SetRemoteVideoControl" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::LayoutRemoteVideo
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoControlBase:: LayoutRemoteVideo()
+    {
+    __VTPRINTENTER( "VidCtrlBase.LayoutRemoteVideo" )
+    __VTPRINTEXIT( "VidCtrlBase.LayoutRemoteVideo" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoControlBase::RemoteVideoControl
+// ---------------------------------------------------------------------------
+//
+CCoeControl * CVtUiVideoControlBase::RemoteVideoControl()
+    {
+    __VTPRINTENTER( "VidCtrlBase.RemoteVideoControl" )
+    __VTPRINTEXIT( "VidCtrlBase.RemoteVideoControl" )
+    return iRemoteVideoControl;
+        
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/cvtuifeaturebase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* 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:  CVtUiFeatureBase implementation.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include    "cvtuifeaturebase.h"
+#include    "mvtuifeature.h"
+#include    "cvtuicommandpolicymanager.h"
+#include    <cvtlogger.h>
+#include    "cvtuifeaturemanager.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureBase::CVtUiFeatureBase
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiFeatureBase::CVtUiFeatureBase( TVtUiFeatureId aId,
+    CVtUiFeatureManager& aFeatureManager ) : iId( aId ), 
+    iFeatureManager ( aFeatureManager ),
+    iFeatureState ( EUnprepared )
+    {
+    __VTPRINTENTER( "CVtUiFeatureBase.CVtUiFeatureBase" )
+    __VTPRINTEXIT( "CVtUiFeatureBase.CVtUiFeatureBase" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureBase::BaseConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFeatureBase::StartL()
+	{
+	if ( iFeatureState == EUnprepared )
+		{
+		iAsyncCallback->Cancel();
+		InitFeatureL();
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureBase::BaseConstructL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFeatureBase::BaseConstructL()
+    {
+    __VTPRINTENTER( "CVtUiFeatureBase.BaseConstructL" )
+    iAsyncCallback = 
+    	new ( ELeave ) CAsyncCallBack ( CActive::EPriorityLow );
+    iAsyncCallback->Set( TCallBack( &DoInitFeaturesL, this ) );
+    iAsyncCallback->CallBack(); 
+    __VTPRINTEXIT( "CVtUiFeatureBase.BaseConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureBase::~CVtUiFeatureBase
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiFeatureBase::~CVtUiFeatureBase()
+    {
+    __VTPRINTENTER( "CVtUiFeatureBase.~" )
+    delete iAsyncCallback;
+    __VTPRINTEXIT( "CVtUiFeatureBase.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureBase::State
+// -----------------------------------------------------------------------------
+//
+MVtUiFeature::TVtUiFeatureState CVtUiFeatureBase::State() const
+    {
+    __VTPRINTENTER( "CVtUiFeatureBase.State" )
+    __VTPRINTEXITR( "CVtUiFeatureBase.State. %d", (TInt)iFeatureState )
+    return iFeatureState;
+    }
+        
+// -----------------------------------------------------------------------------
+// CVtUiFeatureBase::Id
+// -----------------------------------------------------------------------------
+//
+TVtUiFeatureId CVtUiFeatureBase::Id() const
+    {
+    __VTPRINTENTER( "CVtUiFeatureBase.Id" )
+    __VTPRINTEXITR( "CVtUiFeatureBase.Id %d", iId )
+    return iId;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtUiFeatureBase::DoInitFeaturesL
+// -----------------------------------------------------------------------------
+//  
+TInt CVtUiFeatureBase::DoInitFeaturesL( TAny* aAny )
+    {
+    __VTPRINTENTER( "CVtUiFeatureBase.DoInitFeaturesL" )
+    CVtUiFeatureBase* self = static_cast< CVtUiFeatureBase* >( aAny );
+    self->InitFeatureL();
+    __VTPRINTEXIT( "CVtUiFeatureBase.DoInitFeaturesL" )
+    return KErrNone;
+    }   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/cvtuifeaturemanager.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,280 @@
+/*
+* 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:  Feature manager for Video Telephone application.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cvtuifeaturemanager.h"
+#include    "CVtUiAppUi.h"
+#include    "cvtuifixedtoolbar.h"
+#include    "cvtuifloatingtoolbar.h"
+#include    "cvtuimenus.h"
+#include    "cvtuifeaturebase.h"
+#include    "tvtuistates.h"
+#include    <cvtlogger.h>
+#include    "cvtuicommandpolicymanager.h"
+#include    "cvtuisoftkeys.h"
+#include    "cvtuinumberentry.h"
+#include    "cvtuivideoquality.h"
+#include    "cvtuiwhitebalance.h"
+#include    "cvtuicolortone.h"
+#include    "cvtuidialer.h"
+#include    "cvtuibrightness.h"
+#include    "cvtuicontrast.h"
+#include    "cvtuivolume.h"
+#include    "cvtuizoom.h"
+
+#include    <featmgr.h>
+
+// CONSTANTS
+const TInt KFeatureCount = 9;
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Used in Attach() method to compare two instances of MVtUiFeature.
+// ---------------------------------------------------------------------------
+//
+TInt FeatureCmpFunc( const CVtUiFeatureBase& aV1, const CVtUiFeatureBase& aV2 )
+    {
+    return ( aV1.Id() - aV2.Id() );
+    }
+
+// ---------------------------------------------------------------------------
+// Used in GetFeature() method to search feature by id.
+// ---------------------------------------------------------------------------
+//
+TInt FeatureIdCmpFunc( const TInt* aId, const CVtUiFeatureBase& aFeature )
+    {
+    return ( *aId - aFeature.Id() );
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiFeatureManager* CVtUiFeatureManager::NewL( CVtUiAppUi& aAppUi,
+    TVtUiStates& aUiStates,  MVtUiCommandManager& aCommandManager,
+    MVtUiComponentManager& aComponentManager )
+    {
+    CVtUiFeatureManager* self = new( ELeave ) CVtUiFeatureManager( aAppUi,
+    aUiStates, aCommandManager, aComponentManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::CVtUiFeatureManager
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiFeatureManager::CVtUiFeatureManager( CVtUiAppUi& aAppUi,
+    TVtUiStates& aUiStates,  MVtUiCommandManager& aCommandManager,
+    MVtUiComponentManager& aComponentManager )
+    : iAppUi( aAppUi ), iUiStates( aUiStates ),
+    iCommandManager( aCommandManager ), iComponentManager( aComponentManager )
+    {
+     __VTPRINTENTER( "CVtUiFeatureManager.CVtUiFeatureManager" )
+     __VTPRINTEXIT( "CVtUiFeatureManager.CVtUiFeatureManager" )
+    }
+
+
+// -----------------------------------------------------------------------------
+//CVtUiFeatureManager::~CVtUiFeatureManager()
+// -----------------------------------------------------------------------------
+//
+CVtUiFeatureManager::~CVtUiFeatureManager()
+    {
+    __VTPRINTENTER( "CVtUiFeatureManager.~" )
+    iFeatures.ResetAndDestroy();
+    __VTPRINTEXIT( "CVtUiFeatureManager.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVtUiFeatureManager::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiFeatureManager.ConstructL" )
+    iFeatures.ReserveL( KFeatureCount );
+    CreateFeaturesL();
+     __VTPRINTEXIT( "CVtUiFeatureManager.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::CreateFeaturesL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFeatureManager::CreateFeaturesL()
+    {
+    __VTPRINTENTER( "CVtUiFeatureManager.CreateFeaturesL" )
+    CVtUiFeatureBase* feature = NULL;
+    TLinearOrder< CVtUiFeatureBase >
+        linOrder( ::FeatureCmpFunc );
+
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+        feature = CVtUiFixedToolbar::NewL( *this );
+        } 
+    else
+        {
+        feature = CVtUiFloatingToolbar::NewL( *this );            
+        }
+    
+    if ( feature )
+        {
+        iFeatures.InsertInOrderL( feature, linOrder );
+        }
+
+    feature = CVtUiMenus::NewL( *this );
+    iFeatures.InsertInOrderL( feature, linOrder );
+
+    feature = CVtUiSoftkeys::NewL( *this, *iAppUi.GetCba() );
+    iFeatures.InsertInOrderL( feature, linOrder );
+
+    feature = CVtUiNumberEntry::NewL( *this );
+    iFeatures.InsertInOrderL( feature, linOrder );
+
+    if ( FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) )
+        {
+        feature = CVtUiDialer::NewL( *this );
+        if ( feature )
+            {
+            iFeatures.InsertInOrderL( feature, linOrder );
+            }
+        }
+
+    feature = CVtUiVideoQuality::NewL( *this );
+    if ( feature )
+        {
+        iFeatures.InsertInOrderL( feature, linOrder );
+        }
+
+    feature = CVtUiWhiteBalance::NewL( *this );
+    if ( feature )
+        {
+        iFeatures.InsertInOrderL( feature, linOrder );
+        }
+
+    feature = CVtUiColorTone::NewL( *this );
+    if ( feature )
+        {
+        iFeatures.InsertInOrderL( feature, linOrder );
+        }
+
+    feature = CVtUiBrightness::NewL( *this );
+    if ( feature )
+        {
+        iFeatures.InsertInOrderL( feature, linOrder );
+        }
+
+    feature = CVtUiContrast::NewL( *this );
+    if ( feature )
+        {
+        iFeatures.InsertInOrderL( feature, linOrder );
+        }
+
+    feature = CVtUiVolume::NewL( *this );
+    if ( feature )
+        {
+        iFeatures.InsertInOrderL( feature, linOrder );
+        }
+
+    feature = CVtUiZoom::NewL( *this );
+    if ( feature )
+        {
+        iFeatures.InsertInOrderL( feature, linOrder );
+        }
+
+    __VTPRINTEXIT( "CVtUiFeatureManager.CreateFeaturesL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::AppUi
+// -----------------------------------------------------------------------------
+//
+CVtUiAppUi& CVtUiFeatureManager::AppUi()
+    {
+    __VTPRINTENTER( "CVtUiFeatureManager.AppUi" )
+    __VTPRINTEXIT( "CVtUiFeatureManager.AppUi" )
+    return iAppUi;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::GetFeatureById
+// -----------------------------------------------------------------------------
+//
+MVtUiFeature* CVtUiFeatureManager::GetFeatureById( TInt aId )
+    {
+    __VTPRINTENTER( "CVtUiFeatureManager.GetFeatureById" )
+    CVtUiFeatureBase* result = NULL;
+
+    TInt index( iFeatures.FindInOrder( aId, ::FeatureIdCmpFunc ) );
+    if ( index != KErrNotFound )
+        {
+        result = iFeatures[ index ];
+        }
+    __VTPRINTEXITR( "CVtUiFeatureManager.GetFeatureById %d", (TInt)result )
+    return result;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::UiStates
+// -----------------------------------------------------------------------------
+//
+
+TVtUiStates& CVtUiFeatureManager::UiStates()
+    {
+    return iUiStates;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::CommandManager
+// -----------------------------------------------------------------------------
+//
+MVtUiCommandManager& CVtUiFeatureManager::CommandManager()
+    {
+    return iCommandManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::ComponentManager
+// -----------------------------------------------------------------------------
+//
+MVtUiComponentManager& CVtUiFeatureManager::ComponentManager()
+    {
+    return iComponentManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFeatureManager::Model
+// -----------------------------------------------------------------------------
+//
+CVtEngModel& CVtUiFeatureManager::Model()
+    {
+    return iAppUi.Model();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/dialer/cvtuicmdclosedialer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* 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:  Mini dialer open command implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicmdclosedialer.h"
+#include "mvtuicommandmanager.h"
+#include "mvtuifeature.h"
+#include "videotelui.hrh"
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdCloseDialer::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdCloseDialer* CVtUiCmdCloseDialer::NewL(
+    MVtUiCommandManager& aCommandManager, MVtUiFeature& aFeature )
+    {
+    __VTPRINTENTER( "CmdCloseDial.NewL" )
+    CVtUiCmdCloseDialer* self =
+        new ( ELeave ) CVtUiCmdCloseDialer( aCommandManager, aFeature );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "CmdCloseDial.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdCloseDialer::~CVtUiCmdCloseDialer
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdCloseDialer::~CVtUiCmdCloseDialer()
+    {
+    __VTPRINTENTER( "CmdCloseDial.~" )
+    iCommandManager.UnregisterCommand( *this );
+    __VTPRINTEXIT( "CmdCloseDial.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdCloseDialer::HandleL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdCloseDialer::HandleL()
+    {
+    __VTPRINTENTER( "CmdCloseDial.HandleL" )
+    iFeature.Stop();
+    __VTPRINTEXIT( "CmdCloseDial.HandleL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdCloseDialer::IsEnabled
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiCmdCloseDialer::IsEnabled() const
+    {
+    __VTPRINTENTER( "CmdCloseDial.IsEnabled" )
+    const TBool enabled( iFeature.State() == MVtUiFeature::EActive );
+    __VTPRINTEXITR( "CmdCloseDial.IsEnabled %d", enabled )
+    return enabled;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdCloseDialer::CVtUiCmdCloseDialer
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdCloseDialer::CVtUiCmdCloseDialer(
+    MVtUiCommandManager& aCommandManager, MVtUiFeature& aFeature )
+    : CVtUiFeatureCmdBase( aFeature, EVtUiDialerExit ),
+      iCommandManager( aCommandManager )
+    {
+    __VTPRINTENTER( "CmdCloseDial.ctor" )
+    __VTPRINTEXIT( "CmdCloseDial.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdCloseDialer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdCloseDialer::ConstructL()
+    {
+    __VTPRINTENTER( "CmdCloseDial.ConstructL" )
+    iCommandManager.RegisterCommandL( *this );
+    __VTPRINTEXIT( "CmdCloseDial.ConstructL" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/dialer/cvtuicmdopendialer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* 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:  Mini dialer open command implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuicmdopendialer.h"
+#include "mvtuicommandmanager.h"
+#include "videotelui.hrh"
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdOpenDialer::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdOpenDialer* CVtUiCmdOpenDialer::NewL(
+    MVtUiCommandManager& aCommandManager, MVtUiFeature& aFeature )
+    {
+    __VTPRINTENTER( "CmdOpenDial.NewL" )
+    CVtUiCmdOpenDialer* self =
+        new ( ELeave ) CVtUiCmdOpenDialer( aCommandManager, aFeature );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "CmdOpenDial.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdOpenDialer::~CVtUiCmdOpenDialer
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdOpenDialer::~CVtUiCmdOpenDialer()
+    {
+    __VTPRINTENTER( "CmdOpenDial.~" )
+    iCommandManager.UnregisterCommand( *this );
+    __VTPRINTEXIT( "CmdOpenDial.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdOpenDialer::CVtUiCmdOpenDialer
+// ---------------------------------------------------------------------------
+//
+CVtUiCmdOpenDialer::CVtUiCmdOpenDialer(
+    MVtUiCommandManager& aCommandManager, MVtUiFeature& aFeature )
+    : CVtUiFeatureCmdBase( aFeature, EVtUiCmdSendDTMF ),
+      iCommandManager( aCommandManager )
+    {
+    __VTPRINTENTER( "CmdOpenDial.ctor" )
+    __VTPRINTEXIT( "CmdOpenDial.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiCmdOpenDialer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiCmdOpenDialer::ConstructL()
+    {
+    __VTPRINTENTER( "CmdOpenDial.ConstructL" )
+    iCommandManager.RegisterCommandL( *this );
+    __VTPRINTEXIT( "CmdOpenDial.ConstructL" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/dialer/cvtuidialer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,196 @@
+/*
+* 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:  Mini dialer feature
+*
+*/
+
+
+#include <aknutils.h>
+#include <peninputcmdparam.h>
+#include <cvtlogger.h>
+
+#include "cvtuidialer.h"
+#include "cvtuifeaturemanager.h"
+#include "mvtuicommandmanager.h"
+#include "mvtuicomponentmanager.h"
+#include "cvtuicmdopendialer.h"
+#include "cvtuicmdclosedialer.h"
+#include "cvtuidialercontainer.h"
+#include "cvtuidialervideocontrol.h"
+#include "CVtUiAppUi.h"
+#include "tvtuistates.h"
+#include "CVtUiContextControl.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// Implementation of CVtUiDialer
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiDialer* CVtUiDialer::NewL( CVtUiFeatureManager& aFeatureManager )
+    {
+    __VTPRINTENTER( "Dial.NewL" )
+    CVtUiDialer* self = NULL;
+    self = new ( ELeave ) CVtUiDialer( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "Dial.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::~CVtUiDialer
+// ---------------------------------------------------------------------------
+//
+CVtUiDialer::~CVtUiDialer()
+    {
+    __VTPRINTENTER( "Dial.~" )
+    delete iCmdOpen;
+    delete iCmdClose;
+    delete iDialerContainer;
+    __VTPRINTEXIT( "Dial.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::VideoWindow
+// ---------------------------------------------------------------------------
+//
+MVtUiVideoWindow& CVtUiDialer::VideoWindow() const
+    {
+    __VTPRINTENTER( "Dial.VideoWindow" )
+    __VTPRINTEXIT( "Dial.VideoWindow" )
+    return *iDialerContainer->ComponentAsVideoWindow();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::VideoControl
+// ---------------------------------------------------------------------------
+//
+CCoeControl& CVtUiDialer::VideoControl() const
+    {
+    __VTPRINTENTER( "Dial.VideoControl" )
+    __VTPRINTEXIT( "Dial.VideoControl" )
+    return *static_cast< MVtUiComponent* >
+        ( iDialerContainer )->ComponentAsControl();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialer::StartL()
+    {
+    __VTPRINTENTER( "Dial.StartL" )
+    if ( State() == MVtUiFeature::EUnprepared )
+        {
+        // fixed toolbar is set to be hidden
+        iFeatureManager.AppUi().ContextControl().MakeVisible( EFalse );
+        iFeatureManager.UiStates().SetIsDialerActivating( ETrue );
+        iFeatureManager.UiStates().SetIsFixedToolbarVisible( EFalse );
+        iFeatureManager.CommandManager().RefreshL();
+        PrepareL();
+        iFeatureManager.ComponentManager().RequestActivationL(
+            MVtUiComponent::EComponentIdDialer );
+        iFeatureState = EActive;
+        iFeatureManager.AppUi().SwitchLayoutToFlatStatusPaneL( ETrue );
+        }
+    __VTPRINTEXIT( "Dial.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialer::Stop()
+    {
+    __VTPRINTENTER( "Dial.Stop" )
+    if ( State() == MVtUiFeature::EActive )
+        {
+        TInt error;
+        TRAP( error,
+            {
+            iFeatureManager.AppUi().SwitchLayoutToFlatStatusPaneL( EFalse );
+            iFeatureManager.ComponentManager().DeActivateComponentL(
+                MVtUiComponent::EComponentIdDialer );
+            } );
+        Unprepare();
+        iFeatureManager.AppUi().ContextControl().MakeVisible( ETrue );
+        }
+    __VTPRINTEXIT( "Dial.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::InitFeatureL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialer::InitFeatureL()
+    {
+    __VTPRINTENTER( "Dial.InitFeatureL" )
+    iDialerContainer =
+        CVtUiDialerContainer::NewL( iFeatureManager );
+    iCmdOpen = CVtUiCmdOpenDialer::NewL( iFeatureManager.CommandManager(),
+        *this );
+    iCmdClose = CVtUiCmdCloseDialer::NewL( iFeatureManager.CommandManager(),
+        *this );
+   __VTPRINTEXIT( "Dial.InitFeatureL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::CVtUiDialer
+// ---------------------------------------------------------------------------
+//
+CVtUiDialer::CVtUiDialer( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiFeatureBase( EVtUiFeatureIdDialer, aFeatureManager )
+    {
+    __VTPRINTENTER( "Dial.ctor" )
+    __VTPRINTEXIT( "Dial.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialer::ConstructL()
+    {
+    __VTPRINTENTER( "Dial.ConstructL" )
+    BaseConstructL();
+    __VTPRINTEXIT( "Dial.ConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::PrepareL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialer::PrepareL()
+    {
+    __VTPRINTENTER( "Dial.PrepareL" )
+    iDialerContainer->RegisterComponentL();
+    iFeatureState = EReady;
+    __VTPRINTEXIT( "Dial.PrepareL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialer::Unprepare
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialer::Unprepare()
+    {
+    __VTPRINTENTER( "Dial.Unprepare" )
+    iDialerContainer->UnregisterComponent();
+    iFeatureState = EUnprepared;
+    __VTPRINTEXIT( "Dial.Unprepare" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/dialer/cvtuidialercontainer.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,482 @@
+/*
+* 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:  Dialer feature
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    <cvideodtmfdialer.h>
+#include    <aknsdrawutils.h>
+#include    <aknsutils.h>
+#include    <aknlayoutscalable_apps.cdl.h>
+#include    <aknlayoutscalable_avkon.cdl.h>
+#include    <layoutmetadata.cdl.h>
+#include    <featmgr.h>
+#include    <aknsbasicbackgroundcontrolcontext.h>
+
+#include    "VtUiUtility.h"
+#include    "VtUiLayout.h"
+#include    "mvtuicomponentmanager.h"
+#include    "cvtuidialercontainer.h"
+#include    "cvtuidialervideocontrol.h"
+#include    "tvtuiwsevent.h"
+#include    "tvtuistates.h"
+#include    "cvtuidialerskmodifier.h"
+#include    "cvtuifeaturemanager.h"
+#include    "CVtUiAppUi.h"
+#include    "mvtuicommandmanager.h"
+#include    "cvtuidtmfbuffer.h"
+
+// Index of white color.
+const TInt KVtUiColorWhite = 0;
+
+// Implementation of TVtUiMiniDialerComponentState
+
+// ---------------------------------------------------------------------------
+// TVtUiDialerComponentState::TVtUiDialerComponentState
+// ---------------------------------------------------------------------------
+//
+TVtUiDialerComponentState::TVtUiDialerComponentState(
+    MVtUiComponent& aComponent ) :
+    TVtUiComponentState( aComponent,
+        TVtUiBlockListBitField(
+            MVtUiComponent::EComponentIdToolbar |
+            MVtUiComponent::EComponentIdNumberEntry ) )
+    {
+    }
+
+// Implementation of CVtUiDialerContainer
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiDialerContainer* CVtUiDialerContainer::NewL(
+    CVtUiFeatureManager& aFeatureManager )
+    {
+    __VTPRINTENTER( "DialContainer.NewL" )
+    CVtUiDialerContainer* self =
+        new ( ELeave ) CVtUiDialerContainer( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL( aFeatureManager.AppUi().BitmapManager() );
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "DialContainer.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::~CVtUiDialerContainer
+// ---------------------------------------------------------------------------
+//
+CVtUiDialerContainer::~CVtUiDialerContainer()
+    {
+    __VTPRINTENTER( "DialContainer.~" )
+    delete iAsyncDeactivate;
+    delete iVideoControl;
+    delete iDialer;
+    delete iSKModifier;
+    delete iInputBuffer;
+    delete iBgContext;
+    AknsUtils::DeregisterControlPosition( this );
+    __VTPRINTEXIT( "DialContainer.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::HandleResourceChangeL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::HandleResourceChangeL( TInt aType )
+    {
+    __VTPRINTENTER( "DialContainer.HandleResourceChangeL" )
+    switch ( aType )
+        {
+    case KEikDynamicLayoutVariantSwitch:
+    case KAknsMessageSkinChange:
+        LayoutDialerContainer();
+        break;
+    default:
+        break;
+        }
+    __VTPRINTEXIT( "DialContainer.HandleResourceChangeL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::ComponentId
+// ---------------------------------------------------------------------------
+//
+MVtUiComponent::TComponentId CVtUiDialerContainer::ComponentId() const
+    {
+    return EComponentIdDialer;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::ComponentAsControl
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CVtUiDialerContainer::ComponentAsControl()
+    {
+    return iVideoControl;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::DoActivateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::DoActivateL()
+    {
+    __VTPRINTENTER( "DialContainer.DoActivateL" )
+    iUiStates.SetIsDialerActivating( EFalse );
+    LayoutDialerContainer();
+    Reset();
+    iVideoControl->MakeVisible( ETrue );
+    iDialer->MakeVisible( ETrue );
+    MakeVisible( ETrue );
+    User::LeaveIfError( iFeatureManager->
+        CommandManager().AddCommandModifier( *iSKModifier ) );
+    iInputBuffer->Activate();
+    iMode = CVtUiAppUi::ERenderingModeDialer;
+    TVtUiWsEvent< CVtUiAppUi::TRenderingMode > renderingEvent(
+        EVtUiWsEventBeginRenderingMode, &iMode );
+    iCoeEnv->WsSession().SendEventToWindowGroup(
+        Window().WindowGroupId(), renderingEvent );
+    iUiStates.SetIsDialerOpen( ETrue );
+    iAsyncDeactivate->Cancel();
+    __VTPRINTEXIT( "DialContainer.DoActivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::DoDeactivateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::DoDeactivateL()
+    {
+    __VTPRINTENTER( "DialContainer.DoDeactivateL" )
+    iFeatureManager->CommandManager().
+        RemoveCommandModifier( *iSKModifier );
+    iUiStates.SetIsDialerOpen( EFalse );
+    iVideoControl->MakeVisible( EFalse );
+    iDialer->MakeVisible( EFalse );
+    MakeVisible( EFalse );
+    Reset();
+    iInputBuffer->Deactivate();
+    iAsyncDeactivate->CallBack();
+    __VTPRINTEXIT( "DialContainer.DoDeactivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::GetContents
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::GetContents( TDes& aContents ) const
+    {
+    __VTPRINTENTER( "DialContainer.GetContents" )
+    iInputBuffer->GetContents( aContents );
+    __VTPRINTEXIT( "DialContainer.GetContents" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CVtUiDialerContainer::OfferKeyEventL( const TKeyEvent& aEvent,
+    TEventCode aType )
+    {
+    __VTPRINTENTER( "DialContainer.OfferKeyEventL" )
+    TKeyResponse response( EKeyWasNotConsumed );
+    TChar dtmfTone;
+    if ( VtUiUtility::IsDTMFEvent( aEvent, dtmfTone ) &&
+         ( aType == EEventKey ) )
+        {
+        response = EKeyWasConsumed;
+        AppendDigit( dtmfTone );
+        }
+    __VTPRINTEXIT( "DialContainer.OfferKeyEventL" )
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::Draw
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::Draw( const TRect& ) const
+    {
+    __VTPRINTENTER( "DialContainer.Draw" )
+    CWindowGc& gc( SystemGc() );
+    gc.SetBrushStyle( CWindowGc::ESolidBrush );
+    gc.SetPenStyle( CGraphicsContext::ENullPen );
+    gc.SetBrushColor( AKN_LAF_COLOR( KVtUiColorWhite ) );
+    gc.Clear();
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+    AknsDrawUtils::Background( skin, cc, this, gc, Rect() );
+    __VTPRINTEXIT( "DialContainer.Draw" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::SizeChanged
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::SizeChanged()
+    {
+    __VTPRINTENTER( "DialContainer.SizeChanged" )
+    TRect bgRect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, bgRect );
+    iBgContext->SetRect( bgRect );
+
+    AknsUtils::RegisterControlPosition( this );
+    CCoeControl::SizeChanged();
+    __VTPRINTEXIT( "DialContainer.SizeChanged" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::PositionChanged
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::PositionChanged()
+    {
+    __VTPRINTENTER( "DialContainer.PositionChanged" )
+    AknsUtils::RegisterControlPosition( this );
+    CCoeControl::PositionChanged();
+    __VTPRINTEXIT( "DialContainer.PositionChanged" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::CountComponentControls
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiDialerContainer::CountComponentControls() const
+    {
+    return iDialer ? 1 : 0;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::ComponentControl
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CVtUiDialerContainer::ComponentControl( TInt aIndex ) const
+    {
+    CCoeControl* result = NULL;
+    switch ( aIndex )
+        {
+    case 0:
+        result = iDialer;
+        break;
+    default:
+        break;
+        }
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::CVtUiDialerContainer
+// ---------------------------------------------------------------------------
+//
+CVtUiDialerContainer::CVtUiDialerContainer(
+    CVtUiFeatureManager& aFeatureManager ) :
+    iComponentState( *this ),
+    iFeatureManager( &aFeatureManager ),
+    iComponentManager( &aFeatureManager.ComponentManager() ),
+    iUiStates( aFeatureManager.UiStates() )
+    {
+    __VTPRINTENTER( "DialContainer.ctor" )
+    __VTPRINTEXIT( "DialContainer.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::ConstructL( CVtUiBitmapManager& aBitmapManager )
+    {
+    __VTPRINTENTER( "DialContainer.ConstructL" )
+    iBgContext = CAknsBasicBackgroundControlContext::NewL(
+                      KAknsIIDQsnBgScreen, Rect(), ETrue );
+    CreateWindowL();
+    DrawableWindow()->SetPointerGrab( ETrue );
+    SetExtent( TPoint(), TSize() );
+    ActivateL();
+    MakeVisible( EFalse );
+    iInputBuffer = CVtUiDTMFBuffer::NewL( *iCoeEnv );
+    iVideoControl = CVtUiDialerVideoControl::NewL( aBitmapManager );
+    iDialer = CVideoDTMFDialer::NewL( *this, *iVideoControl, DialerRect() );
+    iSKModifier = CVtUiDialerSKModifier::NewL( *iFeatureManager );
+    // Disable fading when using DP (eliminates nasty color error)
+    if ( FeatureManager::FeatureSupported( KFeatureIdDisplayPost ) )
+        {
+        Window().SetNonFading( ETrue );
+        }
+    iAsyncDeactivate = new ( ELeave ) CAsyncCallBack(
+        TCallBack( ASyncDoDeactivate, this ), CActive::EPriorityLow );
+    __VTPRINTEXIT( "DialContainer.ConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::RegisterComponentL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::RegisterComponentL()
+    {
+    __VTPRINTENTER( "DialContainer.RegisterComponentL" )
+    User::LeaveIfError( iComponentManager->ChangeResourceChangeRegistration(
+        *this, MVtUiComponentManager::ERegister ) );
+    User::LeaveIfError(
+        iComponentManager->ChangeComponentRegistration(
+        iComponentState, MVtUiComponentManager::ERegister ) );
+    User::LeaveIfError( iComponentManager->ChangeKeyEventRegistration(
+        *this, MVtUiComponentManager::ERegister ) );
+    __VTPRINTEXIT( "DialContainer.RegisterComponentL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::UnregisterComponent
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::UnregisterComponent()
+    {
+    __VTPRINTENTER( "DialContainer.UnregisterComponent" )
+    iComponentManager->ChangeComponentRegistration(
+        iComponentState, MVtUiComponentManager::EUnregister );
+    iComponentManager->ChangeResourceChangeRegistration(
+        *this, MVtUiComponentManager::EUnregister );
+    iComponentManager->ChangeKeyEventRegistration(
+        *this, MVtUiComponentManager::EUnregister );
+    __VTPRINTEXIT( "DialContainer.UnregisterComponent" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::UnregisterComponent
+// ---------------------------------------------------------------------------
+//
+MVtUiVideoWindow* CVtUiDialerContainer::ComponentAsVideoWindow()
+    {
+    __VTPRINTENTER( "DialContainer.ComponentAsVideoWindow" )
+    __VTPRINTEXIT( "DialContainer.ComponentAsVideoWindow" )
+    return iVideoControl;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::LayoutDialerContainer
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::LayoutDialerContainer()
+    {
+    __VTPRINTENTER( "DialContainer.LayoutDialerContainer" )
+
+    TAknWindowLineLayout mainPaneLL;
+
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        // Landscape: Option11 (thin status pane, lsc)
+        mainPaneLL = AknLayoutScalable_Avkon::main_pane( 9 ).LayoutLine();
+        }
+    else
+        {
+        // Portrait: main pane with status pane off, control pane on
+        mainPaneLL = AknLayoutScalable_Avkon::main_pane( 7 ).LayoutLine();
+        }
+
+    TRect appWinRect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow,
+        appWinRect );
+
+    // Layout container
+    AknLayoutUtils::LayoutControl( this, appWinRect, mainPaneLL );
+
+    // Layout dialer
+    const TInt variety( Layout_Meta_Data::IsLandscapeOrientation() ?
+        1 : 0 );
+    TAknWindowLineLayout dialerLLout(
+        AknLayoutScalable_Apps::main_video_tele_dialer_pane(
+            variety ).LayoutLine() );
+    AknLayoutUtils::LayoutControl( iDialer, Rect(), dialerLLout );
+
+    // Layout video control
+    AknLayoutUtils::LayoutControl( iVideoControl, iDialer->Rect(),
+         AknLayoutScalable_Apps::video_down_pane_cp(
+            variety ).LayoutLine() );
+
+    __VTPRINTEXIT( "DialContainer.LayoutDialerContainer" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::DialerRect
+// ---------------------------------------------------------------------------
+//
+TRect CVtUiDialerContainer::DialerRect() const
+    {
+    __VTPRINTENTER( "DialContainer.DialerRect" )
+    TRect mainPaneRect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
+        mainPaneRect );
+    __VTPRINTEXIT( "DialContainer.DialerRect" )
+    return mainPaneRect;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::Reset
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::Reset()
+    {
+    __VTPRINTENTER( "DialContainer.Reset" )
+    iInputBuffer->Reset();
+    __VTPRINTEXIT( "DialContainer.Reset" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::AppendDigit
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerContainer::AppendDigit( TChar aDigit )
+    {
+    __VTPRINTENTER( "DialContainer.AppendDigit" )
+    iInputBuffer->Append( aDigit );
+    __VTPRINTEXIT( "DialContainer.AppendDigit" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::MopSupplyObject
+// ---------------------------------------------------------------------------
+//
+TTypeUid::Ptr CVtUiDialerContainer::MopSupplyObject( TTypeUid aId )
+ {
+     __VTPRINTENTER( "CVtUiDialerContainer.MopSupplyObject" )
+ // Required during rendering of the background skin in Draw()
+ if (aId.iUid == MAknsControlContext::ETypeId)
+     {
+      __VTPRINTEXIT( "CVtUiDialerContainer.MopSupplyObject.1" )
+     return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+     }
+    __VTPRINTEXIT( "CVtUiDialerContainer.MopSupplyObject.2" )
+ return CCoeControl::MopSupplyObject( aId );
+ }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerContainer::ASyncDoDeactivate
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiDialerContainer::ASyncDoDeactivate( TAny* aSelf )
+    {
+    __VTPRINTENTER( "DialContainer.ASyncDoDeactivate" )
+    CVtUiDialerContainer* self =
+        reinterpret_cast< CVtUiDialerContainer* >( aSelf );
+    self->iMode = CVtUiAppUi::ERenderingModeDialer;
+    TVtUiWsEvent< CVtUiAppUi::TRenderingMode > renderingEvent(
+        EVtUiWsEventEndRenderingMode, &self->iMode );
+    self->iCoeEnv->WsSession().SendEventToWindowGroup(
+        self->Window().WindowGroupId(), renderingEvent );
+    __VTPRINTEXIT( "DialContainer.ASyncDoDeactivate" )
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/dialer/cvtuidialerskmodifier.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* 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:  Softkey modifier class.
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    "cvtuidialerskmodifier.h"
+#include    "mvtuicommandsetting.h"
+#include    "tvtuicommandmodifierpriority.h"
+#include    "cvtuifeaturemanager.h"
+#include    "tvtuistates.h"
+#include    "tvtuifeatureids.h"
+#include    "CVtUiAppUi.h"
+#include    <eikbtgpc.h>
+#include    <videotelui.rsg>
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerSKModifier::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiDialerSKModifier* CVtUiDialerSKModifier::NewL(
+    CVtUiFeatureManager& aFeatureMgr )
+    {
+    __VTPRINTENTER( "CVtUiDialerSKModifier.NewL" )
+    CVtUiDialerSKModifier* self =
+        new ( ELeave ) CVtUiDialerSKModifier( aFeatureMgr );
+    __VTPRINTEXIT( "CVtUiDialerSKModifier.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerSKModifier::~CVtUiDialerSKModifier
+// ---------------------------------------------------------------------------
+//
+CVtUiDialerSKModifier::~CVtUiDialerSKModifier()
+    {
+    __VTPRINTENTER( "CVtUiDialerSKModifier.~" )
+    __VTPRINTEXIT( "CVtUiDialerSKModifier.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerSKModifier::CVtUiDialerSKModifier
+// ---------------------------------------------------------------------------
+//
+CVtUiDialerSKModifier::CVtUiDialerSKModifier(
+    CVtUiFeatureManager& aFeatureMgr )
+    : CVtUiCommandModifyBase( EVtUiCmdModifierPriorityNumberEntry ),
+    iFeatureMgr( aFeatureMgr )
+    {
+    __VTPRINTENTER( "CVtUiDialerSKModifier.Ctr" )
+    __VTPRINTEXIT( "CVtUiDialerSKModifier.Ctr" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerSKModifier::ModifyCommandsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerSKModifier::ModifyCommandsL( MVtUiCommandSetting& )
+    {
+    __VTPRINTENTER( "CVtUiDialerSKModifier.ModifyCommandsL" )
+    CEikButtonGroupContainer* cba = iFeatureMgr.AppUi().GetCba();
+    cba->SetCommandSetL( R_VIDEOTELUI_SOFTKEYS_EMPTY_DIALEREXIT );
+    __VTPRINTEXIT( "CVtUiDialerSKModifier.ModifyCommandsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerSKModifier::Supports
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiDialerSKModifier::Supports(
+    MVtUiCommandSetting::Type aType ) const
+    {
+    __VTPRINTENTER( "CVtUiDialerSKModifier.Supports" )
+    __VTPRINTEXIT( "CVtUiDialerSKModifier.Supports" )
+    return ( aType == MVtUiCommandSetting::ECommandTypeSoftkeys );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/dialer/cvtuidialervideocontrol.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* 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:  Mini dialer feature
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    <aknlayoutscalable_apps.cdl.h>
+#include    <aknlayoutscalable_avkon.cdl.h>
+#include    <layoutmetadata.cdl.h>
+
+#include "cvtuidialervideocontrol.h"
+
+// Portrait variety constant
+const static TInt KVarietyPortrait = 0;
+
+// Landscape variety constant
+const static TInt KVarietyLandscape = 1;
+
+// Implementation of CVtUiDialerVideoControl
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerVideoControl::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiDialerVideoControl* CVtUiDialerVideoControl::NewL(
+    CVtUiBitmapManager& aBitmapManager )
+    {
+    __VTPRINTENTER( "DialCtrl.NewL" )
+    CVtUiDialerVideoControl* self =
+        new ( ELeave ) CVtUiDialerVideoControl( aBitmapManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "DialCtrl.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerVideoControl::~CVtUiDialerVideoControl
+// ---------------------------------------------------------------------------
+//
+CVtUiDialerVideoControl::~CVtUiDialerVideoControl()
+    {
+    __VTPRINTENTER( "DialCtrl.~" )
+    __VTPRINTEXIT( "DialCtrl.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerVideoControl::CVtUiDialerVideoControl
+// ---------------------------------------------------------------------------
+//
+CVtUiDialerVideoControl::CVtUiDialerVideoControl(
+    CVtUiBitmapManager& aBitmapManager ) :
+    CVtUiVideoControlBase( aBitmapManager )
+    {
+    __VTPRINTENTER( "DialCtrl.ctor" )
+    // Disable blind icon drawing
+    SetRenderingHint( ENoBlindIcon );
+    __VTPRINTEXIT( "DialCtrl.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiDialerVideoControl::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiDialerVideoControl::ConstructL()
+    {
+    __VTPRINTENTER( "DialCtrl.ConstructL" )
+    BaseConstructL();
+    __VTPRINTEXIT( "DialCtrl.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiDialerVideoControl::WaitingTextLayout
+// -----------------------------------------------------------------------------
+//
+TAknTextLineLayout CVtUiDialerVideoControl::WaitingTextLayout( TInt aLine )
+    {
+    __VTPRINTENTER( "DialCtrl.WaitingTextLayout" )
+
+    TInt variety( Layout_Meta_Data::IsLandscapeOrientation() ?
+        KVarietyLandscape : KVarietyPortrait );
+
+    TAknWindowComponentLayout l2(
+        AknLayoutScalable_Apps::main_video_tele_dialer_pane( variety ) );
+
+    TAknTextComponentLayout l3;
+
+#if 0
+    if ( variety == KVarietyPortrait )
+        {
+        if ( !aLine )
+            {
+            l3 = AknLayoutScalable_Apps::main_video_tele_dialer_pane_t1( 0 );
+            }
+        else
+            {
+            l3 = AknLayoutScalable_Apps::main_video_tele_dialer_pane_t2( 0 );
+            }
+        }
+    else
+        {
+        if ( !aLine )
+            {
+            l3 = AknLayoutScalable_Apps::call_video_pane_t1();
+            }
+        else
+            {
+            l3 = AknLayoutScalable_Apps::call_video_pane_t2();
+            }
+        }
+#endif
+
+    if ( !aLine )
+        {
+        l3 = AknLayoutScalable_Apps::main_video_tele_dialer_pane_t1( 0 );
+        }
+    else
+        {
+        l3 = AknLayoutScalable_Apps::main_video_tele_dialer_pane_t2( 0 );
+        }
+    
+    __VTPRINTEXIT( "DialCtrl.WaitingTextLayout" )
+    return TAknWindowComponentLayout::ComposeText( l2, l3 ).LayoutLine();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiMainControl::LayoutRemoteVideo
+// -----------------------------------------------------------------------------
+//
+void CVtUiDialerVideoControl::LayoutRemoteVideo( )
+    {    
+    __VTPRINTENTER( "DialCtrl.LayoutRemoteVideo" )
+    if ( NULL != iRemoteVideoControl )
+        {
+        TRect rectRemoteVideo(StreamClippingRect());
+        rectRemoteVideo.Move(PositionRelativeToScreen());
+        iRemoteVideoControl->SetExtent(rectRemoteVideo.iTl,rectRemoteVideo.Size());
+        }
+    __VTPRINTEXIT( "DialCtrl.LayoutRemoteVideo" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/menu/cvtuimenucontext.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* 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:  Menu context class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuimenucontext.h"
+
+/** Menu context reference priority */
+const TInt KVtUiMenuContextPriority = 100;
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuContext::~CVtUiMenuContext
+// ---------------------------------------------------------------------------
+//
+CVtUiMenuContext::~CVtUiMenuContext()
+    {
+    __VTPRINTENTER( "MenuCtx.~" )
+    UnregisterCommandContext();
+    __VTPRINTEXIT( "MenuCtx.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuContext::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiMenuContext* CVtUiMenuContext::NewL(
+    MVtUiCommandManager& aCommandManager )
+    {
+    __VTPRINTENTER( "MenuCtx.NewL" )
+    CVtUiMenuContext* self = new ( ELeave ) CVtUiMenuContext( aCommandManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "MenuCtx.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuContext::ValidateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenuContext::ValidateL( CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "MenuCtx.ValidateL" )
+    ValidateMenuItemsL( aAction );
+    __VTPRINTEXIT( "MenuCtx.ValidateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuContext::CVtUiMenuContext
+// ---------------------------------------------------------------------------
+//
+CVtUiMenuContext::CVtUiMenuContext( MVtUiCommandManager& aCommandManager )
+    : CVtUiCmdContext( aCommandManager, EVtUiCmdContextTypeMenu,
+      KVtUiMenuContextPriority )
+    {
+    __VTPRINTENTER( "MenuCtx.ctor" )
+    __VTPRINTEXIT( "MenuCtx.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuContext::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenuContext::ConstructL()
+    {
+    __VTPRINTENTER( "MenuCtx.ConstructL" )
+    RegisterCommandContextL();
+    __VTPRINTEXIT( "MenuCtx.ConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/menu/cvtuimenuitemdimmeraction.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* 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:  Menu item dimmer action class.
+*
+*/
+
+
+#include <cvtlogger.h>
+#include <eikmenup.h>
+
+#include "cvtuimenuitemdimmeraction.h"
+#include "tvtuicmdvalidatorcallback.h"
+#include "tvtuimenucommanditerator.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuItemDimmerAction::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiMenuItemDimmerAction* CVtUiMenuItemDimmerAction::NewL()
+    {
+    __VTPRINTENTER( "MenuDimAct.NewL" )
+    CVtUiMenuItemDimmerAction* self =
+        new ( ELeave ) CVtUiMenuItemDimmerAction();
+    __VTPRINTEXIT( "MenuDimAct.NewL" )
+    return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuItemDimmerAction::SetMenuPane
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenuItemDimmerAction::SetMenuPane( CEikMenuPane* aMenuPane )
+    {
+    __VTPRINTENTER( "MenuDimAct.SetMenuPane" )
+    iMenuPane = aMenuPane;
+    __VTPRINTEXIT( "MenuDimAct.SetMenuPane" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuItemDimmerAction::ProcessL
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenuItemDimmerAction::ProcessL(
+    const MVtUiCmdValidatorCallBack& aCallBack )
+    {
+    __VTPRINTENTER( "MenuDimAct.ProcessL" )
+
+    if ( iMenuPane )
+        {
+        for ( TVtUiMenuCommandIterator i( *iMenuPane ); i.HasNext(); )
+            {
+            TInt commandId( i.Next() );
+        	if ( !IsCommandHandled( commandId ) )
+        	    {
+                if ( aCallBack.Call( commandId ) )
+                    {
+            	    CommandHandledL( commandId );
+            	    SetItemDimmed( commandId );
+                    }
+        	    }
+            }
+        }
+    __VTPRINTEXIT( "MenuDimAct.ProcessL" )
+	}
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuItemDimmerAction::EndProcess
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenuItemDimmerAction::EndProcess()
+    {
+    __VTPRINTENTER( "MenuDimAct.EndProcess" )
+    iMenuPane = NULL;
+    __VTPRINTEXIT( "MenuDimAct.EndProcess" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuItemDimmerAction::CVtUiMenuItemDimmerAction
+// ---------------------------------------------------------------------------
+//
+CVtUiMenuItemDimmerAction::CVtUiMenuItemDimmerAction()
+    {
+    __VTPRINTENTER( "MenuDimAct.ctor" )
+    __VTPRINTEXIT( "MenuDimAct.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenuItemDimmerAction::SetItemDimmed
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenuItemDimmerAction::SetItemDimmed( TInt aCommandId )
+    {
+    __VTPRINTENTER( "MenuDimAct.SetItemDimmed" )
+    iMenuPane->SetItemDimmed( aCommandId, ETrue );
+    __VTPRINTEXIT( "MenuDimAct.SetItemDimmed" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/menu/cvtuimenus.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2006 - 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:  Mennu Ui feature class.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuimenus.h"
+#include "cvtuimenucontext.h"
+#include "cvtuimenuitemdimmeraction.h"
+#include "cvtuifeaturemanager.h"
+#include "cvtuicommandmanager.h"
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiMenus* CVtUiMenus::NewL( CVtUiFeatureManager& aFeatureManager )
+    {
+    __VTPRINTENTER( "Menus.NewL" )
+    CVtUiMenus* self = new ( ELeave ) CVtUiMenus( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "Menus.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::~CVtUiMenus
+// ---------------------------------------------------------------------------
+//
+CVtUiMenus::~CVtUiMenus()
+    {
+    __VTPRINTENTER( "Menus.~" )    
+    delete iMenuCommandContext;
+    delete iMenuDimmerAction;
+    __VTPRINTEXIT( "Menus.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::SetMenuPane
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenus::SetMenuPane( CEikMenuPane* aMenuPane )
+    {
+    __VTPRINTENTER( "Menus.SetMenuPane" )
+    iMenuDimmerAction->SetMenuPane( aMenuPane );
+    __VTPRINTEXIT( "Menus.SetMenuPane" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenus::StartL()
+    {
+    __VTPRINTENTER( "Menus.StartL" )
+    __VTPRINTEXIT( "Menus.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenus::Stop()
+    {
+    __VTPRINTENTER( "Menus.Stop" )
+    __VTPRINTEXIT( "Menus.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::InitFeatureL
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenus::InitFeatureL()
+    {
+    __VTPRINTENTER( "Menus.InitFeatureL" )
+    __VTPRINTEXIT( "Menus.InitFeatureL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::RefreshL
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenus::RefreshL()
+    {
+    __VTPRINTENTER( "Menus.RefreshL" )
+    iFeatureManager.CommandManager().ValidateMenuItemsL( *iMenuDimmerAction );
+    __VTPRINTEXIT( "Menus.RefreshL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::AddCommandModifier
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiMenus::AddCommandModifier( CVtUiCommandModifyBase& )
+    {
+    __VTPRINTENTER( "Menus.AddCommandModifier" )
+    __VTPRINTEXIT( "Menus.AddCommandModifier" )
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::RemoveCommandModifier
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenus::RemoveCommandModifier( CVtUiCommandModifyBase& )
+    {
+    __VTPRINTENTER( "Menus.RemoveCommandModifier" )
+    __VTPRINTEXIT( "Menus.RemoveCommandModifier" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::CVtUiMenus
+// ---------------------------------------------------------------------------
+//
+CVtUiMenus::CVtUiMenus( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiFeatureBase( EVtUiFeatureIdMenu, aFeatureManager )
+    {
+    __VTPRINTENTER( "Menus.ctor" )
+    __VTPRINTEXIT( "Menus.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiMenus::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiMenus::ConstructL()
+    {
+    __VTPRINTENTER( "Menus.ConstructL" )
+    iMenuCommandContext =
+        CVtUiMenuContext::NewL( iFeatureManager.CommandManager() );
+    iMenuDimmerAction = CVtUiMenuItemDimmerAction::NewL();
+    
+    // No need to add this to command manager as command UI. Menu is explicitly
+    // updated by CVtUiAppUi::DynInitMenuPaneL and in all other situations
+    // update is not needed because menu is not open. 
+    // NOTE: If a command modifier is implemented for menu then it needs
+    // to be added to command UI.
+    __VTPRINTEXIT( "Menus.ConstructL" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/menu/tvtuimenucommanditerator.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* 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:  Menu command iterator.
+*
+*/
+
+
+#include <eikmenup.h>
+
+#include "tvtuimenucommanditerator.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// TVtUiMenuCommandIterator::TVtUiMenuCommandIterator
+// ---------------------------------------------------------------------------
+//
+TVtUiMenuCommandIterator::TVtUiMenuCommandIterator( CEikMenuPane& aMenuPane )
+: iMenuPane( &aMenuPane ), iCurrent( 0 )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// TVtUiMenuCommandIterator::HasNext
+// ---------------------------------------------------------------------------
+//
+TBool TVtUiMenuCommandIterator::HasNext() const
+    {
+    return ( iCurrent < iMenuPane->NumberOfItemsInPane() );
+    }
+
+// ---------------------------------------------------------------------------
+// TVtUiMenuCommandIterator::Next
+// ---------------------------------------------------------------------------
+//
+TInt TVtUiMenuCommandIterator::Next()
+    {
+    return iMenuPane->MenuItemCommandId( iCurrent++ );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/numberentry/CVtUiNumberEntryControl.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,315 @@
+/*
+* Copyright (c) 2004-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:  Implementation of the CVtUiNumberEntryControl control class.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CVtUiNumberEntryControl.h"
+#include    "VtUiLayout.h"
+#include    "VtUiUtility.h"
+#include    "mvtuicomponentmanager.h"
+#include    "tvtuistates.h"
+#include    "tvtuiwsevent.h"
+#include    "mvtuifeature.h"
+#include    "mvtuinumberentrycontrolobserver.h"
+#include    "cvtuidtmfbuffer.h"
+
+#include    <aknsutils.h>
+#include    <cvtlogger.h>
+#include    <eikenv.h>
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Implementation for TVtUiNumberEntryComponentState
+
+// -----------------------------------------------------------------------------
+// TVtUiNumberEntryComponentState::TVtUiNumberEntryComponentState
+// -----------------------------------------------------------------------------
+//
+TVtUiNumberEntryComponentState::TVtUiNumberEntryComponentState(
+    MVtUiComponent& aComponent )
+    : TVtUiComponentState( aComponent,
+        TVtUiBlockListBitField(
+            MVtUiComponent::EComponentIdDialer ) )
+    {
+    }
+
+// Implementation for CVtUiNumberEntryControl
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::CVtUiNumberEntryControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiNumberEntryControl::CVtUiNumberEntryControl(
+        MVtUiFeature& aFeature,
+        TVtUiStates& aUiStates )
+    : iFeature( aFeature ),
+      iComponentState( *this ),
+      iUiStates( aUiStates )
+    {
+    __VTPRINTENTER( "NECtrl.ctor" )
+    __VTPRINTEXIT( "NECtrl.ctor" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryControl::ConstructL( const TRect& aRect )
+    {
+    __VTPRINTENTER( "NECtrl.ConstructL" )
+    CreateWindowL();
+    SetRect( aRect );
+    ActivateL();
+    MakeVisible( EFalse );
+    iInputBuffer = CVtUiDTMFBuffer::NewL( *iCoeEnv );
+    __VTPRINTEXIT( "NECtrl.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::~CVtUiNumberEntryControl
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiNumberEntryControl::~CVtUiNumberEntryControl()
+    {
+    __VTPRINTENTER( "NECtrl.~" )
+    AknsUtils::DeregisterControlPosition( this );
+    delete iInputBuffer;
+    __VTPRINTEXIT( "NECtrl.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::OpenNumberEntry
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiNumberEntryControl::OpenNumberEntry()
+    {
+    __VTPRINTENTER( "NECtrl.OpenNumberEntry" )
+    TBool result( EFalse );
+    if ( !iUiStates.IsNumberEntryOpen() )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUiNumberEntry.OPEN" )
+        iInputBuffer->Activate();
+        iUiStates.SetIsNumberEntryOpen( ETrue );
+        result = ETrue;
+        }
+    __VTPRINTEXITR( "NECtrl.OpenNumberEntry %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::IsNumberEntryOpen
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiNumberEntryControl::IsNumberEntryOpen() const
+    {
+    __VTPRINTENTER( "NECtrl.IsNumberEntryOpen" )
+    const TBool result( iUiStates.IsNumberEntryOpen() );
+    __VTPRINTEXITR( "NECtrl.IsNumberEntryOpen %d",result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::CloseNumberEntry
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryControl::CloseNumberEntry()
+    {
+    __VTPRINTENTER( "NECtrl.CloseNumberEntry" )
+    if ( iUiStates.IsNumberEntryOpen() )
+        {
+        __VTPRINT( DEBUG_GEN, "NECtrl.CloseNumberEntry CLOSE" )
+        iUiStates.SetIsNumberEntryOpen( EFalse );
+        iInputBuffer->Deactivate();
+        }
+    __VTPRINTEXIT( "NECtrl.CloseNumberEntry" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::RegisterComponentL
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryControl::RegisterComponentL(
+    MVtUiComponentManager& aComponentManager )
+    {
+    __VTPRINTENTER( "NECtrl.RegisterComponentL" )
+    User::LeaveIfError( aComponentManager.ChangeComponentRegistration(
+        iComponentState, MVtUiComponentManager::ERegister ) );
+    __VTPRINTEXIT( "NECtrl.RegisterComponentL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::UnregisterComponent
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryControl::UnregisterComponent(
+    MVtUiComponentManager& aComponentManager )
+    {
+    __VTPRINTENTER( "NECtrl.UnregisterComponent" )
+    iInputBuffer->Reset();
+    aComponentManager.ChangeComponentRegistration( iComponentState,
+        MVtUiComponentManager::EUnregister );
+    __VTPRINTEXIT( "NECtrl.UnregisterComponent" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::SetNumberEntryControlObserver
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryControl::SetNumberEntryControlObserver(
+    MVtUiNumberEntryControlObserver* aObserver )
+    {
+    __VTPRINTENTER( "NECtrl.SetNumberEntryControlObserver" )
+    iControlObserver = aObserver;
+    __VTPRINTEXIT( "NECtrl.SetNumberEntryControlObserver" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::OfferKeyEventL
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CVtUiNumberEntryControl::OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode )
+    {
+    __VTPRINTENTER( "NECtrl.OfferKeyEventL" )
+
+    TKeyResponse resp( EKeyWasNotConsumed );
+
+    if ( IsDisplayingMenuOrDialog() ||
+        aKeyEvent.iCode == EKeyLeftArrow ||
+        aKeyEvent.iCode == EKeyRightArrow ||
+        aKeyEvent.iCode == EKeyUpArrow ||
+        aKeyEvent.iCode == EKeyDownArrow ||
+        aKeyEvent.iCode == EKeyBackspace ||
+        aKeyEvent.iCode == EKeyZoomIn ||
+        aKeyEvent.iCode == EKeyZoomOut ||
+        aKeyEvent.iScanCode == EStdKeyUpArrow ||
+        aKeyEvent.iScanCode == EStdKeyDownArrow ||
+        aKeyEvent.iScanCode == EStdKeyLeftArrow ||
+        aKeyEvent.iScanCode == EStdKeyRightArrow )
+        {
+        return resp;
+        }
+
+    TChar dtmfTone;
+    if ( VtUiUtility::IsDTMFEvent( aKeyEvent, dtmfTone ) )
+        {
+        iInputBuffer->Append( dtmfTone );
+        }
+
+    __VTPRINTEXITR( "NECtrl.OfferKeyEvent %d", resp )
+    return resp;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::DoCloseNumberEntry
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiNumberEntryControl::DoCloseNumberEntry( TAny* aAny )
+    {
+    __VTPRINTENTER( "NECtrl.DoCloseNumberEntry" )
+    CVtUiNumberEntryControl* self =
+        reinterpret_cast< CVtUiNumberEntryControl* >( aAny );
+    self->HandleTimeoutCloseNumberEntry();
+    __VTPRINTEXIT( "NECtrl.DoCloseNumberEntry" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::HandleTimeoutCloseNumberEntry
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryControl::HandleTimeoutCloseNumberEntry()
+    {
+    __VTPRINTENTER( "NECtrl.HandleTimeoutCloseNumberEntry" )
+    __VTPRINTEXIT( "NECtrl.HandleTimeoutCloseNumberEntry" )
+    iFeature.Stop();
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::IsDisplayingMenuOrDialog
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiNumberEntryControl::IsDisplayingMenuOrDialog() const
+    {
+    __VTPRINTENTER( "NECtrl.IsDisplayingMenuOrDialog" )
+    CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar();
+    const TBool result( CCoeEnv::Static()->AppUi()->IsDisplayingDialog() ||
+        ( menuBar && menuBar->IsDisplayed() ) );
+    __VTPRINTEXITR( "NECtrl.IsDisplayingMenuOrDialog %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::ComponentId
+// -----------------------------------------------------------------------------
+//
+MVtUiComponent::TComponentId CVtUiNumberEntryControl::ComponentId() const
+    {
+    __VTPRINTENTER( "NECtrl.ComponentId" )
+    __VTPRINTEXIT( "NECtrl.ComponentId" )
+    return MVtUiComponent::EComponentIdNumberEntry;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::ComponentAsControl
+// -----------------------------------------------------------------------------
+//
+CCoeControl* CVtUiNumberEntryControl::ComponentAsControl()
+    {
+    __VTPRINTENTER( "NECtrl.ComponentAsControl" )
+    __VTPRINTEXIT( "NECtrl.ComponentAsControl" )
+    return this;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::DoActivateL
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryControl::DoActivateL()
+    {
+    __VTPRINTENTER( "NECtrl.DoActivateL" )
+    OpenNumberEntry();
+    if ( iControlObserver )
+        {
+        iControlObserver->ControlActivatedL();
+        }
+    __VTPRINTEXIT( "NECtrl.DoActivateL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::DoDeactivateL
+// -----------------------------------------------------------------------------
+//
+void CVtUiNumberEntryControl::DoDeactivateL()
+    {
+    __VTPRINTENTER( "NECtrl.DoDeactivateL" )
+    CloseNumberEntry();
+    if ( iControlObserver )
+        {
+        iControlObserver->ControlDeactivated();
+        }
+    __VTPRINTEXIT( "NECtrl.DoDeactivateL" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/numberentry/cvtuinumberentry.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,215 @@
+/*
+* 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:  Number entry UI feature implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuinumberentry.h"
+#include "cvtuifeaturemanager.h"
+#include "mvtuicommandmanager.h"
+#include "mvtuicomponentmanager.h"
+#include "mvtuicommandui.h"
+#include "tvtuifeatureids.h"
+#include "CVtUiNumberEntryControl.h"
+#include "CVtUiAppUi.h"
+
+
+// We need this to be able to make control's priority lower than activation
+// control's priority is
+extern const TInt KVtUiNumberEntryActivationPriority;
+
+// Priority of number entry control.
+const TInt KVtUiNumberEntryControlPriorityHidden =
+    KVtUiNumberEntryActivationPriority - 1;
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiNumberEntry* CVtUiNumberEntry::NewL(
+    CVtUiFeatureManager& aFeatureManager )
+    {
+    __VTPRINTENTER( "NE.NewL" )
+    CVtUiNumberEntry* self =
+        new ( ELeave ) CVtUiNumberEntry( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "NE.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::~CVtUiNumberEntry
+// ---------------------------------------------------------------------------
+//
+CVtUiNumberEntry::~CVtUiNumberEntry()
+    {
+    __VTPRINTENTER( "NE.~" )
+    DeleteNumberEntryControl();
+    __VTPRINTEXIT( "NE.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::StartL()
+    {
+    __VTPRINTENTER( "NE.StartL" )
+    if ( State() == MVtUiFeature::EUnprepared )
+        {
+        PrepareL();
+        iFeatureManager.ComponentManager().RequestActivationL(
+            MVtUiComponent::EComponentIdNumberEntry );
+        iFeatureState = MVtUiFeature::EActive;
+        }
+    __VTPRINTEXIT( "NE.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::Stop()
+    {
+    __VTPRINTENTER( "NE.Stop" )
+    if ( State() == MVtUiFeature::EActive )
+        {
+        TRAP_IGNORE( iFeatureManager.ComponentManager().DeActivateComponentL(
+            MVtUiComponent::EComponentIdNumberEntry ) );
+        iFeatureState = MVtUiFeature::EReady;
+        }
+    Unprepare();
+    __VTPRINTEXIT( "NE.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::InitFeatureL
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::InitFeatureL()
+    {
+    __VTPRINTENTER( "NE.InitFeatureL" )
+    CreateNumberEntryControlL();
+    __VTPRINTEXIT( "NE.InitFeatureL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::ControlActivated
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::ControlActivatedL()
+    {
+    __VTPRINTENTER( "NE.ControlActivatedL" )
+    __VTPRINTEXIT( "NE.ControlActivatedL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::ControlDeactivated
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::ControlDeactivated()
+    {
+    __VTPRINTENTER( "NE.ControlDeactivated" )
+    __VTPRINTEXIT( "NE.ControlDeactivated" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::CVtUiNumberEntry
+// ---------------------------------------------------------------------------
+//
+CVtUiNumberEntry::CVtUiNumberEntry( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiFeatureBase( EVtUiFeatureIdNumberEntry, aFeatureManager )
+    {
+    __VTPRINTENTER( "NE.ctor" )
+    __VTPRINTEXIT( "NE.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::ConstructL()
+    {
+    __VTPRINTENTER( "NE.ConstructL" )
+    BaseConstructL();
+    __VTPRINTEXIT( "NE.ConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::PrepareL
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::PrepareL()
+    {
+    __VTPRINTENTER( "NE.PrepareL" )
+    iNumberEntryControl->SetNumberEntryControlObserver( this );
+    iNumberEntryControl->RegisterComponentL(
+        iFeatureManager.ComponentManager() );
+    iFeatureManager.AppUi().AddToStackL( iNumberEntryControl,
+        KVtUiNumberEntryControlPriorityHidden, ECoeStackFlagRefusesFocus );
+    iFeatureState = MVtUiFeature::EReady;
+    __VTPRINTEXIT( "NE.PrepareL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::Unprepare()
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::Unprepare()
+    {
+    __VTPRINTENTER( "NE.Unprepare" )
+    if ( iFeatureState > MVtUiFeature::EUnprepared )
+	    {
+	    iNumberEntryControl->SetNumberEntryControlObserver( NULL );
+	    iFeatureManager.AppUi().RemoveFromStack( iNumberEntryControl );
+	    iNumberEntryControl->UnregisterComponent(
+	        iFeatureManager.ComponentManager() );
+	    iFeatureState = MVtUiFeature::EUnprepared;
+	  	}
+    __VTPRINTEXIT( "NE.Unprepare" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::CreateNumberEntryControlL
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::CreateNumberEntryControlL()
+    {
+    __VTPRINTENTER( "NE.CreateNumberEntryControlL" )
+    iNumberEntryControl = new ( ELeave ) CVtUiNumberEntryControl( *this,
+        iFeatureManager.UiStates() );
+    iNumberEntryControl->ConstructL( TRect() );
+    iNumberEntryControl->SetMopParent( &iFeatureManager.AppUi() );
+    __VTPRINTEXIT( "NE.CreateNumberEntryControlL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiNumberEntry::DeleteNumberEntryControl
+// ---------------------------------------------------------------------------
+//
+void CVtUiNumberEntry::DeleteNumberEntryControl()
+    {
+    __VTPRINTENTER( "NE.DeleteNumberEntryControl" )
+    delete iNumberEntryControl;
+    iNumberEntryControl = NULL;
+    iFeatureState = MVtUiFeature::EUnprepared;
+    __VTPRINTEXIT( "NE.DeleteNumberEntryControl" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuibrightness.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,101 @@
+/*
+* 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:  implementation.
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    "cvtuibrightness.h"
+#include    "tvtuifeatureids.h"
+#include    "cvtuibrightnesspopup.h"
+#include    "cvtuipopupbase.h"
+#include    "cvtuiprefsliderbase.h"
+#include    "videotelui.hrh"
+#include    "cvtuifeaturemanager.h"
+#include    "tvtuistates.h"
+
+// ---------------------------------------------------------------------------
+// CVtUiBrightness::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiBrightness* CVtUiBrightness::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiBrightness.NewL" )
+    CVtUiBrightness* self =
+        new ( ELeave ) CVtUiBrightness( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiBrightness.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiBrightness::~CVtUiBrightness
+// ---------------------------------------------------------------------------
+//
+CVtUiBrightness::~CVtUiBrightness()
+    {
+    __VTPRINTENTER( "CVtUiBrightness.~" )
+    __VTPRINTEXIT( "CVtUiBrightness.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiBrightness::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiBrightness::StartL()
+    {
+    __VTPRINTENTER( "CVtUiBrightness.StartL" )
+    CVtUiPrefSliderBase::StartL();
+    iFeatureManager.UiStates().SetBrightnessModeOn( ETrue );
+    __VTPRINTEXIT( "CVtUiBrightness.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiBrightness::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiBrightness::Stop()
+    {
+    __VTPRINTENTER( "CVtUiBrightness.Stop" )
+    CVtUiPrefSliderBase::Stop();
+    iFeatureManager.UiStates().SetBrightnessModeOn( EFalse );
+    __VTPRINTEXIT( "CVtUiBrightness.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiBrightness::CVtUiBrightness
+// ---------------------------------------------------------------------------
+//
+CVtUiBrightness::CVtUiBrightness( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiPrefSliderBase( aFeatureManager, EVtUiFeatureIdBrightness )
+    {
+    __VTPRINTENTER( "CVtUiBrightness.CVtUiBrightness" )
+    __VTPRINTEXIT( "CVtUiBrightness.CVtUiBrightness" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiBrightness::CVtUiBrightness
+// ---------------------------------------------------------------------------
+//
+void CVtUiBrightness:: ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiBrightness.ConstructL" )
+    BaseConstructL();
+    SetPopup( CVtUiBrightnessPopup::NewL( iFeatureManager ) );
+    __VTPRINTEXIT( "CVtUiBrightness.ConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuibrightnesspopup.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* 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:  implementation.
+*
+*/
+
+
+
+#include    <mvtengmedia.h>
+#include    <cvtlogger.h>
+#include    "cvtuibrightnesspopup.h"
+#include	"tvtuilocalvariation.h"
+#include    "mvtuicomponent.h"
+#include    "CVtUiAppUi.h"
+#include    "mvtuicomponentmanager.h"
+#include    "tvtuicomponentstate.h"
+#include    <mvtengcamerapreferences.h>
+
+// ---------------------------------------------------------------------------
+// CVtUiBrightnessPopup::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiBrightnessPopup* CVtUiBrightnessPopup::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiBrightnessPopup.NewL" )
+    CVtUiBrightnessPopup* self =
+        new ( ELeave ) CVtUiBrightnessPopup( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiBrightnessPopup.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiBrightnessPopup::~CVtUiBrightnessPopup
+// ---------------------------------------------------------------------------
+//
+CVtUiBrightnessPopup::~CVtUiBrightnessPopup()
+    {
+    __VTPRINTENTER( "CVtUiBrightnessPopup.~" )
+    __VTPRINTEXIT( "CVtUiBrightnessPopup.~" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CVtUiBrightnessPopup::CurrentValue
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiBrightnessPopup::CurrentValue()
+    {
+    __VTPRINTENTER( "CVtUiBrightnessPopup.CurrentValue" )
+    // ask from engine current value
+    TInt value;
+    if ( iCameraPref->GetBrightness( value) )
+        {
+        __VTPRINTEXIT( "CVtUiBrightnessPopup.CurrentValueERR" )
+        return 0;
+        }
+    __VTPRINTEXIT( "CVtUiBrightnessPopup.CurrentValue" )
+    return value;
+    }    
+// ---------------------------------------------------------------------------
+// CVtUiBrightnessPopup::CVtUiBrightnessPopup
+// ---------------------------------------------------------------------------
+//
+CVtUiBrightnessPopup::CVtUiBrightnessPopup( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiPrefPopupBase( aFeatureManager, TVtUiBlockListBitField(
+        MVtUiComponent::EComponentIdDialer |
+        MVtUiComponent::EComponentIdToolbar |
+        MVtUiComponent::EComponentIdNumberEntry |
+        MVtUiComponent::EComponentIdVolume |
+        MVtUiComponent::EComponentIdZoom |
+        MVtUiComponent::EVComponentIdContrast ), EVComponentIdBrightness,
+        KVtEngSetBrightness ) 
+    {
+
+    __VTPRINTENTER( "CVtUiBrightnessPopup.CVtUiBrightnessPopup" )
+    __VTPRINTEXIT( "CVtUiBrightnessPopup.CVtUiBrightnessPopup" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CVtUiBrightnessPopup::CVtUiBrightnessPopup
+// ---------------------------------------------------------------------------
+//
+void CVtUiBrightnessPopup:: ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiBrightnessPopup.ConstructL" )
+    BaseConstructL();
+    __VTPRINTEXIT( "CVtUiBrightnessPopup.ConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuicolortone.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,383 @@
+/*
+* Copyright (c) 2006 - 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:  Color tone UI feature implementation.
+*
+*/
+
+
+#include    <mvtengmedia.h>
+#include    <cvtengmodel.h>
+#include    <mvtengcamerapreferences.h>
+#include    <cvtlogger.h>
+#include    "cvtuicolortone.h"
+#include    "tvtuifeatureids.h"
+#include    <videotelui.rsg>
+#include    "mvtuicomponentmanager.h"
+#include    "cvtuifeaturemanager.h"
+#include    "CVtUiAppUi.h"
+#include	"tvtuilocalvariation.h"
+#include    "cvtuifeaturemanager.h"
+#include    "tvtuistates.h"
+#include    "cvtuicommandmanager.h"
+
+// Implementation of TVtUiColorToneComponentState
+
+// ---------------------------------------------------------------------------
+// TVtUiColorToneComponentState::TVtUiColorToneComponentState
+// ---------------------------------------------------------------------------
+//
+TVtUiColorToneComponentState::TVtUiColorToneComponentState(
+    MVtUiComponent& aComponent ) :
+    TVtUiComponentState( aComponent,
+        TVtUiBlockListBitField(
+            MVtUiComponent::EComponentIdDialer |
+            MVtUiComponent::EComponentIdToolbar |
+            MVtUiComponent::EComponentIdNumberEntry ) )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiColorTone* CVtUiColorTone::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "UiColorTone.NewL" )
+    CVtUiColorTone* self =
+        new ( ELeave ) CVtUiColorTone( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "UiColorTone.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::~CVtUiColorTone
+// ---------------------------------------------------------------------------
+//
+CVtUiColorTone::~CVtUiColorTone()
+    {
+    __VTPRINTENTER( "UiColorTone.~" )
+    // unregister layout change
+    iFeatureManager.ComponentManager().ChangeLayoutChangeRegistration(
+        *this, MVtUiComponentManager::EUnregister );
+     // unregister component
+    iFeatureManager.ComponentManager().ChangeComponentRegistration(
+        iComponentState, MVtUiComponentManager::EUnregister );
+    __VTPRINTEXIT( "UiColorTone.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiColorTone::StartL()
+    {
+    __VTPRINTENTER( "UiColorTone.StartL" )
+    if ( iFeatureState  == MVtUiFeature::EReady )
+        {
+        iFeatureManager.AppUi().EnableCommandActivatingAndCleanupPushL();
+        iFeatureManager.UiStates().SetIsFixedToolbarVisible( EFalse );        
+        iFeatureManager.ComponentManager().
+            RequestActivationL ( MVtUiComponent::EComponentIdColorTone );
+        CleanupStack::Pop(); // EnableCommandActivatingAndCleanupPushL
+        // set state
+        iFeatureState  = MVtUiFeature::EActive;
+        }
+    __VTPRINTEXIT( "UiColorTone.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiColorTone::Stop()
+    {
+    __VTPRINTENTER( "UiColorTone.Stop" )
+    iAsyncCallback->Cancel();
+    iAsyncCallback->Set( TCallBack( &DoStopL, this ) );
+    iAsyncCallback->CallBack();
+    __VTPRINTEXIT( "UiColorTone.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::InitFeatureL
+// ---------------------------------------------------------------------------
+//
+void CVtUiColorTone::InitFeatureL()
+    {
+    __VTPRINTENTER( "UiColorTone.InitFeatureL" )
+    CVtUiPrefSettingListBase::InitFeatureL();
+    User::LeaveIfError(
+       iFeatureManager.ComponentManager().ChangeComponentRegistration(
+       iComponentState, MVtUiComponentManager::ERegister ) );
+    User::LeaveIfError(
+       iFeatureManager.ComponentManager().ChangeLayoutChangeRegistration(
+       *this, MVtUiComponentManager::ERegister ) );
+    iFeatureState  = EReady;
+    __VTPRINTEXIT( "UiColorTone.InitFeatureL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::ComponentId
+// ---------------------------------------------------------------------------
+//
+MVtUiComponent::TComponentId CVtUiColorTone::ComponentId() const
+    {
+    __VTPRINTENTER( "UiColorTone.ComponentId" )
+    __VTPRINTEXIT( "UiColorTone.ComponentId" )
+    return MVtUiComponent::EComponentIdColorTone;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::ComponentAsControl
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CVtUiColorTone::ComponentAsControl()
+    {
+    __VTPRINTENTER( "UiColorTone.ComponentAsControl" )
+    __VTPRINTEXIT( "UiColorTone.ComponentAsControl" )
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::DoActivateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiColorTone::DoActivateL()
+    {
+    __VTPRINTENTER( "UiColorTone.DoActivateL" )
+    // get supported color tone modes
+    iCameraPref->GetSupportedColorTones( iSupportedModes );
+    __VTPRINT2( DEBUG_GEN, "UiColorTone.ConstructL=%d", iSupportedModes )
+    iFeatureManager.UiStates().SetColorToneModeOn( ETrue );
+    iAsyncCallback->Cancel();
+    iAsyncCallback->Set( TCallBack( &DoStartL, this ) );
+    iAsyncCallback->CallBack();
+    __VTPRINTEXIT( "UiColorTone.DoActivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::DoDeactivateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiColorTone::DoDeactivateL()
+    {
+    __VTPRINTENTER( "UiColorTone.DoDeactivateL" )
+    iFeatureManager.UiStates().SetColorToneModeOn( EFalse );
+    CVtUiPrefSettingListBase::StopSettingPageL();
+    __VTPRINTEXIT( "UiColorTone.DoDeactivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::HandleLayoutChangeL
+// ---------------------------------------------------------------------------
+//
+void CVtUiColorTone::HandleLayoutChangeL()
+    {
+    __VTPRINTENTER( "UiColorTone.HandleLayoutChangeL" )
+    if ( iFeatureState  == MVtUiFeature::EActive )
+        {
+        SizeChanged();
+        }
+    __VTPRINTEXIT( "UiColorTone.HandleLayoutChangeL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::CurrentSelection
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiColorTone::CurrentSelection()
+    {
+    __VTPRINTENTER( "UiColorTone.CurrentSelection" )
+    // ask from engine which item is currently active
+    MVtEngCameraPreferences::TColorTone wb;
+    if ( iCameraPref->GetColorTone( wb ) )
+        {
+        __VTPRINTEXIT( "UiColorTone.CurrentSelectionERR" )
+        // if error occured return 0 i.e. first list item
+        return 0;
+        }
+    __VTPRINTEXIT( "UiColorTone.CurrentSelection" )
+    return MapCTEnumToArrayIndex( wb );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::SetItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiColorTone::SetItemsL( CDesCArray& aArray )
+    {
+    __VTPRINTENTER( "UiColorTone.SetItemsL<" )
+    __VTPRINT2( DEBUG_GEN, "UiColorTone.SetItemsL=%d", iSupportedModes )
+    // Normal mode allways supported
+    ReadAndAppendItemL( aArray, R_VIDEOTELUI_QTN_INCAL_CT_NORMAL_OPTION );
+    iActiveItems.Append( MVtEngCameraPreferences::ENormal );
+
+    if( iSupportedModes & MVtEngCameraPreferences::ESepia )
+        {
+        ReadAndAppendItemL( aArray, R_VIDEOTELUI_QTN_INCAL_SEPIA_OPTION );
+        iActiveItems.Append( MVtEngCameraPreferences::ESepia );
+        }
+    if( iSupportedModes & MVtEngCameraPreferences::EGrayscale )
+        {
+        ReadAndAppendItemL( aArray, R_VIDEOTELUI_QTN_INCAL_B_AND_W_OPTION );
+        iActiveItems.Append( MVtEngCameraPreferences::EGrayscale );
+        }
+    if( iSupportedModes & MVtEngCameraPreferences::ENegative )
+        {
+        ReadAndAppendItemL( aArray, R_VIDEOTELUI_QTN_INCAL_NEGATIVE_OPTION );
+        iActiveItems.Append( MVtEngCameraPreferences::ENegative );
+        }
+    __VTPRINTEXIT( "UiColorTone.SetItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::SettingPageResId
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiColorTone::SettingPageResId() const
+    {
+    __VTPRINTENTER( "UiColorTone.SettingPageResId" )
+    __VTPRINTEXIT( "UiColorTone.SettingPageResId" )
+    return R_VIDEOTELUI_COLOR_TONE_SETTING_PAGE;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::SettingPageItemChanged
+// ---------------------------------------------------------------------------
+//
+void CVtUiColorTone::SettingPageItemChangedL( TInt aIndex )
+    {
+    __VTPRINTENTER( "CVtUiColorTone.SettingPageItemChangedL" )
+    __VTPRINT2( DEBUG_GEN, "CVtUiColorTone.index=%d", aIndex )
+    if ( iFeatureManager.UiStates().ExecState() == TVtUiStates::EExecStateResetting )
+        {
+    __VTPRINTEXIT( "CVtUiColorTone.SettingPageItemChangedL" )
+        return;
+        }
+    // Map index to right color tone value
+    MVtEngCameraPreferences::TColorTone ct = MapArrayIndexToCTEnum( aIndex );
+
+    // cast the parameter
+    TPtrC8 params( reinterpret_cast< TUint8* >( &ct ),
+        sizeof( MVtEngCameraPreferences::TColorTone ) );
+
+    // Adjust color tone
+  MVtEngMedia::TCameraId currentCamId;
+    iFeatureManager.AppUi().Model().Media().GetCurrentCameraId( currentCamId );
+    if( currentCamId == MVtEngMedia::ESecondaryCamera  )
+        {
+        iFeatureManager.AppUi().DoExecuteCmdL( KVtEngSetColorTone, &params );
+        iPendingSettingChangeCmd = EFalse;
+        }
+    else
+        iPendingSettingChangeCmd = ETrue;
+    __VTPRINTEXIT( "CVtUiColorTone.SettingPageItemChangedL" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::CVtUiColorTone
+// ---------------------------------------------------------------------------
+//
+CVtUiColorTone::CVtUiColorTone( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiPrefSettingListBase( aFeatureManager, EVtUiFeatureIdColourTone ),
+    iComponentState( *this )
+    {
+    __VTPRINTENTER( "UiColorTone.UiColorTone" )
+    __VTPRINTEXIT( "UiColorTone.UiColorTone" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::MapCTEnumToArrayIndex
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiColorTone::MapCTEnumToArrayIndex( MVtEngCameraPreferences::
+    TColorTone& aColorTone ) const
+    {
+    __VTPRINTENTER( "CVtUiColorTone.MapCTEnumToArrayIndex" )
+    __VTPRINT2( DEBUG_GEN, "CVtUiColorTone.cpunt=%d", iActiveItems.Count() )
+    for ( TInt i = 0; i < iActiveItems.Count(); ++i )
+         {
+         if ( iActiveItems [ i ] ==  aColorTone  )
+             {
+             __VTPRINT2( DEBUG_GEN, "CVtUiColorTone.index=%d", i )
+             __VTPRINTEXIT( "CVtUiColorTone.MapCTEnumToArrayIndex" )
+             return i;
+             }
+         }
+     __VTPRINTEXIT( "CVtUiColorTone.MapCTEnumToArrayIndex" )
+     // not found
+     return KErrNotFound;
+    }
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::MapArrayIndexToCTEnum
+// ---------------------------------------------------------------------------
+//
+MVtEngCameraPreferences::TColorTone CVtUiColorTone::MapArrayIndexToCTEnum(
+    TInt aIndex) const
+    {
+    __VTPRINTENTER( "TColorTone.MapArrayIndexToCTEnum" )
+    __VTPRINT2( DEBUG_GEN, "TColorTone.index=%d", aIndex )
+    __VTPRINT2( DEBUG_GEN, "TColorTone.count=%d", iActiveItems.Count() )
+    const TInt count = iActiveItems.Count();
+    if ( count > 0 && aIndex < count && aIndex >= 0 )
+        {
+        __VTPRINTEXIT( "TColorTone.MapArrayIndexToCTEnum" )
+        return static_cast< MVtEngCameraPreferences::TColorTone >
+            ( iActiveItems[ aIndex ] );
+        }
+    else // not valid index return first item in the list
+        {
+        __VTPRINTEXIT( "TColorTone.MapArrayIndexToCTEnum_ERROR_INDEX" )
+        return static_cast< MVtEngCameraPreferences::TColorTone >
+            ( iActiveItems[ 0 ] );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::DoStop
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiColorTone::DoStopL( TAny* aAny )
+    {
+    __VTPRINTENTER( "CVtUiColorTone.DoStopL" )
+    CVtUiColorTone* self = static_cast< CVtUiColorTone* >( aAny );
+    if ( self->iFeatureState  == MVtUiFeature::EActive )
+        {
+        self->iFeatureManager.ComponentManager().
+            DeActivateComponentL ( MVtUiComponent::EComponentIdColorTone );
+        // set state
+        self->iFeatureState = MVtUiFeature::EReady;
+        }
+    __VTPRINTEXIT( "CVtUiColorTone.DoStopL" )
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiColorTone::DoStart
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiColorTone::DoStartL( TAny* aAny )
+    {
+    __VTPRINTENTER( "CVtUiColorTone.DoStart" )
+    CVtUiColorTone* self = static_cast< CVtUiColorTone* >( aAny );
+    self->CVtUiPrefSettingListBase::StartSettingPageL();
+    self->iFeatureManager.UiStates().SetIsCommandActivating( EFalse );
+    __VTPRINTEXIT( "CVtUiColorTone.DoStart" )
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuicontrast.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* 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:  implementation.
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    "cvtuicontrast.h"
+#include    "tvtuifeatureids.h"
+#include    "cvtuicontrastpopup.h"
+#include    "cvtuipopupbase.h"
+#include    "videotelui.hrh"
+#include    "cvtuifeaturemanager.h"
+#include    "tvtuistates.h"
+
+// ---------------------------------------------------------------------------
+// CVtUiContrast::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiContrast* CVtUiContrast::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiContrast.NewL" )
+    CVtUiContrast* self =
+        new ( ELeave ) CVtUiContrast( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiContrast.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContrast::~CVtUiContrast
+// ---------------------------------------------------------------------------
+//
+CVtUiContrast::~CVtUiContrast()
+    {
+    __VTPRINTENTER( "CVtUiContrast.~" )
+    __VTPRINTEXIT( "CVtUiContrast.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContrast::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiContrast::StartL()
+    {
+    __VTPRINTENTER( "CVtUiContrast.StartL" )  
+    CVtUiPrefSliderBase::StartL();
+    iFeatureManager.UiStates().SetContrastModeOn( ETrue );
+    __VTPRINTEXIT( "CVtUiContrast.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContrast::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiContrast::Stop()
+    {
+ 		__VTPRINTENTER( "CVtUiContrast.Stop" )    	
+    CVtUiPrefSliderBase::Stop();
+    iFeatureManager.UiStates().SetContrastModeOn( EFalse );
+    __VTPRINTEXIT( "CVtUiContrast.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContrast::CVtUiContrast
+// ---------------------------------------------------------------------------
+//
+CVtUiContrast::CVtUiContrast( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiPrefSliderBase( aFeatureManager, EVtUiFeatureIdContrast )
+    {
+    __VTPRINTENTER( "CVtUiContrast.CVtUiContrast" )
+    __VTPRINTEXIT( "CVtUiContrast.CVtUiContrast" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContrast::CVtUiContrast
+// ---------------------------------------------------------------------------
+//
+void CVtUiContrast:: ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiContrast.ConstructL" )
+    BaseConstructL();
+    SetPopup( CVtUiContrastPopup::NewL( iFeatureManager ) );
+    __VTPRINTEXIT( "CVtUiContrast.ConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuicontrastpopup.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* 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:  Implementation of Contrast popup
+*
+*/
+
+
+
+#include    <aknvolumepopup.h>
+#include    "cvtuicontrastpopup.h"
+#include    <cvtlogger.h>
+#include	"tvtuilocalvariation.h"
+#include    <mvtengmedia.h>
+#include    "mvtuicomponent.h"
+#include    "CVtUiAppUi.h"
+#include    <videotelui.mbg>
+#include    <mvtengcamerapreferences.h>
+
+// ---------------------------------------------------------------------------
+// CVtUiContrastPopup::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiContrastPopup* CVtUiContrastPopup::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiContrastPopup.NewL" )
+    CVtUiContrastPopup* self =
+        new ( ELeave ) CVtUiContrastPopup( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiContrastPopup.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContrastPopup::~CVtUiContrastPopup
+// ---------------------------------------------------------------------------
+//
+CVtUiContrastPopup::~CVtUiContrastPopup()
+    {
+    __VTPRINTENTER( "CVtUiContrastPopup.~" )
+    __VTPRINTEXIT( "CVtUiContrastPopup.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiContrastPopup::CurrentValue
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiContrastPopup::CurrentValue()
+    {
+    __VTPRINTENTER( "CVtUiContrastPopup.CurrentValue" )
+    // ask from engine current value
+    TInt value;
+    if ( iCameraPref->GetContrast( value) )
+        {
+        __VTPRINTEXIT( "CVtUiContrastPopup.CurrentValueERR" )
+        return 0;
+        }
+    __VTPRINTEXIT( "CVtUiContrastPopup.CurrentValue" )
+    return value;
+    }    
+
+// ---------------------------------------------------------------------------
+// CVtUiContrastPopup::CVtUiContrastPopup
+// ---------------------------------------------------------------------------
+//
+CVtUiContrastPopup::CVtUiContrastPopup( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiPrefPopupBase( aFeatureManager, TVtUiBlockListBitField(
+        MVtUiComponent::EComponentIdDialer |
+        MVtUiComponent::EComponentIdToolbar |
+        MVtUiComponent::EComponentIdNumberEntry |
+        MVtUiComponent::EComponentIdVolume |
+        MVtUiComponent::EComponentIdZoom |
+        MVtUiComponent::EVComponentIdBrightness ), EVComponentIdContrast,
+        KVtEngSetContrast ) 
+    {
+    __VTPRINTENTER( "CVtUiContrastPopup.CVtUiContrastPopup" )
+    __VTPRINTEXIT( "CVtUiContrastPopup.CVtUiContrastPopup" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CVtUiContrastPopup::CVtUiContrastPopup
+// ---------------------------------------------------------------------------
+//
+void CVtUiContrastPopup::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiContrastPopup.ConstructL" )
+    BaseConstructL();
+    __VTPRINTEXIT( "CVtUiContrastPopup.ConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuiprefpopupbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,189 @@
+/*
+* 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:  Implementation of base class for video preference popups
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    <mvtengcamerapreferences.h>
+#include    <cvtengmodel.h>
+
+#include    "cvtuiprefpopupbase.h"
+#include    "mvtuicomponentmanager.h"
+#include    "mvtuicomponentstateobserver.h"
+#include    "cvtuifeaturemanager.h"
+#include    "CVtUiAppUi.h"
+
+// Number of steps
+static const TInt KStepCount = 20;
+
+// Slider min value
+static const TInt KSLiderMinValue = -100;
+
+// Slider min value
+static const TInt KSLiderDefaultValue = 0;
+
+// Slider max value
+static const TInt KSLiderMaxValue = 100;
+
+// Min adjust value
+static const TInt KMinAdjustValue = 0;
+
+// Max adjust value
+static const TInt KMaxAdjustValue = 20;
+
+// default time out time for zoom popup
+const TInt KDefaultPrefTimeOutTime = 5;  
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefPopupBase::~CVtUiPrefPopupBase
+// ---------------------------------------------------------------------------
+//
+CVtUiPrefPopupBase::~CVtUiPrefPopupBase()
+    {
+    __VTPRINTENTER( "CVtUiPrefPopupBase.~CVtUiPrefPopupBase" )
+    __VTPRINTEXIT( "CVtUiPrefPopupBase.~CVtUiPrefPopupBase" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefPopupBase::HandleControlEventL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefPopupBase::HandleControlEventL(
+    CCoeControl* aControl,TCoeEvent aEventType )
+    {
+    __VTPRINTENTER( "CVtUiPrefPopupBase.HandleControlEventL" )
+    CVtUiPopupBase::HandleControlEventL( aControl, aEventType );
+    if ( aEventType == EEventStateChanged )
+        {
+        const TInt value( Value() );
+        if ( value != iCurrent )
+            {
+            __VTPRINT( DEBUG_GEN, "CVtUiPrefPopupBase.OfferKeyEventL  value != current " )
+            iCurrent = value;
+             __VTPRINT2( DEBUG_GEN, "CVtUiPrefPopupBase.HandleControlEventL  = %d", ScaledValue() )
+            AdjustVideoL( ScaledValue() );
+            }
+        }
+    
+    __VTPRINTEXIT( "CVtUiPrefPopupBase.HandleControlEventL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefPopupBase::UpdatePopupL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefPopupBase::UpdatePopupL()
+    {
+    __VTPRINTENTER( "CVtUiPrefPopupBase.UpdatePrefPopupL" )
+    
+    AdjustVideoL( ScaledValue() );
+    
+    __VTPRINTEXIT( "CVtUiPrefPopupBase.UpdatePrefPopupL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefPopupBase::OfferKeyEventL()
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CVtUiPrefPopupBase::OfferKeyEventL( const TKeyEvent& aEvent, 
+        TEventCode aCode )
+    {
+    __VTPRINTENTER( "CVtUiPrefPopupBase.OfferKeyEventL" )
+    TKeyResponse response = 
+        CVtUiPopupBase::OfferKeyEventL( aEvent, aCode );
+    
+    if ( response == EKeyWasConsumed )
+        {
+        AdjustVideoL( ScaledValue() );
+        }
+    
+    __VTPRINTEXIT( "CVtUiPrefPopupBase.OfferKeyEventL" )
+    return response;
+    }
+
+// CVtUiPrefPopupBase::AdjustVideoL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefPopupBase::AdjustVideoL( TInt aValue )
+    {
+    __VTPRINTENTER( "CVtUiPrefPopupBase.AdjustVideoL" )
+    // cast the parameter
+    TPtrC8 params( reinterpret_cast< TUint8* >( &aValue ), sizeof( TInt ) );
+
+    // Adjust Contrast
+    iFeatureManager.AppUi().DoExecuteCmdL( iEngineCommandId, &params );
+    __VTPRINTEXIT( "CVtUiPrefPopupBase.AdjustVideoL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefPopupBase::DoActivateL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefPopupBase::DoActivateL()
+    {
+    __VTPRINTENTER( "CVtUiPrefPopupBase.DoActivateL" )
+    CVtUiPopupBase::DoActivateL();
+    // Set current value
+    __VTPRINT2( DEBUG_GEN, "CVtUiPrefPopupBase.DoActivateL  = %d", CurrentValue() )
+    ScaleAndSetValue( CurrentValue() );
+    AdjustVideoL( ScaledValue() );
+    __VTPRINTEXIT( "CVtUiPrefPopupBase.DoActivateL" )
+    }
+
+// CVtUiPrefPopupBase::CVtUiPrefPopupBase
+// ---------------------------------------------------------------------------
+//
+CVtUiPrefPopupBase::CVtUiPrefPopupBase( CVtUiFeatureManager& aFeatureManager,
+  TVtUiBlockListBitField aBitField, TComponentId aComponentId, TInt aCmdId  ) :
+    CVtUiPopupBase( aFeatureManager.ComponentManager(), aBitField,
+    aComponentId ),  iFeatureManager( aFeatureManager ),
+    iEngineCommandId ( aCmdId )
+    {
+    __VTPRINTENTER( "CVtUiPrefPopupBase.CVtUiPrefPopupBase" )
+    __VTPRINTEXIT( "CVtUiPrefPopupBase.CVtUiPrefPopupBase" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefPopupBase::BaseConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefPopupBase::BaseConstructL()
+    {
+    __VTPRINTENTER( "CVtUiPrefPopupBase.BaseConstructL" )
+    CVtUiPopupBase::BaseConstructL();
+    // Get camera preferences extension.
+    iCameraPref = static_cast<MVtEngCameraPreferences*> ( iFeatureManager.
+        AppUi().Model().Extension( KVtEngExtensionCameraPreferences ) );
+
+    // Set range and step count for the slider
+    SetAdjustRange( KMinAdjustValue, KMaxAdjustValue, KStepCount );
+    
+    // Set value range to baseclass
+    // range  e.g. 0-20
+    SetMinAndMaxValues( KSLiderMinValue , KSLiderMaxValue );
+    
+    // Set slider type to percentage
+    SetValueType( EAknSliderValuePercentage );
+    
+    // Set default value
+    ScaleAndSetValue( KSLiderDefaultValue );
+    
+    // Set timeout
+    SetTimeOut( KDefaultPrefTimeOutTime );
+    
+    __VTPRINTEXIT( "CVtUiPrefPopupBase.BaseConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuiprefsettinglistbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,360 @@
+/*
+* 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:  Softkey UI feature implementation.
+*
+*/
+
+
+#include    <cvtengmodel.h>
+#include    <mvtengcamerapreferences.h>
+#include    <eikenv.h>
+#include    <cvtlogger.h>
+#include    <avkon.hrh>
+
+#include    "cvtuiprefsettinglistbase.h"
+#include    "CVtUiAppUi.h"
+#include    "cvtuitransparentsettingpage.h"
+#include    "CVtUiMainControl.h"
+#include    "CVtUiContextControl.h"
+#include    "cvtuifeaturemanager.h"
+#include    "VtUiLayout.h"
+
+#include    <layoutmetadata.cdl.h>
+
+// constants
+static const TInt KMaxNumberOfArrayItems = 5;
+static const TInt KMaxNumberOfActiveItems = 5;
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::~CVtUiPrefSettingListBase
+// ---------------------------------------------------------------------------
+// 
+CVtUiPrefSettingListBase::~CVtUiPrefSettingListBase()
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.~CVtUiPrefSettingListBase" )
+    delete iViewfinderBitmap;
+    delete iSettingPage;
+    iActiveItems.Close();
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.~CVtUiPrefSettingListBase" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::InitFeatureL
+// ---------------------------------------------------------------------------
+// 
+void CVtUiPrefSettingListBase::InitFeatureL()
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.InitFeatureL" )
+    ResizeBackroundBitmapRect();
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.InitFeatureL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::IsPendingCmd
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiPrefSettingListBase::IsPendingCmd()
+    {
+    return iPendingSettingChangeCmd;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::HandlePendingCmd
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSettingListBase::HandlePendingCmdL()
+    {
+    SettingPageItemChangedL( iOriginalSelection );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::HandleSettingPageEventL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSettingListBase::HandleSettingPageEventL(
+    CAknSettingPage* /*aSettingPage*/, TAknSettingPageEvent aEventType )
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.HandleSettingPageEventL" )
+    const TInt currentItem = iSettingPage->ListBoxControl()->CurrentItemIndex();      
+    switch ( aEventType )
+        {
+        case EEventSettingCancelled:
+             {
+             if ( iOriginalSelection != currentItem )
+                {
+                // Set back to orginal selection
+                SettingPageItemChangedL( iOriginalSelection );
+                iCurrentSelection = iOriginalSelection;
+                }
+             Stop();
+             break;   
+             }     
+         case EEventSettingChanged:
+             {
+             SettingPageItemChangedL( currentItem );
+             iOriginalSelection = currentItem;
+             Stop();
+             break;
+             }
+         case EEventSettingOked:
+             {
+             // Check if the current selection has changed
+             if ( iOriginalSelection != currentItem )
+                 {       
+                 SettingPageItemChangedL( currentItem );
+                 iOriginalSelection = currentItem;
+                 iCurrentSelection = currentItem;
+                 }                 
+             Stop();                 
+             break;
+             }
+         default:
+             break;
+        }
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.HandleSettingPageEventL" )        
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::ListStateChangedL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSettingListBase::ListStateChangedL()
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.ListStateChangedL" )
+    // Check if new item is focused in the selection list
+    
+    const TInt currentItem = iSettingPage->ListBoxControl()->CurrentItemIndex();
+    if ( iCurrentSelection != currentItem )
+        {
+        // Update current selection
+        iCurrentSelection = currentItem;
+        // Adjust frame
+        SettingPageItemChangedL( currentItem );    
+        }    
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.ListStateChangedL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::StartSettingPageL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSettingListBase::StartSettingPageL()
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.StartSettingPageL" )
+    // Swap image places if needed
+    iAppUi.SwitchViewFinderToMainPaneL();
+	    
+    // Get context control's window priority and position
+    iWindowPriority = iAppUi.ContextControl().DrawableWindow()
+        ->OrdinalPriority();
+    iWindowPosition = iAppUi.ContextControl().DrawableWindow()
+        ->OrdinalPosition();
+    
+    // Rise context control's window priority othwerwise setting page will be
+    // drawn partially over the context control window.
+    iAppUi.ContextControl().DrawableWindow()->SetOrdinalPosition( 
+        iWindowPosition, iWindowPriority + 1 );
+
+    // Creates setting page
+    CreateSettingPageL();
+    // Launch setting page.
+    iSettingPage->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted, EFalse );
+    iSettingPage = NULL;
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.StartSettingPageL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::StopSettingPageL
+//    
+//
+void CVtUiPrefSettingListBase::StopSettingPageL()
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.StopSettingPageL" )
+    // Swap image places if needed  
+    iAppUi.RestoreViewFinderL();
+    
+    if ( iSettingPage)
+        {
+        // Cancell the setting page
+        TKeyEvent keyEvent;
+        keyEvent.iCode =  EKeyEscape;
+        iSettingPage->OfferKeyEventL( keyEvent, EEventKey );
+        }
+        
+    // Set contex control's window priority and position back to orginal value.
+    iAppUi.ContextControl().DrawableWindow()->SetOrdinalPosition( 
+       iWindowPosition, iWindowPriority );
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.StopSettingPageL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::SizeChanged
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSettingListBase::SizeChanged()
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.SizeChanged" )
+    ResizeBackroundBitmapRect();
+    // Set new coordinates and size
+    iSettingPage->SetBitmapPositionAndClipRect( iBitmapTopLeftCorner,
+        iBitmapClippingRect );
+    iSettingPage->HandleLayoutChangeL();
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.SizeChanged" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::UpdateBackground
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSettingListBase::UpdateBackground( CFbsBitmap* aFrame )
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.UpdateBackground" )
+    if ( aFrame )
+        {
+        // aFrame is valid only in this callback, the bitmap
+        // must be copied for use as the setting page background
+        iViewfinderBitmap->Duplicate( aFrame->Handle() );
+        if ( iSettingPage )
+            {
+            // Update background
+            iSettingPage->ChangeBackground( iViewfinderBitmap );
+            }
+        }
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.UpdateBackground" )        
+    }
+    
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::UpdateSettingL
+// ---------------------------------------------------------------------------
+// 
+void CVtUiPrefSettingListBase::UpdateSettingL()
+    {
+    // if no active items do nothing
+    if ( iActiveItems.Count() > 0 )
+        {
+        // user change the focuse in the list but not
+        // select it indeed
+        if( iOriginalSelection != iCurrentSelection )  
+            SettingPageItemChangedL( iCurrentSelection );
+        else
+        // yes,user has tapped down the OK button to choose a item
+            SettingPageItemChangedL( iOriginalSelection );        
+        }
+    }
+        
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::CVtUiPrefSettingListBase
+// ---------------------------------------------------------------------------
+//
+CVtUiPrefSettingListBase::CVtUiPrefSettingListBase( CVtUiFeatureManager&
+    aFeatureManager,  TVtUiFeatureId aFeatureId ) : CVtUiFeatureBase(
+    aFeatureId, aFeatureManager ), iActiveItems( KMaxNumberOfActiveItems ), 
+    iBitmapTopLeftCorner( 0, 0 ), iAppUi( aFeatureManager.AppUi() ),iPendingSettingChangeCmd( EFalse )
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.CVtUiPrefSettingListBase" )   
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.CVtUiPrefSettingListBase" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSettingListBase::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.ConstructL" )
+    BaseConstructL();
+    // Get camera preferences extension.
+    iCameraPref = static_cast<MVtEngCameraPreferences*> (iFeatureManager.
+        AppUi().Model().Extension( KVtEngExtensionCameraPreferences ) );
+    // Create backgound bitmap
+    iViewfinderBitmap = new ( ELeave ) CFbsBitmap();
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.ConstructL" )
+    }
+     
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::ReadAndAppendItemL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSettingListBase::ReadAndAppendItemL( CDesCArray& aItems,
+    TInt aResId )
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.ReadAndAppendItemL" )
+    HBufC* text = iAppUi.GetEikonEnv()->AllocReadResourceLC( aResId );
+    aItems.AppendL( *text );
+    CleanupStack::PopAndDestroy(); // text
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.ReadAndAppendItemL" )
+    }    
+    
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::CreateSettingPageL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSettingListBase::CreateSettingPageL()
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.CreateSettingPageL" )
+    CDesCArray* selectionArray = new ( ELeave ) 
+        CDesCArraySeg( KMaxNumberOfArrayItems );
+    CleanupStack::PushL( selectionArray );
+    // Set items must be called before CurrentSelection function
+    // Otherwise iActiveItems array is not populated
+    iActiveItems.Reset();
+    SetItemsL( *selectionArray );
+    TInt resourceId = SettingPageResId();
+    
+    // Current selection is needed when a new item is focused in the list
+    iCurrentSelection = iOriginalSelection;
+    TInt current( CurrentSelection() );
+    if ( !iSettingPage )
+        {
+        iSettingPage = new ( ELeave ) CVtUiTransparentSettingPage( resourceId,
+            iCurrentSelection, selectionArray );
+        iSettingPage->ConstructL();
+        iSettingPage->SetSettingPageObserver( this );
+        iSettingPage->SetSettingPageEventStateObserver( this );
+        }
+     CleanupStack::PopAndDestroy(); // selectionArray        
+     ResizeBackroundBitmapRect();
+     iSettingPage->SetBitmapPositionAndClipRect( iBitmapTopLeftCorner, 
+        iBitmapClippingRect );            
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.CreateSettingPageL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSettingListBase::ShrinkBackroundBitmapRect
+// ---------------------------------------------------------------------------
+//    
+void CVtUiPrefSettingListBase::ResizeBackroundBitmapRect()
+    {
+    __VTPRINTENTER( "CVtUiPrefSettingListBase.ResizeBackroundBitmapRect" )
+    TRect parent( iAppUi.MainControl().Size() );
+    TAknWindowLineLayout rect;
+    TAknLayoutRect iStreamLayout;
+    VtUiLayout::GetSecondWindowStreamLayout( rect, ETrue );
+    iStreamLayout.LayoutRect( parent, rect );
+    
+    // In landscape rect from layout doesn't work 
+    // for some reason
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        iBitmapClippingRect = parent;
+        }
+    else
+        {
+        iBitmapClippingRect = iStreamLayout.Rect();
+        }
+    
+    iBitmapTopLeftCorner = iStreamLayout.Rect().iTl;
+    __VTPRINTEXIT( "CVtUiPrefSettingListBase.ResizeBackroundBitmapRect" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuiprefsliderbase.cpp	Mon Nov 23 14:47:47 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:   Implementatin of base class for video pref sliders
+*
+*/
+
+
+#include    <cvtlogger.h>
+
+#include    "cvtuiprefsliderbase.h"
+#include    "cvtuifeaturemanager.h"
+#include    "mvtuicomponentmanager.h"
+#include    "CVtUiAppUi.h"
+#include    "mvtuicommandmanager.h"
+#include    "cvtuiprefpopupbase.h"
+
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSliderBase::~CVtUiPrefSliderBase
+// ---------------------------------------------------------------------------
+//
+CVtUiPrefSliderBase::~CVtUiPrefSliderBase()
+    {
+    __VTPRINTENTER( "CVtUiPrefSliderBase.~CVtUiPrefSliderBase" )
+    __VTPRINTEXIT( "CVtUiPrefSliderBase.~CVtUiPrefSliderBase" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSliderBase::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSliderBase::StartL()
+    {
+    __VTPRINTENTER( "CVtUiPrefSliderBase.StartL" )
+    // call base class implementation
+    CVtUiSliderBase::StartL();
+
+    // Swap image places if needed
+    iFeatureManager.AppUi().SwitchViewFinderToMainPaneL();
+    
+    __VTPRINTEXIT( "CVtUiPrefSliderBase.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSliderBase::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSliderBase::Stop()
+    {
+    __VTPRINTENTER( "CVtUiPrefSliderBase.Stop" )
+    if ( iFeatureState == MVtUiFeature::EActive )
+        {
+        // call base class implementation
+        CVtUiSliderBase::Stop();
+
+        // Swap image places if needed
+        TRAP_IGNORE( iFeatureManager.AppUi().RestoreViewFinderL() );  
+        }
+    __VTPRINTEXIT( "CVtUiPrefSliderBase.Stop" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSliderBase::InitFeatureL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSliderBase::InitFeatureL()
+    {
+    __VTPRINTENTER( "CVtUiPrefSliderBase.InitFeatureL" )
+    // call base class implementation
+    CVtUiSliderBase::InitFeatureL();
+    __VTPRINTEXIT( "CVtUiPrefSliderBase.InitFeatureL" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSliderBase::CVtUiPrefSliderBase
+// ---------------------------------------------------------------------------
+//
+CVtUiPrefSliderBase::CVtUiPrefSliderBase( CVtUiFeatureManager& aFeatureManager,
+        TVtUiFeatureId aFeatureId  ) : CVtUiSliderBase(
+    aFeatureManager, aFeatureId )
+    {
+    __VTPRINTENTER( "CVtUiPrefSliderBase.CVtUiPrefSliderBase" )
+    __VTPRINTEXIT( "CVtUiPrefSliderBase.CVtUiPrefSliderBase" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVtUiPrefSliderBase::BaseConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPrefSliderBase::BaseConstructL()
+    {
+    __VTPRINTENTER( "CVtUiPrefSliderBase.BaseConstructL" )
+    CVtUiSliderBase::BaseConstructL();
+    __VTPRINTEXIT( "CVtUiPrefSliderBase.BaseConstructL" )
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuitransparentsettingpage.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,196 @@
+/*
+* 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:  Transparent camera setting page.
+*
+*/
+
+
+
+#include "cvtuitransparentsettingpage.h"
+#include "mvtuisettingpageobserver.h"
+#include "VtUiLayout.h"
+#include <cvtlogger.h>
+#include <aknsettingpage.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+
+
+/**
+*  CVtUiTransparentSettingPage
+*
+*  Transparent camera setting page. Extends class CAknTransparentCameraSettingPage
+*  with position related functionality.
+*
+*  @since S60 v3.2
+*/
+void CVtUiTransparentSettingPage::HandleLayoutChangeL()
+{
+	  	GetTheLayoutData();
+}
+
+// -----------------------------------------------------------------------------
+// CVtUiTransparentSettingPage::CVtUiTransparentSettingPage
+// -----------------------------------------------------------------------------
+//
+CVtUiTransparentSettingPage::CVtUiTransparentSettingPage( TInt aResourceID, 
+     TInt& aCurrentSelectionIndex, const MDesCArray* aItemArray) :
+     CAknTransparentCameraSettingPage( aResourceID,
+     aCurrentSelectionIndex, aItemArray )
+     {
+     }
+
+// -----------------------------------------------------------------------------
+// CVtUiTransparentSettingPage::ConstructL
+// -----------------------------------------------------------------------------
+//            
+void CVtUiTransparentSettingPage::ConstructL()
+    {
+    CAknTransparentCameraSettingPage::ConstructL();
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CVtUiTransparentSettingPage::~CVtUiTransparentSettingPage
+// -----------------------------------------------------------------------------
+//            
+CVtUiTransparentSettingPage::~CVtUiTransparentSettingPage()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNumberEntryControl::SetNumberEntryControlObserver
+// -----------------------------------------------------------------------------
+//
+void CVtUiTransparentSettingPage::SetSettingPageEventStateObserver( 
+    MVtUiSettingPageObserver* aObserver )
+    {
+    iSettingPageObserver = aObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiTransparentSettingPage::GetTheLayoutData
+// -----------------------------------------------------------------------------
+//
+void CVtUiTransparentSettingPage::GetTheLayoutData()
+    {
+    // Varieties
+    TInt labelVariety = 0;
+    TInt listboxVariety = 0;
+
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        labelVariety = 1;
+        listboxVariety = 1;
+        }
+       
+    // Rect for label and shadow text   
+    TRect labelRect = RectFromLayout( AknLayoutScalable_Apps::
+       aid_placing_vt_set_title( labelVariety ) );
+    
+    // Rect for listbox control
+    TRect listBoxRect = RectFromLayout( AknLayoutScalable_Apps::
+        aid_placing_vt_set_content( listboxVariety ) );
+   
+     // Get text label from parent class
+    CEikLabel* textLabel = TextLabel();
+   
+    // Set label's new positions
+    if ( textLabel )
+    	{
+    	textLabel->SetPosition( labelRect.iTl );	
+    	}
+    
+    // Get shadow text from parent class
+    CEikLabel* shadowText = ShadowText();
+   
+    // Set shadow text's new positions if shadow text exists
+    if( shadowText )
+        {
+        // This information should come from layout, but
+        // also AknSettingPage does the positioning in this way.
+        labelRect.Move( 1, 1 );
+        shadowText->SetPosition( labelRect.iTl );
+        }
+    
+    // Set new rect for listbox control
+    ListBoxControl()->SetRect( listBoxRect );
+    }
+    
+// -----------------------------------------------------------------------------
+// CVtUiTransparentSettingPage::DynamicInitL
+// -----------------------------------------------------------------------------
+//
+void CVtUiTransparentSettingPage::DynamicInitL()
+  {
+  	GetTheLayoutData();
+  }
+
+// -----------------------------------------------------------------------------
+// CVtUiTransparentSettingPage::HandleControlEventL
+// -----------------------------------------------------------------------------
+//
+void CVtUiTransparentSettingPage::HandleControlEventL( CCoeControl* /*aControl*/,
+    TCoeEvent aEventType )
+    {
+    __VTPRINTENTER( "CVtUiTransparentSettingPage.HandleControlEventL" )
+     if ( aEventType == EEventStateChanged )
+        {
+        if ( iSettingPageObserver )
+            {
+            iSettingPageObserver->ListStateChangedL();
+            }
+        __VTPRINT( DEBUG_GEN, " CVtUiTransparentSettingPage.EEventStateChanged" )
+        }
+    
+    __VTPRINTEXIT( "CVtUiTransparentSettingPage.HandleControlEventL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiTransparentSettingPage::RectFromLayout
+// -----------------------------------------------------------------------------
+// 
+TRect CVtUiTransparentSettingPage::RectFromLayout(
+    const TAknWindowComponentLayout& aComponentLayout ) const
+    {
+    __VTPRINTENTER( "CVtUiTransparentSettingPage.RectFromLayout" )
+      
+    TInt main_pane_variety( 0 );
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+            {
+            main_pane_variety = 4;
+            }
+
+    TAknWindowComponentLayout layout1 =
+        AknLayoutScalable_Apps::main_pane( main_pane_variety );
+    TAknWindowComponentLayout layout2 =
+        AknLayoutScalable_Apps::main_video_tele_pane();
+
+    TAknWindowLineLayout layout =
+        TAknWindowComponentLayout::Compose(
+         TAknWindowComponentLayout::Compose( layout1, layout2 ), aComponentLayout ).
+            LayoutLine();
+    
+    TRect screen;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
+    TAknLayoutRect layoutRect;
+    layoutRect.LayoutRect( screen, layout );
+    
+    // setting page is window owning control and its position is relative to mainpane
+    // layotdata is instead relative to screen
+    TRect rect( layoutRect.Rect() ); 
+    rect.Move( -PositionRelativeToScreen() );
+    
+    __VTPRINTEXIT( "CVtUiTransparentSettingPage.RectFromLayout" ) 
+    return rect;
+   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuivideoquality.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,441 @@
+/*
+* 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:  Video quality UI feature implementation.
+*
+*/
+
+
+#include    <badesca.h>
+#include    <akniconarray.h>
+#include    <aknsutils.h>
+#include    <stringloader.h>
+#include    <aknlists.h>
+#include    <aknpopup.h>
+#include    <aknselectionlist.h>
+#include    <mvtengmedia.h>
+#include    <cvtengmodel.h>
+#include    <cvtlogger.h>
+
+#include    <videotelui.rsg>
+#include    "cvtuivideoquality.h"
+#include    "tvtuifeatureids.h"
+#include    "VtUiLayout.h"
+#include    "VtUiUtility.h"
+#include    "CVtUiAppUi.h"
+#include    "cvtuifeaturemanager.h"
+#include    "mvtuicomponentmanager.h"
+#include	"tvtuilocalvariation.h"
+#include    "tvtuistates.h"
+
+// constants
+_LIT( KVtUiFormatActive, "0\t%S" );
+_LIT( KVtUiFormatInactive, "\t%S" );
+const TInt KVtUiMaxListItemLength = 128;
+
+// Implementation of TVtUiVideoQualityComponentState
+
+// ---------------------------------------------------------------------------
+// TVtUiVideoQualityComponentState::TVtUiVideoQualityComponentState
+// ---------------------------------------------------------------------------
+//
+TVtUiVideoQualityComponentState::TVtUiVideoQualityComponentState(
+    MVtUiComponent& aComponent ) :
+    TVtUiComponentState( aComponent,
+        TVtUiBlockListBitField(
+            MVtUiComponent::EComponentIdDialer |
+            MVtUiComponent::EComponentIdNumberEntry ) )
+    {
+    __VTPRINTENTER( "TVtUiVideoQualityComponentState.Ctor" )
+    __VTPRINTEXIT( "TVtUiVideoQualityComponentState.Ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiVideoQuality* CVtUiVideoQuality::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.NewL" )
+    CVtUiVideoQuality* self =
+        new ( ELeave ) CVtUiVideoQuality( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiVideoQuality.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::~CVtUiVideoQuality
+// ---------------------------------------------------------------------------
+//
+CVtUiVideoQuality::~CVtUiVideoQuality()
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.~CVtUiVideoQuality" )
+    
+	// Delete the callback
+    delete iShowSelectionListCallback;
+    
+    // unregister component
+    iFeatureManager.ComponentManager().ChangeComponentRegistration(
+        iComponentState, MVtUiComponentManager::EUnregister );
+
+    __VTPRINTEXIT( "CVtUiVideoQuality.~CVtUiVideoQuality" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoQuality::StartL()
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.StartL" )
+    if ( iFeatureState == MVtUiFeature::EReady )
+        {
+        iFeatureManager.UiStates().SetIsFixedToolbarVisible( EFalse );
+        iFeatureManager.ComponentManager().
+            RequestActivationL ( MVtUiComponent::EComponentIdVideoQuality );
+        // set state
+        iFeatureState  = MVtUiFeature::EActive;
+        }
+    __VTPRINTEXIT( "CVtUiVideoQuality.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoQuality::Stop()
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.Stop" )
+    TRAP_IGNORE(
+        {
+        if ( iFeatureState  == MVtUiFeature::EActive )
+            {
+            iFeatureManager.ComponentManager().
+            DeActivateComponentL ( MVtUiComponent::EComponentIdVideoQuality );
+            // set state
+            iFeatureState = MVtUiFeature::EReady;
+            }
+        } );
+    __VTPRINTEXIT( "CVtUiVideoQuality.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::InitFeatureL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoQuality::InitFeatureL()
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.InitFeatureL" )
+    // register component to conponent manager
+    User::LeaveIfError(
+       iFeatureManager.ComponentManager().ChangeComponentRegistration(
+       iComponentState, MVtUiComponentManager::ERegister ) );
+    iFeatureState  = EReady;
+    __VTPRINTEXIT( "CVtUiVideoQuality.InitFeatureL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::ComponentId
+// ---------------------------------------------------------------------------
+//
+MVtUiComponent::TComponentId CVtUiVideoQuality::ComponentId() const
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.ComponentId" )
+    __VTPRINTEXIT( "CVtUiVideoQuality.ComponentId" )
+    return MVtUiComponent::EComponentIdVideoQuality;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::ComponentAsControl
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CVtUiVideoQuality::ComponentAsControl()
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.ComponentAsControl" )
+    __VTPRINTEXIT( "CVtUiVideoQuality.ComponentAsControl" )
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::DoActivateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoQuality::DoActivateL()
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.DoActivateL" )
+    __VTPRINTEXIT( "CVtUiVideoQuality.DoActivateL" )
+    iFeatureManager.UiStates().SetVideoQualityModeOn( ETrue );
+    iShowSelectionListCallback->CallBack();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::DoDeactivateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoQuality::DoDeactivateL()
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.DoDeactivateL" )
+    iFeatureManager.UiStates().SetVideoQualityModeOn( EFalse );
+    __VTPRINTEXIT( "CVtUiVideoQuality.DoDeactivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::CreateIconLC
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CVtUiVideoQuality::CreateIconLC( TVtUiBitmapId aIconId,
+    TVtUiBitmapId aMaskId )
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.CreateIconLC" )
+    TFileName fileName;
+    TInt bitmapIndex;
+    TInt bitmapMaskIndex;
+	CFbsBitmap* newIconBmp;
+	CFbsBitmap* newIconMaskBmp;
+    VtUiLayout::Resolve( aIconId, fileName, bitmapIndex );
+    TAknsItemID skinId = VtUiLayout::MapBitmapToSkinId( aIconId );
+    VtUiLayout::Resolve( aMaskId, fileName, bitmapMaskIndex );
+	AknsUtils::CreateIconL( AknsUtils::SkinInstance(), skinId, newIconBmp,
+            newIconMaskBmp, fileName, bitmapIndex, bitmapMaskIndex );
+    CleanupStack::PushL( newIconBmp );
+    CleanupStack::PushL( newIconMaskBmp );
+	CGulIcon* gulIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp );
+    CleanupStack::Pop( newIconMaskBmp );
+    CleanupStack::Pop( newIconBmp );
+    CleanupStack::PushL( gulIcon );
+    __VTPRINTEXIT( "CVtUiVideoQuality.CreateIconLC" )
+    return gulIcon;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::ShowSelectionListL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoQuality::ShowSelectionListL()
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.ShowSelectionListL" )
+    // create listbox
+    CAknSingleGraphicPopupMenuStyleListBox* listBox =
+        new ( ELeave ) CAknSingleGraphicPopupMenuStyleListBox();
+    CleanupStack::PushL( listBox );
+
+    // create popuplist
+    CAknPopupList* popUpList =
+        CAknPopupList::NewL( listBox, R_VIDEOTELUI_SOFTKEYS_SELECT_CANCEL );
+    CleanupStack::PushL( popUpList );
+
+    listBox->ConstructL( popUpList,
+        EAknListBoxSelectionList | EAknListBoxLoopScrolling );
+
+    // Create an array of icons, reading them from the file and
+    // set them in the listbox
+	CArrayPtr<CGulIcon>* icons = new(ELeave) CAknIconArray( 1 );
+	CleanupStack::PushL(icons);
+	CGulIcon* icon = CreateIconLC( EVtUiBitmap_qgn_prop_sub_current,
+        EVtUiBitmap_qgn_prop_sub_current_mask );
+    icons->AppendL( icon );
+	listBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
+	CleanupStack::Pop(2); //icon + icons
+
+    // Read item array from resources
+    CDesCArray* textArray =
+        iFeatureManager.AppUi().GetEikonEnv()->
+            ReadDesCArrayResourceL( R_VIDEOTELUI_VIDEO_QUALITY_ARRAY );
+    CleanupStack::PushL( textArray );
+
+    CDesCArraySeg* listBoxRows =  new ( ELeave ) CDesCArraySeg( 3 );
+    CleanupStack::PushL( listBoxRows );
+
+    // Read items to array
+    SetItemsL( *listBoxRows, *textArray );
+
+    // Create listbox model.
+    CTextListBoxModel* listBoxModel = listBox->Model();
+    // Set item array
+    listBoxModel->SetItemTextArray( listBoxRows );
+
+    // Set ownership
+    listBoxModel->SetOwnershipType( ELbmOwnsItemArray );
+
+    // Enable marquee
+	listBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+    CleanupStack::Pop(2); // listBoxRows + testArray
+
+    TInt popupOk = popUpList->ExecuteLD();
+
+    CleanupStack::Pop(); // popUpList
+    popUpList = NULL;
+
+    if ( popupOk )
+        {
+        ItemSelectedL( listBox->CurrentItemIndex() );
+        }
+    else
+        {
+        // Selection canceled.
+        }
+
+    // Reset arrays
+    listBoxRows->Reset();
+    textArray->Reset();
+    icons->ResetAndDestroy(); // icons + icon
+
+    // Delete listbox
+    CleanupStack::PopAndDestroy( listBox ); // listBox
+
+    iAsyncCallback->Set( TCallBack( &DoStop, this ) );
+    iAsyncCallback->CallBack();
+    __VTPRINTEXIT( "CVtUiVideoQuality.ShowSelectionListL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::AsyncShowSelectionListL
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiVideoQuality::AsyncShowSelectionList( TAny* aPtr )
+    {
+    CVtUiVideoQuality* self = reinterpret_cast< CVtUiVideoQuality* > ( aPtr );
+    TRAPD( err, self->ShowSelectionListL() );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::SetItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoQuality::SetItemsL( CDesCArray& aTarget,
+    const CDesCArray& aSource )
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.SetItemsL" )
+    TInt activeItem( ActiveItem() );
+    TInt count( aSource.Count() );
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TBuf< KVtUiMaxListItemLength > item;
+        TPtrC sourceItem( aSource[ i ] );
+        if ( i == activeItem )
+            {
+            item.Format( KVtUiFormatActive(), &sourceItem );
+            }
+        else
+            {
+            item.Format( KVtUiFormatInactive(), &sourceItem );
+            }
+        aTarget.AppendL( item );
+        }
+    __VTPRINTEXIT( "CVtUiVideoQuality.SetItemsL" )
+    }
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::ActiveItem
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiVideoQuality::ActiveItem() const
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.ActiveItem" )
+    TInt activeItem( 0 );
+    MVtEngMedia::TVideoQuality videoQuality;
+    VtUiUtility::GetVideoQuality(  iFeatureManager.AppUi().Model().Media(),
+        videoQuality );
+    switch( videoQuality )
+        {
+    case MVtEngMedia::EVideoQualityNormal:
+        activeItem = 0;
+        break;
+    case MVtEngMedia::EVideoQualityDetail:
+        activeItem = 1;
+        break;
+    case MVtEngMedia::EVideoQualityMotion:
+        activeItem = 2;
+        break;
+    default:
+        break;
+        }
+    __VTPRINTEXIT( "CVtUiVideoQuality.ActiveItem" )
+    return activeItem;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::ItemSelectedL
+// ---------------------------------------------------------------------------
+//
+ void CVtUiVideoQuality::ItemSelectedL( TInt aItemIndex )
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.ItemSelectedL" )
+    MVtEngMedia::TVideoQuality qualityLevel;
+    switch( aItemIndex )
+        {
+    case 0:
+        qualityLevel = MVtEngMedia::EVideoQualityNormal;
+        break;
+
+    case 1:
+        qualityLevel = MVtEngMedia::EVideoQualityDetail;
+        break;
+
+    case 2:
+        qualityLevel = MVtEngMedia::EVideoQualityMotion;
+        break;
+    default:
+        break;
+        }
+    // cast the parameter
+    TPtrC8 params( reinterpret_cast< TUint8* >( &qualityLevel ),
+        sizeof( MVtEngMedia::TVideoQuality ) );
+    iFeatureManager.AppUi().DoExecuteCmdL( KVtEngSetVideoQuality, &params );
+    __VTPRINTEXIT( "CVtUiVideoQuality.ItemSelectedL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::CVtUiVideoQuality
+// ---------------------------------------------------------------------------
+//
+CVtUiVideoQuality::CVtUiVideoQuality( CVtUiFeatureManager& aFeatureManager ) :
+    CVtUiFeatureBase( EVtUiFeatureIdVideoQuality, aFeatureManager ),
+    iComponentState( *this )
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.CVtUiVideoQuality" )
+    __VTPRINTEXIT( "CVtUiVideoQuality.CVtUiVideoQuality" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVideoQuality::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVideoQuality::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.ConstructL" )
+    BaseConstructL();
+    iShowSelectionListCallback = new ( ELeave ) CAsyncCallBack(
+            TCallBack( &AsyncShowSelectionList, this ),
+            CActive::EPriorityStandard );
+    __VTPRINTEXIT( "CVtUiVideoQuality.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVideoQuality::DoStop
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiVideoQuality::DoStop( TAny* aAny )
+    {
+    __VTPRINTENTER( "CVtUiVideoQuality.DoStop" )
+    CVtUiFeatureBase* self = static_cast< CVtUiFeatureBase* >( aAny );
+    self->Stop();
+    __VTPRINTEXIT( "CVtUiVideoQuality.DoStop" )
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/prefs/cvtuiwhitebalance.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,390 @@
+/*
+* Copyright (c) 2007 - 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:  White balance UI feature implementation.
+*
+*/
+
+
+#include    <mvtengmedia.h>
+#include    <cvtengmodel.h>
+#include    <mvtengcamerapreferences.h>
+#include    "cvtuiwhitebalance.h"
+#include    "tvtuifeatureids.h"
+#include    <videotelui.rsg>
+#include    <cvtlogger.h>
+#include    "mvtuicomponentmanager.h"
+#include    "cvtuifeaturemanager.h"
+#include    "CVtUiAppUi.h"
+#include	"tvtuilocalvariation.h"
+#include    "tvtuistates.h"
+#include    "cvtuifeaturemanager.h"
+#include    "cvtuicommandmanager.h"
+
+// Implementation of TVtUiWhiteBalanceComponentState
+
+// ---------------------------------------------------------------------------
+// TVtUiWhiteBalanceComponentState::TVtUiWhiteBalanceComponentState
+// ---------------------------------------------------------------------------
+//
+TVtUiWhiteBalanceComponentState::TVtUiWhiteBalanceComponentState(
+    MVtUiComponent& aComponent ) :
+    TVtUiComponentState( aComponent,
+        TVtUiBlockListBitField(
+            MVtUiComponent::EComponentIdToolbar |
+            MVtUiComponent::EComponentIdNumberEntry ) )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiWhiteBalance* CVtUiWhiteBalance::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.NewL" )
+    CVtUiWhiteBalance* self =
+        new ( ELeave ) CVtUiWhiteBalance( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiWhiteBalance.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::~CVtUiWhiteBalance
+// ---------------------------------------------------------------------------
+//
+CVtUiWhiteBalance::~CVtUiWhiteBalance()
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.~CVtUiWhiteBalance" )
+    // unregister layout change
+    iFeatureManager.ComponentManager().ChangeLayoutChangeRegistration(
+        *this, MVtUiComponentManager::EUnregister );
+     // unregister component
+    iFeatureManager.ComponentManager().ChangeComponentRegistration(
+        iComponentState, MVtUiComponentManager::EUnregister );
+    __VTPRINTEXIT( "CVtUiWhiteBalance.~CVtUiWhiteBalance" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiWhiteBalance::StartL()
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.StartL" )
+    if ( iFeatureState == MVtUiFeature::EReady )
+        {
+        iFeatureManager.AppUi().EnableCommandActivatingAndCleanupPushL();
+        iFeatureManager.UiStates().SetIsFixedToolbarVisible( EFalse );
+        iFeatureManager.ComponentManager().
+            RequestActivationL ( MVtUiComponent::EComponentIdWhiteBalance );
+        CleanupStack::Pop(); // EnableCommandActivatingAndCleanupPushL
+        // set state
+        iFeatureState = MVtUiFeature::EActive;
+        }
+    __VTPRINTEXIT( "CVtUiWhiteBalance.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiWhiteBalance::Stop()
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.Stop" )
+    iAsyncCallback->Cancel();
+    iAsyncCallback->Set( TCallBack( &DoStopL, this ) );
+    iAsyncCallback->CallBack();
+    __VTPRINTEXIT( "CVtUiWhiteBalance.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::InitFeatureL
+// ---------------------------------------------------------------------------
+//
+void CVtUiWhiteBalance::InitFeatureL()
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.InitFeatureL" )
+    CVtUiPrefSettingListBase::InitFeatureL();
+    User::LeaveIfError(
+       iFeatureManager.ComponentManager().ChangeComponentRegistration(
+       iComponentState, MVtUiComponentManager::ERegister ) );
+    User::LeaveIfError(
+       iFeatureManager.ComponentManager().ChangeLayoutChangeRegistration(
+       *this, MVtUiComponentManager::ERegister ) );
+    iFeatureState  = EReady;
+    __VTPRINTEXIT( "CVtUiWhiteBalance.InitFeatureL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::ComponentId
+// ---------------------------------------------------------------------------
+//
+MVtUiComponent::TComponentId CVtUiWhiteBalance::ComponentId() const
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.ComponentId" )
+    __VTPRINTEXIT( "CVtUiWhiteBalance.ComponentId" )
+    return MVtUiComponent::EComponentIdWhiteBalance;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::ComponentAsControl
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CVtUiWhiteBalance::ComponentAsControl()
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.ComponentAsControl" )
+    __VTPRINTEXIT( "CVtUiWhiteBalance.ComponentAsControl" )
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::DoActivateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiWhiteBalance::DoActivateL()
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.DoActivateL" )
+    // get supported white balance modes
+    iCameraPref->GetSupportedWhiteBalanceModes( iSupportedModes );
+    __VTPRINT2( DEBUG_GEN,"CVtUiWhiteBalance.DoActivateL=%d", iSupportedModes )
+    iFeatureManager.UiStates().SetWhiteBalanceModeOn( ETrue );
+    iAsyncCallback->Cancel();
+    iAsyncCallback->Set( TCallBack( &DoStartL, this ) );
+    iAsyncCallback->CallBack();
+    __VTPRINTEXIT( "CVtUiWhiteBalance.DoActivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::DoDeactivateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiWhiteBalance::DoDeactivateL()
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.DoDeactivateL" )
+    iFeatureManager.UiStates().SetWhiteBalanceModeOn( EFalse );
+    CVtUiPrefSettingListBase::StopSettingPageL();
+    __VTPRINTEXIT( "CVtUiWhiteBalance.DoDeactivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::HandleLayoutChangeL
+// ---------------------------------------------------------------------------
+//
+void CVtUiWhiteBalance::HandleLayoutChangeL()
+    {
+     __VTPRINTENTER( "CVtUiWhiteBalance.HandleLayoutChangeL" )
+    if ( iFeatureState  == MVtUiFeature::EActive )
+        {
+        SizeChanged();
+        }
+    __VTPRINTEXIT( "CVtUiWhiteBalance.HandleLayoutChangeL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::CurrentSelection
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiWhiteBalance::CurrentSelection()
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.CurrentSelection" )
+    // ask from engine which item is currently active
+    MVtEngCameraPreferences::TWhiteBalance wb;
+    if ( iCameraPref->GetWhiteBalance( wb ) )
+        {
+        __VTPRINT( DEBUG_GEN, "CurrentSelection::error" );
+        __VTPRINTEXIT( "CVtUiWhiteBalance.CurrentSelection" )
+        // if error occured return 0 i.e. first list item
+        return 0;
+        }
+    __VTPRINTEXIT( "CVtUiWhiteBalance.CurrentSelection" )
+    return MapWBEnumToArrayIndex( wb );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::SetItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiWhiteBalance::SetItemsL( CDesCArray& aArray )
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.SetItemsL" )
+    __VTPRINT2( DEBUG_GEN, "CVtUiWhiteBalance.SetItemsL=%d", iSupportedModes )
+    // Auto mode allways supported
+    ReadAndAppendItemL( aArray, R_VIDEOTELUI_QTN_INCAL_AUTOMATIC_OPTION );
+    iActiveItems.Append( MVtEngCameraPreferences::EAuto );
+
+    if( iSupportedModes & MVtEngCameraPreferences::EDaylight )
+        {
+        ReadAndAppendItemL( aArray, R_VIDEOTELUI_QTN_INCAL_SUNNY_OPTION );
+        iActiveItems.Append( MVtEngCameraPreferences::EDaylight );
+        }
+    if( iSupportedModes & MVtEngCameraPreferences::ECloudy )
+        {
+        ReadAndAppendItemL( aArray, R_VIDEOTELUI_QTN_INCAL_CLOUDY_OPTION );
+        iActiveItems.Append( MVtEngCameraPreferences::ECloudy );
+        }
+    if( iSupportedModes & MVtEngCameraPreferences::ETungsten )
+        {
+        ReadAndAppendItemL( aArray, R_VIDEOTELUI_QTN_INCAL_INCANDESCENT_OPTION );
+        iActiveItems.Append( MVtEngCameraPreferences::ETungsten );
+        }
+    if( iSupportedModes & MVtEngCameraPreferences::EFluorescent )
+        {
+        ReadAndAppendItemL( aArray, R_VIDEOTELUI_QTN_INCAL_FLUORESCENT_OPTION );
+        iActiveItems.Append( MVtEngCameraPreferences::EFluorescent );
+        }
+    __VTPRINTEXIT( "CVtUiWhiteBalance.SetItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::SettingPageResId
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiWhiteBalance::SettingPageResId() const
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.SettingPageResId" )
+    __VTPRINTEXIT( "CVtUiWhiteBalance.SettingPageResId" )
+    return R_VIDEOTELUI_WHITE_BALANCE_SETTING_PAGE;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::SettingPageItemChangedL
+// ---------------------------------------------------------------------------
+//
+void CVtUiWhiteBalance::SettingPageItemChangedL( TInt aIndex )
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.SettingPageItemChangedL" )
+    __VTPRINT2( DEBUG_GEN, "CVtUiWhiteBalance.index=%d", aIndex )
+    if ( iFeatureManager.UiStates().ExecState() == TVtUiStates::EExecStateResetting )
+        {
+        __VTPRINTEXIT( "CVtUiWhiteBalance.SettingPageItemChangedL" )
+        return;
+        }
+    // Map index to right white balance value
+    MVtEngCameraPreferences::TWhiteBalance wb = MapArrayIndexToWBEnum( aIndex );
+
+    // cast the parameter
+    TPtrC8 params( reinterpret_cast< TUint8* >( &wb ),
+        sizeof( MVtEngCameraPreferences::TWhiteBalance ) );
+
+    // Adjust white balance
+    MVtEngMedia::TCameraId camId;
+    iFeatureManager.AppUi().Model().Media().GetCurrentCameraId(camId);
+
+    if( camId == MVtEngMedia::ESecondaryCamera  )
+        {            
+         iFeatureManager.AppUi().DoExecuteCmdL( KVtEngSetWhiteBalance, &params );        
+         iPendingSettingChangeCmd = EFalse;
+         }
+    else
+        iPendingSettingChangeCmd = ETrue;
+    __VTPRINTEXIT( "CVtUiWhiteBalance.SettingPageItemChangedL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::CVtUiWhiteBalance
+// ---------------------------------------------------------------------------
+//
+CVtUiWhiteBalance::CVtUiWhiteBalance( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiPrefSettingListBase( aFeatureManager, EVtUiFeatureIdWhiteBalance ),
+    iComponentState( *this )
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.CVtUiWhiteBalance" )
+    __VTPRINTEXIT( "CVtUiWhiteBalance.CVtUiWhiteBalance" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::MapWBEnumToArrayIndex
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiWhiteBalance::MapWBEnumToArrayIndex( MVtEngCameraPreferences::
+    TWhiteBalance& aWhiteBalance ) const
+    {
+     __VTPRINTENTER( "CVtUiWhiteBalance.MapWBEnumToArrayIndex" )
+    __VTPRINT2( DEBUG_GEN, "CVtUiWhiteBalance.cpunt=%d", iActiveItems.Count() )
+    for ( TInt i = 0; i < iActiveItems.Count(); ++i )
+         {
+         if ( iActiveItems [ i ] ==  aWhiteBalance  )
+             {
+             __VTPRINT2( DEBUG_GEN, "CVtUiWhiteBalance.index=%d", i )
+             __VTPRINTEXIT( "CVtUiWhiteBalance.MapWBEnumToArrayIndex" )
+             return i;
+             }
+         }
+     // not found
+     __VTPRINTEXIT( "CVtUiWhiteBalance.MapWBEnumToArrayIndexNF" )
+     return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::MapArrayIndexToWBEnum
+// ---------------------------------------------------------------------------
+//
+MVtEngCameraPreferences::TWhiteBalance CVtUiWhiteBalance::
+    MapArrayIndexToWBEnum( TInt aIndex) const
+    {
+     __VTPRINTENTER( "CVtUiWhiteBalance.MapArrayIndexToWBEnum" )
+     __VTPRINT2( DEBUG_GEN, "CVtUiWhiteBalance.index=%d", aIndex )
+    __VTPRINT2( DEBUG_GEN, "CVtUiWhiteBalance.count=%d", iActiveItems.Count() )
+    const TInt count = iActiveItems.Count();
+    if ( count > 0 && aIndex < count && aIndex >= 0 )
+        {
+        __VTPRINTEXIT( "CVtUiWhiteBalance.MapArrayIndexToWBEnum" )
+        return static_cast< MVtEngCameraPreferences::TWhiteBalance >
+            ( iActiveItems[ aIndex ] );
+        }
+    else // not valid index return first item in the list
+        {
+        __VTPRINTEXIT( "CVtUiWhiteBalance.MapArrayIndexToWBEnum_ERROR_INDEX" )
+        return static_cast< MVtEngCameraPreferences::TWhiteBalance >
+            ( iActiveItems[ 0 ] );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::DoStop
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiWhiteBalance::DoStopL( TAny* aAny )
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.DoStopL" )
+    CVtUiWhiteBalance* self = static_cast< CVtUiWhiteBalance* >( aAny );
+    if ( self->iFeatureState == MVtUiFeature::EActive )
+        {
+        __VTPRINT( DEBUG_GEN, "CVtUiWhiteBalance::Stop1" );
+        self->iFeatureManager.ComponentManager().
+            DeActivateComponentL ( MVtUiComponent::EComponentIdWhiteBalance );
+        // set state
+        self->iFeatureState = MVtUiFeature::EReady;
+        }
+    __VTPRINTEXIT( "CVtUiWhiteBalance.DoStopL" )
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiWhiteBalance::DoStart
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiWhiteBalance::DoStartL( TAny* aAny )
+    {
+    __VTPRINTENTER( "CVtUiWhiteBalance.DoStart" )
+    CVtUiWhiteBalance* self = static_cast< CVtUiWhiteBalance* >( aAny );
+    self->CVtUiPrefSettingListBase::StartSettingPageL();
+    self->iFeatureManager.UiStates().SetIsCommandActivating( EFalse );
+    __VTPRINTEXIT( "CVtUiWhiteBalance.DoStart" )
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/softkey/cvtuisoftkeycontext.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* 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:  Sofkey context class implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuisoftkeycontext.h"
+
+/** Softkey context reference priority */
+const TInt KVtUiSoftkeyContextPriority = 200;
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyContext::~CVtUiSoftkeyContext
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeyContext::~CVtUiSoftkeyContext()
+    {
+    __VTPRINTENTER( "SKCtx.~" )
+    UnregisterCommandContext();
+    __VTPRINTEXIT( "SKCtx.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyContext::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeyContext* CVtUiSoftkeyContext::NewL(
+    MVtUiCommandManager& aCommandManager )
+    {
+    __VTPRINTENTER( "SKCtx.NewL" )
+    CVtUiSoftkeyContext* self =
+        new ( ELeave ) CVtUiSoftkeyContext( aCommandManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "SKCtx.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyContext::ValidateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeyContext::ValidateL( CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "SKCtx.ValidateL" )
+    ValidateSoftkeyItemsL( aAction );
+    __VTPRINTEXIT( "SKCtx.ValidateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyContext::CVtUiSoftkeyContext
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeyContext::CVtUiSoftkeyContext( MVtUiCommandManager& aCommandManager )
+    : CVtUiCmdContext( aCommandManager, EVtUiCmdContextTypeSoftkey,
+      KVtUiSoftkeyContextPriority )
+    {
+    __VTPRINTENTER( "SKCtx.ctor" )
+    __VTPRINTEXIT( "SKCtx.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyContext::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeyContext::ConstructL()
+    {
+    __VTPRINTENTER( "SKCtx.ConstructL" )
+    RegisterCommandContextL();
+    __VTPRINTEXIT( "SKCtx.ConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/softkey/cvtuisoftkeys.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,167 @@
+/*
+* 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:  Softkey UI feature implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+#include <eikbtgpc.h>
+#include "cvtuisoftkeys.h"
+#include "cvtuisoftkeysetting.h"
+#include "cvtuisoftkeyvalidationaction.h"
+#include "cvtuifeaturemanager.h"
+#include "mvtuicommandmanager.h"
+#include "cvtuisoftkeycontext.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeys* CVtUiSoftkeys::NewL( CVtUiFeatureManager& aFeatureManager,
+    CEikButtonGroupContainer& aButtonGroupContainer )
+    {
+    __VTPRINTENTER( "SKs.NewL" )
+    CVtUiSoftkeys* self =
+        new ( ELeave ) CVtUiSoftkeys( aFeatureManager, aButtonGroupContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "SKs.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::~CVtUiSoftkeys
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeys::~CVtUiSoftkeys()
+    {
+    __VTPRINTENTER( "SKs.~" )
+    iFeatureManager.CommandManager().RemoveCommandUi( *this );
+    delete iSoftkeyCommandContext;
+    delete iSoftkeySetting;
+    delete iSoftkeyValidationAction;
+    __VTPRINTEXIT( "SKs.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::ButtonGroup
+// ---------------------------------------------------------------------------
+//
+CEikButtonGroupContainer& CVtUiSoftkeys::ButtonGroup()
+    {
+    __VTPRINTENTER( "SKs.ButtonGroup" )
+    __VTPRINTEXIT( "SKs.ButtonGroup" )
+    return iButtonGroupContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeys::StartL()
+    {
+    __VTPRINTENTER( "SKs.StartL" )
+    __VTPRINTEXIT( "SKs.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeys::Stop()
+    {
+    __VTPRINTENTER( "SKs.Stop" )
+    __VTPRINTEXIT( "SKs.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::InitFeatureL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeys::InitFeatureL()
+    {
+    __VTPRINTENTER( "SKs.InitFeatureL" )
+    __VTPRINTEXIT( "SKs.InitFeatureL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::RefreshL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeys::RefreshL()
+    {
+    __VTPRINTENTER( "SKs.RefreshL" )
+    iFeatureManager.CommandManager().ValidateSoftkeyItemsL(
+        *iSoftkeyValidationAction );
+    iSoftkeySetting->DefineCommandsL( *iSoftkeyValidationAction );
+    iButtonGroupContainer.DrawNow();
+    __VTPRINTEXIT( "SKs.RefreshL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::AddCommandModifierL
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiSoftkeys::AddCommandModifier( CVtUiCommandModifyBase& aModifier )
+    {
+    __VTPRINTENTER( "SKs.AddCommandModifier" )
+    TInt result( iSoftkeySetting->AddModifier( aModifier ) );
+    __VTPRINTEXITR( "SKs.AddCommandModifier %d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::RemoveCommandModifier
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeys::RemoveCommandModifier( CVtUiCommandModifyBase& aModifier )
+    {
+    __VTPRINTENTER( "SKs.RemoveCommandModifier" )
+    iSoftkeySetting->RemoveModifier( aModifier );
+    __VTPRINTEXIT( "SKs.RemoveCommandModifier" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::CVtUiSoftkeys
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeys::CVtUiSoftkeys( CVtUiFeatureManager& aFeatureManager,
+    CEikButtonGroupContainer& aButtonGroupContainer )
+    : CVtUiFeatureBase( EVtUiFeatureIdSoftkey, aFeatureManager ),
+    iButtonGroupContainer( aButtonGroupContainer )
+    {
+    __VTPRINTENTER( "SKs.ctor" )
+    __VTPRINTEXIT( "SKs.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeys::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeys::ConstructL()
+    {
+    __VTPRINTENTER( "SKs.ConstructL" )
+    iSoftkeyCommandContext = CVtUiSoftkeyContext::NewL(
+        iFeatureManager.CommandManager() );
+    iSoftkeySetting = new ( ELeave ) CVtUiSoftkeySetting( *this );
+    iSoftkeyValidationAction = CVtUiSoftkeyValidationAction::NewL();
+    User::LeaveIfError(
+        iFeatureManager.CommandManager().AddCommandUi( *this ) );
+    __VTPRINTEXIT( "SKs.ConstructL" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/softkey/cvtuisoftkeysetting.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* 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:  Softkey setting implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+#include <eikbtgpc.h>
+
+#include "cvtuisoftkeys.h"
+#include "cvtuisoftkeysetting.h"
+#include "cvtuisoftkeyvalidationaction.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeySetting::~CVtUiSoftkeySetting
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeySetting::~CVtUiSoftkeySetting()
+    {
+    __VTPRINTENTER( "SKSet.~" )
+    __VTPRINTEXIT( "SKSet.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeySetting::CVtUiSoftkeySetting
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeySetting::CVtUiSoftkeySetting( CVtUiSoftkeys& aSoftkeys ) :
+    CVtUiCommandSetting( ECommandTypeSoftkeys ),
+    iSoftkeys( &aSoftkeys )
+    {
+    __VTPRINTENTER( "SKSet.ctor" )
+    __VTPRINTEXIT( "SKSet.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeySetting::DoDefineCommandsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeySetting::DoDefineCommandsL()
+    {
+    __VTPRINTENTER( "SKSet.DoDefineCommandsL" )
+    iSoftkeys->ButtonGroup().SetCommandSetL( Action().ResourceId() );
+    __VTPRINTEXIT( "SKSet.DoDefineCommandsL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/softkey/cvtuisoftkeyvalidationaction.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,112 @@
+/*
+* 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:  Softkey validation action implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+#include <videotelui.rsg>
+#include <avkon.rsg>
+
+#include "cvtuisoftkeyvalidationaction.h"
+#include "tvtuicmdvalidatorcallback.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// softkey ids
+static const TInt SKIDS[] =
+    {
+    R_AVKON_SOFTKEYS_OPTIONS_BACK,
+    R_VIDEOTELUI_SOFTKEYS_EMPTY_ACTIVE_COMMAND,
+    R_VIDEOTELUI_SOFTKEYS_EMPTY_DIALEREXIT,
+    R_VIDEOTELUI_SOFTKEYS_SHARE_OBJECT_IMAGE,
+    R_VIDEOTELUI_SOFTKEYS_CAPTURE_VIDEO,
+    R_VIDEOTELUI_SOFTKEYS_ENABLE_AUDIO,
+    R_VIDEOTELUI_SOFTKEYS_ENABLE_VIDEO,
+    R_VIDEOTELUI_SOFTKEYS_DIALER,
+    R_VIDEOTELUI_SOFTKEYS_BT_HANDSFREE,
+    R_VIDEOTELUI_SOFTKEYS_LOUDSPEAKER,
+    R_VIDEOTELUI_SOFTKEYS_HANDSET_B,
+    R_VIDEOTELUI_SOFTKEYS_END_CALL,
+    R_AVKON_SOFTKEYS_EMPTY // this is end marker, keep it last
+    };
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyValidationAction::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeyValidationAction* CVtUiSoftkeyValidationAction::NewL()
+    {
+    __VTPRINTENTER( "SKValAct.NewL" )
+    CVtUiSoftkeyValidationAction* self =
+        new ( ELeave ) CVtUiSoftkeyValidationAction();
+    __VTPRINTEXIT( "SKValAct.NewL" )
+    return self;
+	}
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyValidationAction::BeginProcess
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeyValidationAction::BeginProcess()
+    {
+    __VTPRINTENTER( "SKValAct.EndProcess" )
+    CVtUiCmdValidationActionBase::BeginProcess();
+    iCurrentIdx = 0;
+    __VTPRINTEXIT( "SKValAct.EndProcess" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyValidationAction::ProcessL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSoftkeyValidationAction::ProcessL(
+    const MVtUiCmdValidatorCallBack& aCallBack )
+    {
+    __VTPRINTENTER( "SKValAct.ProcessL" )
+    while ( SKIDS[ iCurrentIdx ] != R_AVKON_SOFTKEYS_EMPTY )
+        {
+        if ( aCallBack.Call( SKIDS[ iCurrentIdx ] ) )
+            {
+            break;
+            }
+        else
+            {
+            iCurrentIdx++;
+            }
+        }
+    __VTPRINTEXIT( "SKValAct.ProcessL" )
+	}
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyValidationAction::ResourceId
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiSoftkeyValidationAction::ResourceId() const
+    {
+    __VTPRINTENTER( "SKValAct.ResourceId" )
+    __VTPRINTEXITR( "SKValAct.ResourceId %d", SKIDS[ iCurrentIdx ] )
+    return SKIDS[ iCurrentIdx ];
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSoftkeyValidationAction::CVtUiSoftkeyValidationAction
+// ---------------------------------------------------------------------------
+//
+CVtUiSoftkeyValidationAction::CVtUiSoftkeyValidationAction()
+    {
+    __VTPRINTENTER( "SKValAct.ctor" )
+    __VTPRINTEXIT( "SKValAct.ctor" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/toolbar/cvtuifixedtoolbar.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 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:  Fixed toolbar UI feature implementation.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include    "cvtuifixedtoolbar.h"
+#include    "cvtuifeaturemanager.h"
+#include    "mvtuicomponentmanager.h"
+#include    "mvtuicommandmanager.h"
+#include    "videotelui.hrh"
+#include    "tvtuistates.h"
+#include    "cvtuitoolbarcmdpolicy.h"
+#include    "cvtuitoolbarskmodifier.h"
+#include    "CVtUiAppUi.h"
+#include    <videotelui.rsg>
+#include    <cvtlogger.h>
+#include    <akntoolbar.h>
+#include    "tvtuistates.h"
+#include    <layoutmetadata.cdl.h>
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::NewL
+// -----------------------------------------------------------------------------
+//
+CVtUiFixedToolbar* CVtUiFixedToolbar::NewL( CVtUiFeatureManager&
+     aFeatureManager )
+    {
+    __VTPRINTENTER( "FixedToolbar.NewL" )
+    CVtUiFixedToolbar* self = new ( ELeave ) CVtUiFixedToolbar(
+        aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __VTPRINTEXIT( "FixedToolbar.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::CVtUiFixedToolbar
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiFixedToolbar::CVtUiFixedToolbar( CVtUiFeatureManager&
+    aFeatureManager ) : CVtUiToolbarBase( aFeatureManager )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiFixedToolbar::ConstructL()
+    {
+    __VTPRINTENTER( "FixedToolbar.ConstructL" )
+    BaseConstructL();
+
+    //create toolbar
+    iToolbar = iFeatureManager.AppUi().CurrentFixedToolbar();
+
+    // create and add items into the toolbar
+    CreateToolbarButtonsL();
+
+    // Dim all toolbar buttons until first refresh is called
+    DimToolbarbuttons( ETrue );
+
+    if ( !Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        MakeToolbarVisible( EFalse );
+        }
+
+    __VTPRINTEXIT( "FixedToolbar.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::~CVtUiFixedToolbar
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiFixedToolbar::~CVtUiFixedToolbar()
+    {
+    __VTPRINTENTER( "FixedToolbar.~" )
+    delete iIdle;
+    __VTPRINTEXIT( "FixedToolbar.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::CreateToolbarButtons
+// -----------------------------------------------------------------------------
+//
+void CVtUiFixedToolbar::CreateToolbarButtonsL()
+    {
+    __VTPRINTENTER( "FixedToolbar.CreateToolbarButtons" )
+    // Default buttons created in base clase
+    CVtUiToolbarBase::CreateToolbarButtonsL();
+
+    // toggle microphone
+    CreateToolbarItemL( R_AVKONBUTTON_AUDIO_ROUTING_BUTTON,
+        EVtUiCmdToolbarAudioRouting, iFeatureManager.AppUi() );
+
+
+    __VTPRINTEXIT( "FixedToolbar.CreateToolbarButtons" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::PopulateCmdsIdsL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFixedToolbar::PopulateCmdsIdsL()
+    {
+    __VTPRINTENTER( "FixedToolbar.PopulateCmdsIdsL" )
+    // Default commands populated in base clase
+    CVtUiToolbarBase::PopulateCmdsIdsL();
+
+    CVtUiAppUi& appUi = iFeatureManager.AppUi();
+
+    iCmdIds.AppendL( EVtUiCmdActivateBT );
+    iCmdIds.AppendL( EVtUiCmdSwitchFromBTToIHF );
+    iCmdIds.AppendL( EVtUiCmdActivateLoudspeaker );
+    iCmdIds.AppendL( EVtUiCmdDeactivateLoudspeaker );
+
+    __VTPRINTEXIT( "FixedToolbar.PopulateCmdsIdsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::SetToolbarVisibilityAfterLayoutChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFixedToolbar::SetToolbarVisibilityAfterLayoutChangeL( TBool aVisible )
+    {
+    // Portrait to landscape show tb
+        __VTPRINTENTER( "FixedToolbar.SetToolbarVisibilityAfterLayoutChangeL" )
+    if( aVisible )
+        {
+        __VTPRINT(DEBUG_GEN, "FixedToolbar.SetToolbarVisibilityAfterLayoutChangeL.1" )
+        // Set flag
+        iFeatureManager.UiStates().SetIsFixedToolbarVisible( ETrue );
+        // set visible
+        iFeatureManager.AppUi().CurrentFixedToolbar()
+            ->SetToolbarVisibility( ETrue );
+        // Set callback to dim toolbarbuttons
+        if ( !iIdle )
+            {
+            iIdle = CIdle::NewL( CActive::EPriorityIdle );
+            }
+        iIdle->Start( TCallBack( &DoDimToolbarButtons, this ) );
+        }
+    // Landsacpe to portrait hide tb
+    else
+        {
+        __VTPRINT(DEBUG_GEN, "FixedToolbar.SetToolbarVisibilityAfterLayoutChangeL.2" )
+        DimToolbarbuttons( EFalse );
+        iFeatureManager.AppUi().CurrentFixedToolbar()
+            ->SetToolbarVisibility( EFalse );
+         // Set flag
+        iFeatureManager.UiStates().SetIsFixedToolbarVisible( EFalse );
+        }
+    __VTPRINTEXIT( "FixedToolbar.SetToolbarVisibilityAfterLayoutChangeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::DimToolbarbuttons
+// -----------------------------------------------------------------------------
+//
+void CVtUiFixedToolbar::DimToolbarbuttons( TBool aIsDimmed )
+    {
+    __VTPRINTENTER( "FixedToolbar.DimToolbarbuttons" )
+    iToolbar->SetItemDimmed( EVtUiCmdToolbarToggleVideo, aIsDimmed, EFalse );
+    iToolbar->SetItemDimmed( EVtUiCmdToolbarToggleMicrophone, aIsDimmed, EFalse );
+    iToolbar->SetItemDimmed( EVtUiCmdToolbarAudioRouting, aIsDimmed, ETrue );
+    __VTPRINTEXITR( "FixedToolbar.DimToolbarbuttons %d", aIsDimmed )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::MakeToolbarVisible
+// -----------------------------------------------------------------------------
+//
+void CVtUiFixedToolbar::MakeToolbarVisible( const TBool aVisible )
+    {
+    __VTPRINTENTER( "FixedToolbar.MakeToolbarVisible" )
+    iFeatureManager.AppUi().CurrentFixedToolbar()->
+        SetToolbarVisibility( aVisible );
+    iFeatureManager.UiStates().SetIsFixedToolbarVisible( aVisible );
+    __VTPRINTEXITR( "FixedToolbar.MakeToolbarVisible %d", aVisible )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::DoShowToolbarL
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiFixedToolbar::DoShowToolbarL( TAny* aAny )
+    {
+    __VTPRINTENTER( "FixedToolbar.DoShowToolbarL" )
+    CVtUiFixedToolbar* self = static_cast< CVtUiFixedToolbar* >( aAny );
+    self->iFeatureManager.AppUi().CurrentFixedToolbar()
+        ->SetToolbarVisibility( ETrue );
+    __VTPRINTEXIT( "FixedToolbar.DoShowToolbarL" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::DoToolbarButton
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiFixedToolbar::DoDimToolbarButtons( TAny* aAny )
+    {
+    __VTPRINTENTER( "FixedToolbar.DoDimToolbarButtons" )
+    CVtUiFixedToolbar* self = static_cast< CVtUiFixedToolbar* >( aAny );
+    self->DimToolbarbuttons( ETrue );
+    __VTPRINTEXIT( "FixedToolbar.DoDimToolbarButtons" )
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::DoActivateL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFixedToolbar::DoActivateL()
+    {
+    __VTPRINTENTER( "FixedToolbar.DoActivateL" )
+    if ( !iFeatureManager.UiStates().IsFixedToolbarVisible() &&
+         !Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        // reset flag
+        iFeatureManager.UiStates().SetIsFixedToolbarVisible( ETrue );
+        // Show toolbar with delay in order to prevent overdrawing
+        // witht other components.
+        iAsyncCallback->Cancel();
+        iAsyncCallback->Set( TCallBack( &DoShowToolbarL, this ) );
+        iAsyncCallback->CallBack();
+        }
+    else
+        {
+        // Undim buttons
+        __VTPRINT( DEBUG_GEN, "FixedToolbar.DoDeactivateL.DTB EFalse" )
+        // toolbar might be unvisible, because condition in the contructor 
+        // "if ( !Layout_Meta_Data::IsLandscapeOrientation() )"
+        // will be evaluated ture eventhough the orientation is forced to be landsacepe
+        // because it seems that the orientation is still portrait in the constructor phase
+        MakeToolbarVisible( ETrue );
+        DimToolbarbuttons( EFalse );
+        }
+    // Start blocking pointer events
+    BlockPointerEvents( ETrue );
+    // Base class
+    CVtUiToolbarBase::DoActivateL();
+    __VTPRINTEXIT( "FixedToolbar.DoActivateL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFixedToolbar::DoDeactivateL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFixedToolbar::DoDeactivateL()
+    {
+    __VTPRINTENTER( "FixedToolbar.DoDeactivateL" )
+    iAsyncCallback->Cancel();
+    if ( !iFeatureManager.UiStates().IsFixedToolbarVisible() &&
+         !Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        iFeatureManager.AppUi().CurrentFixedToolbar()
+            ->SetToolbarVisibility( EFalse );
+        __VTPRINT( DEBUG_GEN, "FixedToolbar.DoDeactivateL.Vs" )
+        }
+    else
+        {
+        // Dim all buttons
+        __VTPRINT( DEBUG_GEN, "FixedToolbar.DoDeactivateL.DTB ETrue" )
+        DimToolbarbuttons( ETrue );
+        }
+    // Stop blocking pointer events
+    BlockPointerEvents( EFalse );
+    // Base class
+    CVtUiToolbarBase::DoDeactivateL();
+    __VTPRINTEXIT( "FixedToolbar.DoDeactivateL" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/toolbar/cvtuifloatingtoolbar.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,468 @@
+/*
+* Copyright (c) 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:  Floating toolbar UI feature implementation.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include    "cvtuifloatingtoolbar.h"
+#include    "cvtuifeaturemanager.h"
+#include    "mvtuicomponentmanager.h"
+#include    "mvtuicommandmanager.h"
+#include 	"cvtuitoolbarbutton.h"
+#include    "videotelui.hrh"
+#include 	"tVtuifeaturevariation.h"
+#include    "tvtuistates.h"
+#include    "cvtuitoolbarcmdpolicy.h"
+#include    "cvtuitoolbarskmodifier.h"
+#include    "CVtUiAppUi.h"
+#include    <videotelui.rsg>
+#include    <cvtlogger.h>
+#include    <akntoolbar.h>
+#include    <aknutils.h>
+#include    <aknlayoutscalable_apps.cdl.h>
+#include    <layoutmetadata.cdl.h>
+#include    <gfxtranseffect/gfxtranseffect.h>
+
+// CONSTANTS
+static const TInt KThreeToolbarbuttons = 3;
+static const TInt KFourToolbarbuttons = 4;
+static const TInt KFiveToolbarbuttons = 5;
+static const TInt KSixToolbarbuttons = 6;
+static const TInt KSevenToolbarbuttons = 7;
+
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::NewL
+// -----------------------------------------------------------------------------
+//
+CVtUiFloatingToolbar* CVtUiFloatingToolbar::NewL( CVtUiFeatureManager&
+     aFeatureManager )
+    {
+    __VTPRINTENTER( "FloatingToolbar.NewL" )
+        TVtUiSideVolumeKeysVariation svkvariation;
+    if ( !svkvariation.IsSideVolumeKeysSupported() )
+        {
+        // User of this class should notice that newl could return null,
+        // even if no leave happened.
+        __VTPRINT(DEBUG_GEN, "Toolbar.NewL.NULL" )
+        return NULL;
+        }
+    CVtUiFloatingToolbar* self = new ( ELeave ) CVtUiFloatingToolbar( 
+        aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    __VTPRINTEXIT( "FloatingToolbar.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::CVtUiFloatingToolbar
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiFloatingToolbar::CVtUiFloatingToolbar( CVtUiFeatureManager& 
+    aFeatureManager ) : CVtUiToolbarBase( aFeatureManager )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiFloatingToolbar::ConstructL()
+    {
+    __VTPRINTENTER( "FloatingToolbar.ConstructL" )
+    BaseConstructL();
+    
+    // fixed toolbar is always visible ( defined in resource) hide it
+    iFeatureManager.AppUi().CurrentFixedToolbar()->SetToolbarVisibility( EFalse );
+    
+    // create toolbar
+    iToolbar = CAknToolbar::NewL( R_VIDEOTELUI_FLOATING_TOOLBAR );
+
+    GfxTransEffect::Register( iToolbar, KNullUid, EFalse );
+    
+    // create and add items into the toolbar
+    CreateToolbarButtonsL();
+
+    iFeatureManager.UiStates().SetIsFloatingToolbarVisible( EFalse );
+    
+    // layout toolbar
+    LayoutToolbarL();
+    
+    User::LeaveIfError(
+        iFeatureManager.ComponentManager().ChangeResourceChangeRegistration(
+        *this, MVtUiComponentManager::ERegister ) );
+    
+    __VTPRINTEXIT( "FloatingToolbar.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::~CVtUiFloatingToolbar
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiFloatingToolbar::~CVtUiFloatingToolbar()
+    {
+    __VTPRINTENTER( "FloatingToolbar.~" )
+    // unregister resource change registration
+    iFeatureManager.ComponentManager().ChangeResourceChangeRegistration(
+        *this, MVtUiComponentManager::EUnregister );
+    delete iToolbar;
+    iToolbar = NULL;
+    __VTPRINTEXIT( "FloatingToolbar.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::PopulateCmdsIdsL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFloatingToolbar::PopulateCmdsIdsL()
+    {
+    __VTPRINTENTER( "FloatingToolbar.PopulateCmdsIdsL" )
+    CVtUiAppUi& appUi = iFeatureManager.AppUi();
+    
+    // Default commands populated in base clase
+    CVtUiToolbarBase::PopulateCmdsIdsL();
+    
+    iCmdIds.AppendL( EVtUiCmdZoom );
+    
+    switch( iNumberOfToolbarButtons )
+        {
+        case KFourToolbarbuttons:
+            iCmdIds.AppendL( EVtUiCmdUsePrimaryCamera );
+            iCmdIds.AppendL( EVtUiCmdUseSecondaryCamera );
+            break;
+
+        case KFiveToolbarbuttons:
+            iCmdIds.AppendL( EVtUiCmdUsePrimaryCamera );
+            iCmdIds.AppendL( EVtUiCmdUseSecondaryCamera );
+            iCmdIds.AppendL( EVtUiCmdSwapImagesPlaces );
+            break;
+
+        case KSixToolbarbuttons:
+            iCmdIds.AppendL( EVtUiCmdUsePrimaryCamera );
+            iCmdIds.AppendL( EVtUiCmdUseSecondaryCamera );
+            iCmdIds.AppendL( EVtUiCmdSwapImagesPlaces );
+            iCmdIds.AppendL( EVtUiCmdShareObjectImage );
+            break;
+        /*
+        case KSevenToolbarbuttons:
+            iCmdIds.AppendL( EVtUiCmdUsePrimaryCamera );
+            iCmdIds.AppendL( EVtUiCmdUseSecondaryCamera );
+            iCmdIds.AppendL( EVtUiCmdSwapImagesPlaces );
+            iCmdIds.AppendL( EVtUiCmdShareObjectImage );
+            iCmdIds.AppendL( EVtUiCmdSnapshot );
+            break;
+         */
+        default:
+            break;
+        }
+
+    __VTPRINTEXIT( "FloatingToolbar.PopulateCmdsIdsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::CreateToolbarButtons
+// -----------------------------------------------------------------------------
+//
+void CVtUiFloatingToolbar::CreateToolbarButtonsL()
+    {
+    __VTPRINTENTER( "FloatingToolbar.CreateToolbarButtons" )
+    
+    // Default buttons created in base clase
+    CVtUiToolbarBase::CreateToolbarButtonsL(); 
+    
+    CVtUiAppUi& appUi = iFeatureManager.AppUi();
+
+    // activate zoom mode
+    CreateToolbarItemL( R_AVKONBUTTON_ACTIVATE_ZOOM_MODE_BUTTON,
+        EVtUiCmdZoom, appUi );
+    // disable tooltip from button's latched state
+    // because tooltip needs to be shown only when
+    // button gets focus not then when button is selected
+    FindToolbarItemByCommandId( EVtUiCmdZoom )->State( 1 )
+        ->SetHelpTextL( KNullDesC() );
+
+    switch( iNumberOfToolbarButtons )
+        {
+        case KFourToolbarbuttons:
+            // toggle camera
+            CreateToolbarItemL( R_AVKONBUTTON_TOGGLE_CAMERA_BUTTON,
+                EVtUiCmdToolbarToggleCamera, appUi );
+            break;
+
+        case KFiveToolbarbuttons:
+             // toggle camera
+             CreateToolbarItemL( R_AVKONBUTTON_TOGGLE_CAMERA_BUTTON,
+                EVtUiCmdToolbarToggleCamera, appUi );
+
+            // swap images
+            CreateToolbarItemL( R_AVKONBUTTON_SWAP_IMAGES_BUTTON,
+                EVtUiCmdSwapImagesPlaces, appUi );
+            break;
+
+        case KSixToolbarbuttons:
+            // toggle camera
+             CreateToolbarItemL( R_AVKONBUTTON_TOGGLE_CAMERA_BUTTON,
+                EVtUiCmdToolbarToggleCamera, appUi );
+
+            // swap images
+            CreateToolbarItemL( R_AVKONBUTTON_SWAP_IMAGES_BUTTON,
+                EVtUiCmdSwapImagesPlaces, appUi );
+
+            // share file
+            CreateToolbarItemL(R_AVKONBUTTON_SHARE_FILE_BUTTON,
+                EVtUiCmdShareObjectImage, appUi );
+            break;
+        /*
+        case KSevenToolbarbuttons:
+            // toggle camera
+             CreateToolbarItemL( R_AVKONBUTTON_TOGGLE_CAMERA_BUTTON,
+                EVtUiCmdToolbarToggleCamera, appUi );
+
+            // swap images
+            CreateToolbarItemL( R_AVKONBUTTON_SWAP_IMAGES_BUTTON,
+                EVtUiCmdSwapImagesPlaces, appUi );
+
+            // share file
+            CreateToolbarItemL(R_AVKONBUTTON_SHARE_FILE_BUTTON,
+                EVtUiCmdShareObjectImage, appUi );
+
+            CreateToolbarItemL( R_AVKONBUTTON_SNAPSHOT_BUTTON,
+                EVtUiCmdSnapshot, appUi );
+
+            break;
+        */
+        default:
+            break;
+        }
+
+    __VTPRINTEXIT( "FloatingToolbar.CreateToolbarButtons" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::DoActivateL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFloatingToolbar::DoActivateL()
+    {
+    __VTPRINTENTER( "FloatingToolbar.DoActivateL" )
+    // start blocking key events
+    BlockKeyEvents( ETrue );
+    // make toolbar visible
+    if ( !iToolbar->IsVisible() ||
+            !iFeatureManager.UiStates().IsFloatingToolbarVisible() )
+        {
+        // Show toolbar
+        iToolbar->SetToolbarVisibility( ETrue );
+        }
+    else
+        {
+        // Undim toolbar
+        DimToolbar( EFalse, EFalse );
+        if ( iCmdFocus != KErrNotFound )
+            {
+            // Set focus item
+            iToolbar->SetItemDimmed( iCmdFocus, EFalse, ETrue );
+            iToolbar->SetFocusedItemL( iCmdFocus );
+            iCmdFocus = KErrNotFound;
+            }
+        }
+    iFeatureManager.UiStates().SetIsFloatingToolbarVisible( EFalse );
+    CVtUiToolbarBase::DoActivateL();
+    __VTPRINTEXIT( "FloatingToolbar.DoActivateL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::DoDeactivateL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFloatingToolbar::DoDeactivateL()
+    {
+    __VTPRINTENTER( "FloatingToolbar.DoDeactivateL" )
+     // stop blocking key events
+    BlockKeyEvents( EFalse );
+    if ( iToolbar )
+        {
+        // Save foces item;
+        if ( iToolbar->FocusedItem() != KErrNotFound )
+            {
+            iCmdFocus = iToolbar->FocusedItem();
+            }
+        TVtUiStates& uiStates = iFeatureManager.UiStates();
+        if ( !uiStates.IsFloatingToolbarVisible() )
+            {
+            __VTPRINT( DEBUG_GEN, "FloatingToolbar.DoDeactivateL.Vs" )
+            iToolbar->SetToolbarVisibility( EFalse );
+            }
+        else
+            {
+            // Dim toolbar
+            __VTPRINT( DEBUG_GEN, "FloatingToolbar.DoDeactivateL.Dim ETrue" )
+            DimToolbar( ETrue, EFalse );
+            }
+        CVtUiAppUi& appUi = iFeatureManager.AppUi();
+        const TBool isZoomModeOn( uiStates.IsZoomModeOn() );
+        if ( isZoomModeOn )
+            {
+            // set zoom indicator to be hidden
+            appUi.SetZoomModeL( EFalse );
+            }
+        }
+    CVtUiToolbarBase::DoDeactivateL();
+    __VTPRINTEXIT( "FloatingToolbar.DoDeactivateL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::HandleResourceChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFloatingToolbar::HandleResourceChangeL( TInt /*aType*/ )
+    {
+    __VTPRINTENTER( "FloatingToolbar.HandleResourceChangeL" )
+    // akntoolbar should allways be in the control stack
+    // no need to call
+    // iToolbar->HandleResourceChange
+    LayoutToolbarL();
+    __VTPRINTEXIT( "FloatingToolbar.HandleResourceChangeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::RectFromLayout
+// -----------------------------------------------------------------------------
+//
+TRect CVtUiFloatingToolbar::RectFromLayout(
+   const TAknWindowComponentLayout& aComponentLayout ) const
+   {
+   __VTPRINTENTER( "FloatingToolbar.RectFromLayout" )
+   TRect mainPaneRect;
+   AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
+
+   TAknWindowLineLayout lineLayout = aComponentLayout.LayoutLine();
+   TAknLayoutRect layoutRect;
+   layoutRect.LayoutRect( mainPaneRect, lineLayout );
+   __VTPRINTEXIT( "FloatingToolbar.RectFromLayout" )
+   return layoutRect.Rect();
+   }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::LayoutToolbarL
+// -----------------------------------------------------------------------------
+//
+void CVtUiFloatingToolbar::LayoutToolbarL()
+    {
+    __VTPRINTENTER( "FloatingToolbar.LayoutToolbarL" )
+
+    // Get variety
+    TInt variety = GetVariety( Layout_Meta_Data::IsLandscapeOrientation() );
+    // get toolbar rect from layout
+    TRect toolbarRect = RectFromLayout( AknLayoutScalable_Apps::
+        popup_toolbar_window_cp04( variety ).LayoutLine() );
+    //set top left coordinates i.e. placeholder
+    iToolbar->SetPosition( toolbarRect.iTl );
+
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        __VTPRINT( DEBUG_GEN, "Toolbar.LayoutToolbarL.LS" )
+        iToolbar->SetOrientation( EAknOrientationVertical );
+        }
+    else
+        {
+        __VTPRINT( DEBUG_GEN, "Toolbar.LayoutToolbarL.PR" )
+        iToolbar->SetOrientation( EAknOrientationHorizontal );
+        }
+    __VTPRINTEXIT( "FloatingToolbar.LayoutToolbarL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiFloatingToolbar::GetVariety
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiFloatingToolbar::GetVariety( TBool aIsLandscapeOrientation )
+    {
+    __VTPRINTENTER( "FloatingToolbar.GetVariety" )
+    TInt variety = 0;
+    switch ( iNumberOfToolbarButtons )
+        {
+        case KThreeToolbarbuttons:
+            if( aIsLandscapeOrientation )
+                {
+                variety = 5;
+                }
+            else
+                {
+                variety = 9;
+                }
+            break;
+
+        case KFourToolbarbuttons:
+            if( aIsLandscapeOrientation )
+                {
+                variety = 4;
+                }
+            else
+                {
+                variety = 8;
+                }
+            break;
+
+        case KFiveToolbarbuttons:
+            if( aIsLandscapeOrientation )
+                {
+                variety = 3;
+                }
+            else
+                {
+                variety = 7;
+                }
+            break;
+
+        case KSixToolbarbuttons:
+            if( aIsLandscapeOrientation )
+                {
+                variety = 2;
+                }
+            else
+                {
+                variety = 6;
+                }
+            break;
+
+        case KSevenToolbarbuttons:
+            if( aIsLandscapeOrientation )
+                {
+                variety = 1;
+                }
+            else
+                {
+                variety = 4;
+                }
+            break;
+
+        default:
+
+            break;
+        }
+    __VTPRINTEXITR( "FloatingToolbar.GetVariety =%d",variety )
+    return variety;
+    }
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/toolbar/cvtuihidetoolbaritemaction.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,246 @@
+/*
+* 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:  Toolbar hide item action class.
+*
+*/
+
+
+#include <cvtlogger.h>
+#include "cvtuihidetoolbaritemaction.h"
+#include "tvtuicmdvalidatorcallback.h"
+#include "tvtuitoolbarcommanditerator.h"
+#include "cvtuitoolbarbase.h"
+#include "videotelui.hrh"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiHideToolbarItemAction::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiHideToolbarItemAction* CVtUiHideToolbarItemAction::NewL(
+    CVtUiToolbarBase* aToolbar, const TVtUiStates& aUiStates )
+    {
+    __VTPRINTENTER( "HideTbAct.NewL" )
+    CVtUiHideToolbarItemAction* self =
+        new ( ELeave ) CVtUiHideToolbarItemAction( aToolbar, aUiStates );
+    __VTPRINTEXIT( "HideTbAct.NewL" )
+    return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CVtUiHideToolbarItemAction::~CVtUiHideToolbarItemAction
+// ---------------------------------------------------------------------------
+//
+CVtUiHideToolbarItemAction::~CVtUiHideToolbarItemAction()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiHideToolbarItemAction::ProcessL
+// ---------------------------------------------------------------------------
+//
+void CVtUiHideToolbarItemAction::ProcessL(
+    const MVtUiCmdValidatorCallBack& aCallBack )
+    {
+    __VTPRINTENTER( "HideTbAct.ProcessL" )
+    for ( TVtUiToolbarCommandIterator i( *iToolbar ); i.HasNext(); )
+        {
+        TInt commandId( i.Next() );
+    	if ( !IsCommandHandled( commandId ) )
+    	    {
+    	    __VTPRINT2( DEBUG_GEN, "HideTbAct.cb.call.cmddId=%d", commandId )
+            if ( aCallBack.Call( commandId ) )  // primarypolicy 
+                {                               // says can't be shown
+        	    CommandHandledL( commandId );
+        	    SetItemHiddenL( commandId );
+                }
+             else
+                {
+                HideOrShowToolbarControlL( commandId );
+                }
+    	    }
+        }
+    __VTPRINTEXIT( "HideTbAct.ProcessL" )
+	}
+
+// ---------------------------------------------------------------------------
+// CVtUiHideToolbarItemAction::CVtUiHideToolbarItemAction
+// ---------------------------------------------------------------------------
+//
+CVtUiHideToolbarItemAction::CVtUiHideToolbarItemAction
+    ( CVtUiToolbarBase* aToolbar, const  TVtUiStates& aUiStates )
+    : iToolbar( aToolbar ), iUiStates ( aUiStates )
+    {
+    __VTPRINTENTER( "HideTbAct.ctor" )    
+    __VTPRINTEXIT( "HideTbAct.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiHideToolbarItemAction::SetItemHiddenL
+// ---------------------------------------------------------------------------
+//
+void CVtUiHideToolbarItemAction::SetItemHiddenL( TInt aCommandId )
+    {
+    __VTPRINTENTER( "HideTbAct.SetItemHidden" )
+    iToolbar->SetCmdIdVisibilityStateL( aCommandId, 
+        CVtUiToolbarBase::EHidden );
+    __VTPRINTEXIT( "HideTbAct.SetItemHidden" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiHideToolbarItemAction::HideOrShowToolbarControlL
+// ---------------------------------------------------------------------------
+//
+void CVtUiHideToolbarItemAction::HideOrShowToolbarControlL
+     ( TInt aCommandId )
+     {
+     __VTPRINTENTER( "HideTbAct.HideOrShowToolbarControlL" )
+     TBool isZoomModeOn = iUiStates.IsZoomModeOn();
+     TBool isVolumeModeOn = iUiStates.IsVolumeModeOn();
+     TBool isBrightnessModeOn = iUiStates.IsBrightnessModeOn();
+     TBool isContrastModeOn = iUiStates.IsContrastModeOn();
+     TBool dimmed = EFalse;
+     const TVtUiMediaState& mediaState( iUiStates.MediaState() );
+     const TVtUiAudioState& audioState( iUiStates.AudioState() );
+
+     switch ( aCommandId )
+            {
+            case EVtUiCmdDisableVideo:
+            case EVtUiCmdSwapImagesPlaces:
+            case EVtUiCmdDisableAudio:
+            case EVtUiCmdEnableAudio:
+                if ( isContrastModeOn || 
+                    isBrightnessModeOn
+                    || isZoomModeOn || isVolumeModeOn )
+                    {
+                    dimmed = ETrue;
+                    }
+                break;
+            case EVtUiCmdEnableVideo:
+                if ( isZoomModeOn || isVolumeModeOn )        
+                    {
+                    dimmed = ETrue;
+                    }             
+                break;
+                
+            case EVtUiCmdUsePrimaryCamera:            
+            case EVtUiCmdUseSecondaryCamera:
+                if ( isContrastModeOn || 
+                    isBrightnessModeOn
+                    || iUiStates.IsCaptureModeOn() ||
+                    mediaState.IsSharing()
+                    || isZoomModeOn || isVolumeModeOn )        
+                    {
+                    dimmed = ETrue;
+                    } 
+                break;
+            case EVtUiCmdZoom:
+                if ( isContrastModeOn ||
+                     isBrightnessModeOn||
+                     !mediaState.IsVideo() ||
+                     mediaState.IsFrozen() ||
+                     mediaState.IsSharing() ||
+                     isVolumeModeOn )
+                     {
+                     dimmed = ETrue;
+                     }
+                 break;
+                 
+            case EVtUiCmdShareObjectImage:
+                if ( isContrastModeOn || 
+                     isBrightnessModeOn ||
+                     isZoomModeOn || mediaState.IsFrozen() ||
+                     mediaState.IsVideoPermanentlyStopped() ||
+                     isVolumeModeOn )
+                     {
+                     dimmed = ETrue;
+                     } 
+                break;
+
+            case EVtUiCmdActivateBT:
+                dimmed = !audioState.CanActivateBtHf() ||
+                    audioState.IsAudioPermanentlyStopped() ||
+                    isZoomModeOn || isContrastModeOn || 
+                    isBrightnessModeOn ||
+                    isVolumeModeOn ;
+                break;
+
+            case EVtUiCmdDeactivateLoudspeaker:
+                dimmed = !audioState.CanDeactivateLoudspeaker() ||
+                    audioState.IsAudioPermanentlyStopped() ||
+                    isZoomModeOn || isContrastModeOn || 
+                    isBrightnessModeOn ||
+                    isVolumeModeOn;
+                break;
+
+            case EVtUiCmdSwitchFromBTToIHF:
+                dimmed = !audioState.CanDeactivateBtHf() ||
+                    !audioState.CanActivateLoudspeaker() ||
+                    audioState.IsAudioPermanentlyStopped() ||
+                    isZoomModeOn || isContrastModeOn || 
+                    isBrightnessModeOn ||
+                    isVolumeModeOn;
+                break;
+
+            case EVtUiCmdActivateLoudspeaker:
+                dimmed = !audioState.CanActivateLoudspeaker() ||
+                    audioState.IsAudioPermanentlyStopped() ||
+                    isZoomModeOn || isContrastModeOn || 
+                    isBrightnessModeOn ||
+                    isVolumeModeOn;
+                break;
+
+            /*
+            case EVtUiCmdSnapshot:
+                 if ( iUiStates.IsContrastModeOn() || iUiStates.IsBrightnessModeOn ()
+                      || isZoomModeOn || ( !iUiStates.MediaState().IsVideo() && 
+                      !iUiStates.MediaState().IsFrozen() ) ||
+                      !iUiStates.MediaState().IsFreezeSupported() || iUiStates.IsContrastModeOn() || 
+                        iUiStates.IsBrightnessModeOn() || isVolumeModeOn )
+                     {
+                     dimmed = ETrue;
+                     } 
+                 break;
+            */                 
+            default:
+                 dimmed = EFalse;
+                break;
+            }
+            
+     // update toolbar's commands visibility values
+     if ( dimmed )
+        {
+        iToolbar->SetCmdIdVisibilityStateL( aCommandId, 
+            CVtUiToolbarBase::EDimmed );
+        }
+     else
+        {
+        iToolbar->SetCmdIdVisibilityStateL( aCommandId, 
+            CVtUiToolbarBase::EShown );
+        }
+     __VTPRINTEXIT( "HideTbAct.HideOrShowToolbarControlL" )
+     }
+
+// ---------------------------------------------------------------------------
+// CVtUiHideToolbarItemAction::EndProcess
+// ---------------------------------------------------------------------------
+//
+void CVtUiHideToolbarItemAction::EndProcess()
+    {
+    __VTPRINTENTER( "HideTbAct.EndProcess" )    
+    TRAP_IGNORE( iToolbar->UpdateToolbarL() );
+    __VTPRINTEXIT( "HideTbAct.EndProcess" )    
+    }   
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/toolbar/cvtuitoolbarbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,1244 @@
+/*
+* Copyright (c) 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:  Base class for toolbar.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <centralrepository.h>
+#include    <cvtlogger.h>
+#include    <akntoolbar.h>
+#include    <featmgr.h>
+#include    <stringloader.h>
+#include    <videotelui.rsg>
+#include    "videotelui.hrh"
+#include    "cvtuitoolbarbase.h"
+#include    "mvtuifeature.h"
+#include    "tvtuistates.h"
+#include    "cvtuitoolbarcontext.h"
+#include    "cvtuitoolbarcmdpolicy.h"
+#include    "cvtuicommandpolicymanager.h"
+#include    "cvtuihidetoolbaritemaction.h"
+#include    "cvtuifeaturemanager.h"
+#include    "CVtUiAppUi.h"
+#include    "mvtuicommandui.h"
+#include    "cvtuitoolbarskmodifier.h"
+#include    "mvtuicommandmanager.h"
+#include    "mvtuicomponentmanager.h"
+#include    "cvtuitoolbarbutton.h"
+#include    "VideoTelephonyInternalCRKeys.h"
+#include 	"tVtuifeaturevariation.h"
+#include 	"cvtuitoolbarbutton.h"
+#include    <layoutmetadata.cdl.h>
+
+// Implementation of TVtUiToolbarComponentState
+
+// ---------------------------------------------------------------------------
+// TVtUiToolbarComponentState::TVtUiToolbarComponentState
+// ---------------------------------------------------------------------------
+//
+TVtUiToolbarComponentState::TVtUiToolbarComponentState(
+    MVtUiComponent& aComponent ) :
+    TVtUiComponentState( aComponent,
+        TVtUiBlockListBitField(
+            MVtUiComponent::EComponentIdNull ) )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Used in FindToolbaItemByCommandId method to search toolbar item by cmd id.
+// ---------------------------------------------------------------------------
+//
+TInt ToolbarItemIdCmpFunc( const TInt* aId,
+    const CVtUiToolbarButton& aToolbarItem )
+    {
+    return ( *aId - aToolbarItem.CmdId() );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Used in CreateToolbarItemL method to search feature by cmd id.
+// ---------------------------------------------------------------------------
+//
+TInt ToolbarCmpFunc( const CVtUiToolbarButton& aV1, const CVtUiToolbarButton& aV2 )
+    {
+    return ( aV1.CmdId() - aV2.CmdId() );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::CVtUiToolbarBase
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVtUiToolbarBase::CVtUiToolbarBase( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiFeatureBase( EVtUiFeatureIdToolbar, aFeatureManager ),
+      iComponentState( *this )
+    {
+    __VTPRINTENTER( "Toolbar.CVtUiToolbarBase" )
+    // Get number of supported buttons.
+    // Six is the default value for floating toolbar
+    // and three buttons for fixed toolbar
+    TVtUiToolbarVariation toolbar;
+    iNumberOfToolbarButtons = toolbar.NumberOfButtons();
+    iCmdFocus = KErrNotFound;
+    __VTPRINTEXITR( "Toolbar.CVtUiToolbarBase %d", iNumberOfToolbarButtons )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::BaseConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::BaseConstructL()
+    {
+    __VTPRINTENTER( "Toolbar.ConstructL" )
+    CVtUiFeatureBase::BaseConstructL();
+    iFeatureManager.UiStates().SetIsToolbarAvailable( ETrue );
+    __VTPRINTEXIT( "Toolbar.ConstructL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::~CVtUiToolbarBase
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVtUiToolbarBase::~CVtUiToolbarBase()
+    {
+    __VTPRINTENTER( "Toolbar.~" )
+    // Stop();
+    // Stop can not be called here if toolbar is asked from ui fw = fixed toolbar.
+    // If stop is called a crash occurs, whose root cause can not be solved.
+    // It is related somehow with focus lost in ui fw.
+
+    Clean();
+    // unregister layout change
+    iFeatureManager.ComponentManager().ChangeLayoutChangeRegistration(
+        *this, MVtUiComponentManager::EUnregister );   
+    // no need tot call resetanddestroy because buttons ownership is
+    // transferred to akntoolbar.
+    iToolBarControls.Reset();
+    delete iToolbarCtx;
+    delete iToolbarCmdPolicy;
+    delete iHideToolbarItemAction;
+    delete iToolbarSKModifier;
+    iCmdIds.Close();
+    iCmdStates.Close();
+    __VTPRINTEXIT( "Toolbar.~" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::DynInitToolbarL
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::DynInitToolbarL( TInt /*aResourceId*/,
+    CAknToolbar* /*aToolbar*/ )
+    {
+    __VTPRINTENTER( "Toolbar.DynInitToolbarL" )
+    __VTPRINTEXIT( "Toolbar.DynInitToolbarL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::OfferToolbarEventL
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::OfferToolbarEventL( TInt aCommand )
+    {
+    __VTPRINTENTER( "Toolbar.OfferToolbarEventL" )
+    __VTPRINT2( DEBUG_GEN, "Toolbar.OfferToolbarEventL.aCommand=%d", aCommand )
+
+    // if capture mode is on all msk events must be converted to capture command
+    if ( iFeatureManager.UiStates().IsCaptureModeOn() )
+        {
+        iFeatureManager.AppUi().HandleCommandL( EVtUiCmdCapture );
+        return;
+        }
+
+        TInt command = MapCmdIdToChilId( aCommand );
+
+        if ( EVtUiCmdSwapImagesPlaces == command )
+            {
+            if ( !( iFeatureManager.AppUi().CanSwapImagePlaces() ) )
+                {
+                return;
+                }
+            }
+
+        iFeatureManager.AppUi().HandleCommandL( command );
+
+    __VTPRINTEXITR( "Toolbar.OfferToolbarEventL.cmd %d", aCommand )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::StartL
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::StartL()
+    {
+    CVtUiFeatureBase::StartL();
+    __VTPRINTENTER( "Toolbar.StartL" )
+    TInt error;
+    if ( iFeatureState == MVtUiFeature::EReady )
+        { 
+        TRAP( error, iFeatureManager.ComponentManager().
+            RequestActivationL( MVtUiComponent::EComponentIdToolbar ) );
+
+        // set state
+        iFeatureState = MVtUiFeature::EActive;
+        }
+    __VTPRINTEXITR( "Toolbar.StartL error = %d", error )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::Stop
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::Stop()
+    {
+    __VTPRINTENTER( "Toolbar.Stop" )
+    TInt error;
+    if ( iFeatureState == MVtUiFeature::EActive )
+        {
+        TRAP( error, iFeatureManager.ComponentManager().
+            DeActivateComponentL ( MVtUiComponent::EComponentIdToolbar ) );
+        // set state
+        iFeatureState = MVtUiFeature::EReady;
+        }
+    __VTPRINTEXITR( "Toolbar.Stop error = %d", error )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::InitFeature
+// Delayed initialization of the feature
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::InitFeatureL()
+    {
+    __VTPRINTENTER( "Toolbar.InitFeatureL" )
+    iFeatureState = EPreparing;
+    iToolBarControls.ReserveL( iNumberOfToolbarButtons );
+
+    //create toolbar
+    //iToolbar = CAknToolbar::NewL( R_VIDEOTELUI_TOOLBAR );
+
+    iToolbar->SetToolbarObserver( this );
+
+    // Prohibit toolbar sliding on UI.    
+    iToolbar->SetWithSliding( EFalse );
+
+    // create toolbar context and policy
+    iToolbarCtx =
+         CVtUiToolbarContext::NewL( iFeatureManager.CommandManager() );
+
+    iToolbarCmdPolicy = CVtUiToolbarCmdPolicy::NewL( *this );
+
+    // create toolbaraction
+    iHideToolbarItemAction = CVtUiHideToolbarItemAction::NewL( this,
+        iFeatureManager.UiStates() );
+
+    // create sofkey modifier
+    iToolbarSKModifier = CVtUiToolbarSKModifier::
+        NewL( iFeatureManager.AppUi(), iFeatureManager.UiStates() );
+
+    // set supported commands
+    PopulateCmdsIdsL();
+
+    User::LeaveIfError(
+       iFeatureManager.ComponentManager().ChangeComponentRegistration(
+       iComponentState, MVtUiComponentManager::ERegister ) );
+
+    User::LeaveIfError(
+       iFeatureManager.ComponentManager().ChangeLayoutChangeRegistration(
+       *this, MVtUiComponentManager::ERegister ) );
+
+    iFeatureState = EReady;
+
+    __VTPRINTEXIT( "Toolbar.InitFeatureL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::MapCmdIdToChilId
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiToolbarBase::MapCmdIdToChilId( TInt aCmdId )
+    {
+    __VTPRINTENTER( "Toolbar.MapCmdIdToChilId" )
+     __VTPRINT2( DEBUG_GEN, "Toolbar.MapCmdIdToChilId.aCmdId=%d", aCmdId )
+    TInt result = aCmdId;
+
+    CVtUiToolbarButton* tbButton = FindToolbarItemByCommandId( aCmdId );
+
+    const TInt stateIndexValue( tbButton->StateIndex() );
+    __VTPRINT2( DEBUG_GEN, "Toolbar.MapCmdIdToChilId.idx=%d", stateIndexValue )
+    switch( aCmdId )
+        {
+        case EVtUiCmdToolbarToggleVideo:
+            { 
+            switch ( stateIndexValue )
+                {
+            case 0:  
+            case 1:
+                result = EVtUiCmdDisableVideo;
+                break;
+            case 2:
+            case 3:
+                result = EVtUiCmdEnableVideo;
+                break;
+                }    
+            }
+            break;
+
+        case EVtUiCmdToolbarToggleMicrophone:
+            { 
+            switch ( stateIndexValue )
+                {
+            case 0:    
+            case 1:
+                result = EVtUiCmdDisableAudio;
+                break;
+            case 2:
+            case 3:
+                result = EVtUiCmdEnableAudio;
+                break;
+                }    
+            }
+            break;            
+
+        case EVtUiCmdToolbarAudioRouting:
+            {
+            switch ( stateIndexValue )
+                {
+            case 0:
+            case 1:
+                result = EVtUiCmdDeactivateLoudspeaker;
+                break;
+            case 2:
+            case 3:
+                result = EVtUiCmdSwitchFromBTToIHF;
+                break;
+            case 4:
+            case 5:
+                result = EVtUiCmdActivateLoudspeaker;
+                break;
+            case 6:
+            case 7:
+                result = EVtUiCmdActivateBT;
+                break;
+            default:
+                break;
+                };
+            }
+            break;
+
+        case EVtUiCmdToolbarToggleCamera:
+            {
+            switch ( stateIndexValue )
+                {
+            case 0:   
+            case 1:
+                result = EVtUiCmdUsePrimaryCamera;
+                break;
+            case 2:
+            case 3:
+                result = EVtUiCmdUseSecondaryCamera;
+                break;
+                }    
+            }
+            break;  
+     
+        default:
+            break;
+        }
+
+    if ( aCmdId == result )
+        {
+        TInt index( stateIndexValue - 1 );
+        if ( index < 0 )
+            {
+            index = tbButton->StatesCount() - 1;
+            }
+        tbButton->SetCurrentState( index, EFalse );
+        }
+
+    __VTPRINTEXITR( "Toolbar.MapCmdIdToChilId.result %d", (TInt)result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::MapCmdIdToParentId
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiToolbarBase::MapCmdIdToParentId( TInt aCmdId )
+    {
+    __VTPRINTENTER( "Toolbar.MapCmdIdToParentId" )
+    TInt result = aCmdId;
+        switch( aCmdId )
+            {
+            case EVtUiCmdDisableVideo:
+            case EVtUiCmdEnableVideo:
+                result = EVtUiCmdToolbarToggleVideo;
+                break;
+
+            case EVtUiCmdDisableAudio:
+            case EVtUiCmdEnableAudio:
+                result = EVtUiCmdToolbarToggleMicrophone;
+                break;
+
+            case EVtUiCmdActivateBT:
+            case EVtUiCmdSwitchFromBTToIHF:
+            case EVtUiCmdActivateLoudspeaker:
+            case EVtUiCmdDeactivateLoudspeaker:
+                result = EVtUiCmdToolbarAudioRouting;
+                break;
+
+            case EVtUiCmdUsePrimaryCamera:
+            case EVtUiCmdUseSecondaryCamera:
+                result = EVtUiCmdToolbarToggleCamera;
+                break;
+
+            default:
+                break;
+            }
+    __VTPRINTEXITR( "Toolbar.MapCmdIdToParentId.result %d", (TInt)result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::IsCmdIdVisibleInToggleButton
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiToolbarBase::IsCmdIdVisibleInToggleButton( TInt aCmdId )
+    {
+    __VTPRINTENTER( "Toolbar.IsCMdIdVisibleInTogB" )
+    TBool result( ETrue );
+    TInt cmdId( MapCmdIdToParentId( aCmdId ) );
+    TInt targetStateIndex( KErrNotFound );
+    switch( aCmdId )
+        {
+        case EVtUiCmdActivateBT:
+            targetStateIndex = 6;
+            break;
+
+        case EVtUiCmdActivateLoudspeaker:
+            targetStateIndex = 4;
+            break;
+
+        case EVtUiCmdSwitchFromBTToIHF:
+        case EVtUiCmdEnableVideo:
+        case EVtUiCmdEnableAudio:
+        case EVtUiCmdUseSecondaryCamera:
+            targetStateIndex = 2;
+            break;
+
+        case EVtUiCmdDisableVideo:
+        case EVtUiCmdDisableAudio:
+        case EVtUiCmdUsePrimaryCamera:
+        case EVtUiCmdDeactivateLoudspeaker:
+            targetStateIndex = 0;
+            break;
+
+        default:
+            break;
+        }
+
+    if ( targetStateIndex != KErrNotFound )
+        {
+        result = ( FindToolbarItemByCommandId( cmdId )
+            ->StateIndex() == targetStateIndex );
+        }
+
+    __VTPRINTEXITR( "Toolbar.IsCMdIdVisibleInTogB.result %d", (TInt)result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::PopulateCmdsIdsL
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::PopulateCmdsIdsL()
+    {
+    __VTPRINTENTER( "Toolbar.PopulateCmdsIdsL" )
+    CVtUiAppUi& appUi = iFeatureManager.AppUi();
+
+    // default commands
+    iCmdIds.AppendL( EVtUiCmdDisableVideo );
+    iCmdIds.AppendL( EVtUiCmdEnableVideo );
+    iCmdIds.AppendL( EVtUiCmdDisableAudio );
+    iCmdIds.AppendL( EVtUiCmdEnableAudio );
+
+    __VTPRINTEXIT( "Toolbar.PopulateCmdsIdsL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::SetToolbarVisibilityAfterLayoutChangeL
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::SetToolbarVisibilityAfterLayoutChangeL( TBool /*aVisible*/ )
+    {
+    __VTPRINTENTER( "Toolbar.SetToolbarVisibilityAfterLayoutChangeL" )
+    __VTPRINTEXIT( "Toolbar.SetToolbarVisibilityAfterLayoutChangeL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::IsToggleButtonHidden
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiToolbarBase::IsToggleButtonHidden(TInt aFirstCmdId, TInt aSecondCmdId )
+    {
+    __VTPRINTENTER( "Toolbar.IsToggleButtonHidden" )
+    TInt count = 0;
+    TBool result = EFalse;
+    for ( TInt i = 0; i < iCmdStates.Count(); i++ )
+        {
+        if ( iCmdStates[ i ].iCmdId == aFirstCmdId ||
+            iCmdStates[ i ].iCmdId == aSecondCmdId )
+            {
+            if ( iCmdStates[ i ].iNewState == EHidden )
+                {
+                count++;
+                }
+            }
+        }
+
+    if ( count > 1 )
+        {
+        __VTPRINT(DEBUG_GEN, "IsToggleButtonHidden.Count>1" )
+        result = ETrue;
+        }
+   __VTPRINTEXITR( "Toolbar.IsToggleButtonHidden.result%d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::Clean
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::Clean()
+    {
+    __VTPRINTENTER( "Toolbar.Clean" )
+    TRAP_IGNORE( CVtUiToolbarBase::DoDeactivateL() );
+    // unregister component change registration
+    iFeatureManager.ComponentManager().ChangeComponentRegistration(
+        iComponentState, MVtUiComponentManager::EUnregister );
+    __VTPRINTEXIT( "Toolbar.Clean" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::CreateToolbarButtons
+// -----------------------------------------------------------------------------
+//
+
+void CVtUiToolbarBase::CreateToolbarButtonsL()
+    {
+    __VTPRINTENTER( "Toolbar.CreateToolbarButtons" )
+    CVtUiAppUi& appUi = iFeatureManager.AppUi();
+
+    // two default buttons
+    // toggle video
+    CreateToolbarItemL( R_AVKONBUTTON_TOGGLE_VIDEO_BUTTON,
+        EVtUiCmdToolbarToggleVideo, appUi );
+
+    // toggle microphone
+    CreateToolbarItemL( R_AVKONBUTTON_TOGGLE_MICROPHONE_BUTTON,
+        EVtUiCmdToolbarToggleMicrophone, appUi );
+
+    __VTPRINTEXIT( "Toolbar.CreateToolbarButtons" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::CreateToolbarItemL
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::CreateToolbarItemL( TInt aResourceId, TInt aCommandId,
+    CVtUiAppUi& appUi  )
+    {
+    __VTPRINTENTER( "Toolbar.CreateToolbarItemL" )
+
+    CVtUiToolbarButton* toolbarItem = NULL;
+    TLinearOrder< CVtUiToolbarButton > linOrder( ::ToolbarCmpFunc );
+
+    // create toolbaritem
+    toolbarItem = CVtUiToolbarButton::NewLC( aResourceId, appUi, aCommandId );
+
+    // add toolbar item to toolbar
+    // CVtUiToolbarButton  ownership is transferred to akntoolbar
+    iToolbar->AddItemL( toolbarItem, EAknCtButton,
+                          aCommandId , NULL );
+
+    // add toolbar item to array
+    iToolBarControls.InsertInOrderL( toolbarItem, linOrder );
+
+    CleanupStack::Pop(); // toolbaritem
+
+    __VTPRINTEXIT( "Toolbar.CreateToolbarItemL" )
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::HideToolbarButton
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::HideToolbarButton( const TInt aCommandId, const TBool aHide,
+    const TBool aDrawNow )
+    {
+    __VTPRINTENTER( "Toolbar.HideToolbarButton" )
+    __VTPRINT2( DEBUG_GEN, "Toolbar.HideToolbarButton.aCommandId=%d", aCommandId )
+    TInt cmdId = MapCmdIdToParentId( aCommandId );
+
+    // unhide for toggle buttons not handled
+    if ( !aHide && cmdId != aCommandId )
+       {
+       return;
+       }
+
+    // Get toolbar item
+    CVtUiToolbarButton* tbItem = FindToolbarItemByCommandId( cmdId );
+
+    // get button's current state
+    TInt stateIndex = tbItem->StateIndex();
+
+    switch ( cmdId )
+        {
+        case EVtUiCmdToolbarToggleVideo:
+            // if both items should be hidden in togglebutton,
+            // then dim togglebutton
+            if ( IsToggleButtonHidden( EVtUiCmdDisableVideo,
+                    EVtUiCmdEnableVideo ) )
+                {
+                // update visibility state
+                TRAP_IGNORE(
+                    SetCmdIdVisibilityStateL( EVtUiCmdDisableVideo, EDimmed );
+                    SetCmdIdVisibilityStateL( EVtUiCmdEnableVideo, EDimmed );
+                    );
+                iToolbar->SetItemDimmed( cmdId, ETrue, EFalse );
+                return;
+                }
+            if ( ( stateIndex == 0 || stateIndex == 1 ) && 
+                EVtUiCmdDisableVideo == aCommandId )
+                {
+                tbItem->SetCurrentState ( 2, EFalse );
+                }
+             else if( ( stateIndex == 2 || stateIndex == 3 )&& 
+                EVtUiCmdEnableVideo == aCommandId )
+                {
+                tbItem->SetCurrentState ( 0, EFalse );
+                }
+            break;
+
+        case EVtUiCmdToolbarToggleMicrophone:
+            // if both items should be hidden in togglebutton,
+            // then dim togglebutton
+            if ( IsToggleButtonHidden( EVtUiCmdDisableAudio,
+                    EVtUiCmdEnableAudio ) )
+                {
+                // update visibility state
+                TRAP_IGNORE(
+                    SetCmdIdVisibilityStateL( EVtUiCmdDisableAudio, EDimmed );
+                    SetCmdIdVisibilityStateL( EVtUiCmdEnableAudio, EDimmed );
+                    );
+                iToolbar->SetItemDimmed( cmdId, ETrue, EFalse );
+                return;
+                }
+            if ( ( stateIndex == 0 || stateIndex == 1 ) && 
+                EVtUiCmdDisableAudio == aCommandId )
+                {
+                tbItem->SetCurrentState ( 2, EFalse );
+                }
+             else if( ( stateIndex == 2 || stateIndex == 3 ) &&
+                EVtUiCmdEnableAudio == aCommandId )
+                {
+                tbItem->SetCurrentState ( 0, EFalse );
+                }
+            break;
+
+        case EVtUiCmdToolbarAudioRouting:
+            {
+            const TBool isToggleButtonHidden(
+                IsToggleButtonHidden( EVtUiCmdActivateBT,
+                    EVtUiCmdSwitchFromBTToIHF ) &&
+                IsToggleButtonHidden( EVtUiCmdActivateLoudspeaker,
+                    EVtUiCmdDeactivateLoudspeaker )
+            );
+
+            if ( isToggleButtonHidden )
+                {
+                TRAP_IGNORE(
+                    SetCmdIdVisibilityStateL( EVtUiCmdActivateBT, EDimmed );
+                    SetCmdIdVisibilityStateL( EVtUiCmdDeactivateLoudspeaker,
+                        EDimmed );
+                    SetCmdIdVisibilityStateL( EVtUiCmdSwitchFromBTToIHF, EDimmed );
+                    SetCmdIdVisibilityStateL( EVtUiCmdActivateLoudspeaker,
+                        EDimmed );
+                    );
+                iToolbar->SetItemDimmed( cmdId, ETrue, EFalse );
+                return;
+                }
+            else
+                {
+                if ( tbItem )
+                    {
+                    const TVtUiAudioState& audioState(
+                        iFeatureManager.UiStates().AudioState() );
+
+                    TInt state( 0 ); // Deactivate loudspeaker
+
+                    if ( audioState.CanDeactivateBtHf() )
+                        {
+                        state = 2; //  Deactivate bthf
+                        }
+                    else if ( audioState.CanActivateBtHf() )
+                        {
+                        state = 6; // Activate bthf
+                        }
+                    else if ( audioState.CanActivateLoudspeaker() )
+                        {
+                        state = 4; // Activate loudspeaker
+                        }
+                    __VTPRINT2( DEBUG_GEN,
+                        "Toolbar.HideToolbarButton.AudioRoutingState=%d",
+                        state )
+                    tbItem->SetCurrentState ( state, EFalse );
+                    }
+                }
+            }
+            break;
+
+        case EVtUiCmdToolbarToggleCamera:
+            // if both items should be hidden in togglebutton,
+            // then dim togglebutton
+            if ( IsToggleButtonHidden( EVtUiCmdUsePrimaryCamera,
+                    EVtUiCmdUseSecondaryCamera ) )
+                {
+                // update visibility state
+                TRAP_IGNORE(
+                    SetCmdIdVisibilityStateL( EVtUiCmdUsePrimaryCamera, EDimmed );
+                    SetCmdIdVisibilityStateL( EVtUiCmdUseSecondaryCamera, EDimmed );
+                    );
+                iToolbar->SetItemDimmed( cmdId, ETrue, EFalse );
+                return;
+                }
+            if ( ( stateIndex == 0 || stateIndex == 1 ) && 
+                EVtUiCmdUsePrimaryCamera == aCommandId )
+                {
+                tbItem->SetCurrentState ( 2, EFalse );
+                }
+             else if( ( stateIndex == 2 || stateIndex == 3 ) &&
+                EVtUiCmdUseSecondaryCamera == aCommandId )
+                {
+                tbItem->SetCurrentState ( 0, EFalse );
+                }
+            break;
+
+        default:
+            iToolbar->HideItem( cmdId, aHide, aDrawNow);
+            __VTPRINT( DEBUG_GEN, "Toolbar.HideToolbarButton" )
+            break;
+        }
+    __VTPRINTEXIT( "Toolbar.HideToolbarButton" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::DimToolbar
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::DimToolbar( const TBool aDimmed, const TBool aDrawNow )
+    {
+    __VTPRINTENTER( "Toolbar.DimToolbar" )
+    __VTPRINT2( DEBUG_GEN, "Toolbar.DimToolbar.aDimmed=%d", (TInt)aDimmed )
+
+    TInt count = iCmdStates.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        __VTPRINT2( DEBUG_GEN, "iCmdId = %d", iCmdStates[ i ].iCmdId )
+        __VTPRINT3( DEBUG_GEN, "iCmdStates.iOldState=%d iCmdStates.iNewState=%d", 
+                iCmdStates[ i ].iOldState, iCmdStates[ i ].iNewState )
+        // dim item
+        if ( iCmdStates[ i ].iNewState == EShown )
+            {
+            DimToolbarButton( iCmdStates[ i ].iCmdId, aDimmed, aDrawNow );
+            }
+        }
+    __VTPRINTEXIT( "Toolbar.DimToolbar" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::DimToolbarButton
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::DimToolbarButton( const TInt aCommandId, const TBool aDimmed,
+    const TBool aDrawNow )
+    {
+    __VTPRINTENTER( "Toolbar.DimToolbarButton" )
+    __VTPRINT2( DEBUG_GEN, "Toolbar.DimToolbarButton.aCmdId=%d", aCommandId )
+
+    // command not visible, no need to update button
+    if ( !IsCmdIdVisibleInToggleButton( aCommandId ) )
+        {
+        __VTPRINTEXIT("Toolbar.DimToolbarButton.NotVisible" )
+        return;
+        }
+    TInt cmdId = MapCmdIdToParentId( aCommandId );
+    // dim item
+    iToolbar->SetItemDimmed( cmdId, aDimmed, aDrawNow );
+    __VTPRINTEXIT( "Toolbar.DimToolbarButton" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::FindToolbaItemByCommandId
+// -----------------------------------------------------------------------------
+//
+CVtUiToolbarButton* CVtUiToolbarBase::FindToolbarItemByCommandId
+    ( const TInt aCommandId )
+    {
+    __VTPRINTENTER( "Toolbar.FindToolbarItemByCmdId" )
+    CVtUiToolbarButton* result = NULL;
+
+    TInt index( iToolBarControls.
+        FindInOrder( aCommandId,::ToolbarItemIdCmpFunc ) );
+
+    if ( index != KErrNotFound )
+        {
+        result = iToolBarControls[ index ];
+        }
+    __VTPRINTEXITR( "Toolbar.FindToolbarItemByCmdId.result %d", (TInt)result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::StartBlocking
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::BlockPointerEvents( TBool aIsBlocking )
+    {
+     __VTPRINTENTER( "Toolbar.BlockPointerEvents" )
+    for (TInt i = 0; i < iToolBarControls.Count(); ++i )
+        {
+        iToolBarControls[ i ]->BlockPointerEvents( aIsBlocking );
+        }
+    __VTPRINTEXITR( "Toolbar.BlockPointerEvents =%d", aIsBlocking )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::StopBlocking
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::BlockKeyEvents( TBool aIsBlocking )
+    {
+    __VTPRINTENTER( "Toolbar.BlockKeyEvents" )
+    for ( TInt i = 0; i < iToolBarControls.Count(); ++i )
+        {
+        iToolBarControls[ i ]->BlockKeyEvents( aIsBlocking );
+        }
+    __VTPRINTEXITR( "Toolbar.BlockKeyEvents =%d", aIsBlocking )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::IsDialerActive
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiToolbarBase::IsDialerActive() const
+    {
+    __VTPRINTENTER( "Toolbar.IsDialerActive" )
+    TBool ret( EFalse );
+    MVtUiFeature* dialer = iFeatureManager.
+        GetFeatureById( EVtUiFeatureIdDialer );
+        if ( dialer )
+            {
+            if ( dialer->State() == MVtUiFeature::EActive  )
+                {
+                ret = ETrue;
+                }
+            } 
+    __VTPRINTEXITR( "Toolbar.IsDialerActive =%d", ret )
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::NumberOfToolbarControls
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiToolbarBase::NumberOfToolbarControls() const
+    {
+    __VTPRINTENTER( "Toolbar.NumberOfToolbarControls" )
+    __VTPRINTEXIT( "Toolbar.NumberOfToolbarControls" )
+    return iCmdIds.Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::CommandIdByCmdIdsArrayIndex
+// -----------------------------------------------------------------------------
+//
+ TInt CVtUiToolbarBase::CommandIdByCmdIdsArrayIndex( TInt aIndex ) const
+    {
+    __VTPRINTENTER( "Toolbar.CommandIdByCmdIdsArrayIndex" )
+    __VTPRINTEXIT( "Toolbar.CommandIdByCmdIdsArrayIndex.cmdId" )
+    return iCmdIds[aIndex];
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::UpdateToolbar
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::UpdateToolbarL()
+    {
+    __VTPRINTENTER( "Toolbar.UpdateToolbar" )
+    TVtUiStates& uiStates = iFeatureManager.UiStates();
+
+    // Zoom mode can be activated also from options menu
+    // therefore set zoom buttons state to latched
+    if ( uiStates.IsZoomModeOn() &&
+         IsCommandInToolbar( EVtUiCmdZoom )&&
+         FindToolbarItemByCommandId( EVtUiCmdZoom )
+           ->StateIndex() == 0  )
+        {
+        FindToolbarItemByCommandId( EVtUiCmdZoom )
+           ->SetCurrentState ( 1, ETrue );
+        }
+
+
+    if ( uiStates.IsCaptureModeOn() && IsCommandInToolbar( EVtUiCmdZoom ) )
+        {
+         __VTPRINT( DEBUG_GEN, "Toolbar.UpdateToolbarL.IsCaptureModeOn" )
+        // remove zoom mode button tooltip
+        FindToolbarItemByCommandId( EVtUiCmdZoom )
+           ->State( 0 )->SetHelpTextL( KNullDesC() );
+        // set zoom mode button to be focused
+        iToolbar->SetFocusedItemL( EVtUiCmdZoom );
+        }
+
+    TInt count = iCmdStates.Count();
+    for( TInt i = 0; i < count; i++ )
+       {
+       // no need to do anything
+       if ( iCmdStates[ i ].iOldState == iCmdStates[ i ].iNewState  )
+           {
+           if ( ( iCmdStates[ i ].iCmdId == EVtUiCmdDisableVideo ||
+                iCmdStates[ i ].iCmdId == EVtUiCmdEnableVideo ) &&
+                iCmdStates[ i ].iNewState != EShown  &&
+                !( iFeatureManager.UiStates().MediaState().IsSharing() ) )
+                {
+                CVtUiToolbarButton* tbButton =  static_cast< CVtUiToolbarButton* >(
+                    FindToolbarItemByCommandId( EVtUiCmdToolbarToggleVideo ) );
+                tbButton->SetCurrentState(
+                iFeatureManager.UiStates().MediaState().IsVideo() ? 0 : 2 , ETrue );
+                }
+           // for the case that EVtUiCmdDisableVideo and
+           // EVtUiCmdActivateBT command
+           // need to be shown but it is not visible in
+           // toogle button.
+           if ( ( iCmdStates[ i ].iCmdId == EVtUiCmdSwitchFromBTToIHF ||
+               iCmdStates[ i ].iCmdId == EVtUiCmdActivateBT ||
+               iCmdStates[ i ].iCmdId == EVtUiCmdActivateLoudspeaker ||
+               iCmdStates[ i ].iCmdId == EVtUiCmdDeactivateLoudspeaker ||
+               iCmdStates[ i ].iCmdId == EVtUiCmdDisableAudio ||
+               iCmdStates[ i ].iCmdId == EVtUiCmdEnableAudio  ||
+               iCmdStates[ i ].iCmdId == EVtUiCmdDisableVideo  ||
+               iCmdStates[ i ].iCmdId == EVtUiCmdEnableVideo) &&
+                   iCmdStates[ i ].iNewState == EShown )
+               {
+               // Nothing goes here.
+               }
+           else
+               {
+               continue;
+               }
+           }
+       // dim item
+       if ( iCmdStates[ i ].iNewState == EDimmed )
+           {
+           DimToolbarButton( iCmdStates[ i ].iCmdId, ETrue, EFalse );
+           }
+       // hide item
+       // currently used only for toggle buttons
+       // otherwise EDrawNow parameter must be updated for last element
+       else if ( iCmdStates[ i ].iNewState == EHidden )
+           {
+           HideToolbarButton( iCmdStates[ i ].iCmdId, ETrue, EFalse );
+           }
+       // show item
+       else if ( iCmdStates[ i ].iNewState == EShown )
+           {
+           // items are undimmed if they were dimmed
+           // iCmdStates[ i ].iOldState == EDimmed  comparison does
+           // not work with toggle buttons.
+           // That is why all buttons are undimmed.
+           DimToolbarButton( iCmdStates[ i ].iCmdId, EFalse, EFalse );
+
+           HideToolbarButton( iCmdStates[ i ].iCmdId, EFalse, EFalse );
+           }
+       }
+
+    // capture mode ended remove zoom button's latched state
+    if ( !uiStates.IsZoomModeOn() &&
+         IsCommandInToolbar( EVtUiCmdZoom )&&
+         FindToolbarItemByCommandId( EVtUiCmdZoom )->StateIndex() == 1 )
+        {
+        FindToolbarItemByCommandId( EVtUiCmdZoom )
+            ->SetCurrentState ( 0, ETrue );
+        }
+
+    // if capture mode was activated set zoom mode button active
+    if ( uiStates.IsCaptureModeOn() && IsCommandInToolbar( EVtUiCmdZoom ) )
+       {
+       // set latched (selected) state
+       FindToolbarItemByCommandId( EVtUiCmdZoom )
+            ->SetCurrentState ( 1, ETrue);
+       }
+    else
+       {
+       // tooltip must be returned to zoom mode button
+       // only after zoom mode buttons latched state is changed
+       // because changing the buttons state will draw the tooltip
+       if ( IsCommandInToolbar( EVtUiCmdZoom ) &&
+            ( KNullDesC() == ( FindToolbarItemByCommandId( EVtUiCmdZoom )
+                ->State(0)->HelpText() ) ) )
+            {
+            HBufC* tooltip = StringLoader::LoadLC( R_VIDEOTELUI_TOOLTIP_ZOOM );
+            FindToolbarItemByCommandId( EVtUiCmdZoom )
+                ->State(0)->SetHelpTextL( *tooltip );
+            CleanupStack::PopAndDestroy( ); // tooltip
+            }
+        }
+
+    // draw toolbar
+    //iToolbar->DrawDeferred();
+    iToolbar->DrawNow();
+    __VTPRINTEXIT( "Toolbar.UpdateToolbar" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::SetCmdIdVisibilityStateL
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::SetCmdIdVisibilityStateL( TInt aCmdId,
+    TCmdStateFlags aNewState )
+    {
+    __VTPRINTENTER( "Toolbar.SetCmdIdVisibilityStateL" )
+    __VTPRINT2( DEBUG_GEN, "Toolbar.SetCmdIdVbStateL.aCmdId=%d", aCmdId )
+    __VTPRINT2( DEBUG_GEN, "Toolbar.SetCmdIdVbStateL.aNewState=%d", aNewState )
+
+    TInt result = KErrNotFound;
+    for ( TInt i = 0; i < iCmdStates.Count(); i++ )
+        {
+        if ( iCmdStates[ i ].iCmdId == aCmdId )
+            {
+            // command found
+            result = i;
+            break;
+            }
+        }
+    // new item
+    // add to array
+    if( result == KErrNotFound )
+        {
+        TCommandState state;
+        state.iCmdId = aCmdId;
+        state.iOldState = ENotInitialized;
+        state.iNewState = aNewState;
+        iCmdStates.AppendL( state );
+        }
+    else // old item
+        {
+        iCmdStates[ result ].iOldState = iCmdStates[ result ].iNewState;
+        iCmdStates[ result ].iNewState = aNewState;
+        }
+
+    __VTPRINTEXIT( "Toolbar.SetCmdIdVbStateL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::IsCommandInToolbar
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiToolbarBase::IsCommandInToolbar( TInt aCmdId ) const
+    {
+    __VTPRINTENTER( "Toolbar.SetCmdIdVisibilityStateL" )
+    TBool result = EFalse;
+    for ( TInt i = 0; i < iCmdIds.Count(); i++ )
+        {
+        if ( iCmdIds[ i ] == aCmdId )
+            {
+            result = ETrue;
+            break;
+            }
+        }
+    __VTPRINTEXITR( "Toolbar.IsCommandInToolbar.result %d", (TInt)result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::RefreshL
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::RefreshL()
+    {
+    __VTPRINTENTER( "Toolbar.RefreshL" )
+    iFeatureManager.CommandManager().
+        ValidateToolbarItemsL( *iHideToolbarItemAction );
+    __VTPRINTEXIT( "Toolbar.RefreshL" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::AddCommandModifier
+// -----------------------------------------------------------------------------
+//
+TInt CVtUiToolbarBase::AddCommandModifier( CVtUiCommandModifyBase& /*aModifier*/ )
+    {
+    __VTPRINTENTER( "Toolbar.AddCommandModifier" )
+    __VTPRINTEXIT( "Toolbar.AddCommandModifier" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::RemoveCommandModifier
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::RemoveCommandModifier( CVtUiCommandModifyBase& /*aModifier*/ )
+    {
+    __VTPRINTENTER( "Toolbar.RemoveCommandModifier" )
+    __VTPRINTEXIT( "Toolbar.RemoveCommandModifier" )
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::ComponentId
+// -----------------------------------------------------------------------------
+//
+MVtUiComponent::TComponentId CVtUiToolbarBase::ComponentId() const
+    {
+    __VTPRINTENTER( "Toolbar.ComponentId" )
+    __VTPRINTEXIT( "Toolbar.ComponentId" )
+    return MVtUiComponent::EComponentIdToolbar;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::ComponentAsControl
+// -----------------------------------------------------------------------------
+//
+CCoeControl* CVtUiToolbarBase::ComponentAsControl()
+    {
+    __VTPRINTENTER( "Toolbar.ComponentAsControl" )
+    __VTPRINTEXIT( "Toolbar.ComponentAsControl" )
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::DoActivateL
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::DoActivateL()
+    {
+    __VTPRINTENTER( "Toolbar.DoActivateL" )
+    // add command ui to commandmanager
+    User::LeaveIfError(
+        iFeatureManager.CommandManager().AddCommandUi( *this ) );
+    // add command modifier
+    User::LeaveIfError( iFeatureManager.
+       CommandManager().AddCommandModifier( *iToolbarSKModifier ) );
+    // add validator
+    User::LeaveIfError( iFeatureManager.CommandManager().
+        AddValidator( *iToolbarCmdPolicy ) );
+    // refresh
+    iFeatureManager.CommandManager().RefreshL();
+    __VTPRINTEXIT( "Toolbar.DoActivateL" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVtUiToolbarBase::DoDeactivateL
+// -----------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::DoDeactivateL()
+    {
+    __VTPRINTENTER( "Toolbar.DoDeactivateL" )
+    // remove command modifier
+    iFeatureManager.CommandManager().
+        RemoveCommandModifier( *iToolbarSKModifier );
+    // remove command validator
+    iFeatureManager.CommandManager().RemoveValidator( *iToolbarCmdPolicy );
+     // remove commandui
+    iFeatureManager.CommandManager().RemoveCommandUi( *this );
+    if ( iToolbar )
+        {
+        __VTPRINT(DEBUG_GEN, "Toolbar.DoDeactivateL, iToolbar is not null" )
+        iToolbar->DrawNow();
+        }
+    __VTPRINTEXIT( "Toolbar.DoDeactivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarBase::HandleLayoutChangeL
+// ---------------------------------------------------------------------------
+//
+void CVtUiToolbarBase::HandleLayoutChangeL()
+    {
+    __VTPRINTENTER( "CVtUiToolbarBase.HandleLayoutChangeL" )
+    TBool isLandscape  = Layout_Meta_Data::IsLandscapeOrientation();
+    CEikMenuBar* menuBar = CEikonEnv::Static()->AppUiFactory()->MenuBar();
+    
+    // This check prevents toolbar from drawing over the dialer
+    // when orientation is changed from landscape to portrait
+    
+    // Transition from landsacpe to portrait
+    // toolbar must be hided
+    if ( !isLandscape && IsDialerActive() )
+        {
+        __VTPRINT(DEBUG_GEN, "CVtUiToolbarBase.LayoutChangeL.Stop" )
+        SetToolbarVisibilityAfterLayoutChangeL( EFalse );
+        }
+    else if ( iFeatureManager.UiStates().IsSelectingShare() )
+        {
+        __VTPRINT( DEBUG_GEN, "ToolbarBase::HandleLayoutChangeL ShareImage." )
+        SetToolbarVisibilityAfterLayoutChangeL( EFalse );
+        }
+    else if ( !isLandscape && iFeatureManager.UiStates().IsVideoQualityModeOn() )
+        {
+        __VTPRINT( DEBUG_GEN, "ToolbarBase::HandleLayoutChangeL Video Quality." )
+        SetToolbarVisibilityAfterLayoutChangeL( EFalse );
+        }
+    else if ( !isLandscape && iFeatureManager.UiStates().IsWhiteBalanceModeOn() )
+        {
+        __VTPRINT( DEBUG_GEN, "ToolbarBase::HandleLayoutChangeL White Balance." )
+        SetToolbarVisibilityAfterLayoutChangeL( EFalse );
+        }
+    else if ( !isLandscape && iFeatureManager.UiStates().IsColorToneModeOn() )
+        {
+        __VTPRINT( DEBUG_GEN, "ToolbarBase::HandleLayoutChangeL Color Tone." )
+        SetToolbarVisibilityAfterLayoutChangeL( EFalse );
+        }
+    else if ( !isLandscape && menuBar && menuBar->IsDisplayed() )
+        {
+        __VTPRINT( DEBUG_GEN, "ToolbarBase::HandleLayoutChangeL Menu Displayed." )
+        SetToolbarVisibilityAfterLayoutChangeL( EFalse );
+        }
+    // Transition from portrait to landsacpe
+    // toolbar must be set to visible
+    else if ( isLandscape && IsDialerActive() )
+        {
+        __VTPRINT(DEBUG_GEN, "CVtUiToolbarBase.LayoutChangeL.StartL" )
+        SetToolbarVisibilityAfterLayoutChangeL( ETrue );
+        }
+    __VTPRINTEXIT( "CVtUiToolbarBase.HandleLayoutChangeL" )
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/toolbar/cvtuitoolbarbutton.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,191 @@
+/*
+* 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:  CVtUiToolbarButton implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <cvtlogger.h>
+#include    "cvtuitoolbarbutton.h"
+#include    "CVtUiAppUi.h"
+#include    "videotelui.hrh"
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::NewL
+// -----------------------------------------------------------------------------
+//
+CVtUiToolbarButton* CVtUiToolbarButton::NewL( TInt aResourceId,
+	CVtUiAppUi& aAppUi, TInt aCmdId  )
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.NewL" )
+    CVtUiToolbarButton* self = CVtUiToolbarButton::NewLC( aResourceId, aAppUi,
+        aCmdId );
+    CleanupStack::Pop( self );
+    __VTPRINTEXIT( "CVtUiToolbarButton.NewL" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiNaviPane::NewLC
+// -----------------------------------------------------------------------------
+//
+CVtUiToolbarButton* CVtUiToolbarButton::NewLC( TInt aResourceId,
+	CVtUiAppUi& aAppUi, TInt aCmdId  )
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.NewLC" )
+    CVtUiToolbarButton* self = new ( ELeave ) CVtUiToolbarButton( aAppUi,
+        aCmdId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    self->ConstructFromResourceL( aResourceId );
+    __VTPRINTEXIT( "CVtUiToolbarButton.NewLC" )
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::~CVtUiToolbarButton
+// ----------------------------------------------------------------------------
+//
+CVtUiToolbarButton::~CVtUiToolbarButton()
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.~" )
+    __VTPRINTEXIT( "CVtUiToolbarButton.~" )
+    }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::CVtUiToolbarButton
+// ----------------------------------------------------------------------------
+//
+CVtUiToolbarButton::CVtUiToolbarButton( CVtUiAppUi& aAppUi, TInt aCmdId )
+: CAknButton( 0 ), iAppUi( aAppUi ), iCmdId ( aCmdId ),
+    iIsBlockingKeyEvents ( EFalse ), iIsBlockingPointerEvents( EFalse )
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.CVtUiToolbarButton" )
+    __VTPRINTEXIT( "CVtUiToolbarButton.CVtUiToolbarButton")
+    }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::ShowHelpL
+// ----------------------------------------------------------------------------
+//
+void CVtUiToolbarButton::ShowHelpL()
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.ShowHelpL" )
+    CAknButton::ShowHelpL();
+    __VTPRINTEXIT( "CVtUiToolbarButton.ShowHelpL")
+    }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::CmdId
+// ----------------------------------------------------------------------------
+//
+TInt CVtUiToolbarButton::CmdId() const
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.CmdId" )
+    __VTPRINTEXIT( "CVtUiToolbarButton.CmdId")
+    return iCmdId;
+    }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::BlockPointerEvents
+// ----------------------------------------------------------------------------
+//
+void CVtUiToolbarButton::BlockPointerEvents( TBool aIsBlocking )
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.BlockPointerEvents" )
+    iIsBlockingPointerEvents = aIsBlocking;
+    __VTPRINTEXITR( "CVtUiToolbarButton.BlockPointerEvents=%d", aIsBlocking )
+    }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::BlockKeyEvents
+// ----------------------------------------------------------------------------
+//
+void CVtUiToolbarButton::BlockKeyEvents( TBool aIsBlocking )
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.BlockKeyEvents" )
+    iIsBlockingKeyEvents = aIsBlocking;
+    __VTPRINTEXITR( "CVtUiToolbarButton.BlockKeyEvents=%d", aIsBlocking )
+    }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::OfferKeyEventL
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CVtUiToolbarButton::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.OfferKeyEventL" )
+    if ( IsCommandActive() && iIsBlockingKeyEvents )
+        {
+         __VTPRINTEXIT( "CVtUiToolbarButton.OfferKeyEventL.Blocked" )
+        return EKeyWasConsumed;
+        }
+ 	__VTPRINTEXIT( "CVtUiToolbarButton.OfferKeyEventL" )
+    return CAknButton::OfferKeyEventL( aKeyEvent, aType);
+   }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::HandlePointerEventL
+// ----------------------------------------------------------------------------
+//
+void CVtUiToolbarButton::HandlePointerEventL( const
+    TPointerEvent& aPointerEvent )
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.HandlePointerEventL" )
+    if ( IsCommandActive() && iIsBlockingPointerEvents )
+        {
+        __VTPRINTEXIT( "CVtUiToolbarButton.HandlePointerEventL.Blocked" )
+        return;
+        }
+    __VTPRINTEXIT( "CVtUiToolbarButton.HandlePointerEventL.To.AknButton" )
+    return CAknButton::HandlePointerEventL( aPointerEvent );
+    }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::StatesCount
+// ----------------------------------------------------------------------------
+//
+TInt CVtUiToolbarButton::StatesCount() const
+    {
+    return iStates->Count();
+    }
+
+// ----------------------------------------------------------------------------
+// CVtUiToolbarButton::IsCommandActive
+// ----------------------------------------------------------------------------
+//
+TBool CVtUiToolbarButton::IsCommandActive() const
+    {
+    __VTPRINTENTER( "CVtUiToolbarButton.IsCommandActive" )
+    TBool value( EFalse );
+    value = ( iAppUi.IsActiveCommand( EVtUiCmdDisableVideo ) ||
+              iAppUi.IsActiveCommand( EVtUiCmdEnableVideo ) ||
+              iAppUi.IsActiveCommand( EVtUiCmdEnableAudio ) ||
+              iAppUi.IsActiveCommand( EVtUiCmdDisableAudio ) ||
+              iAppUi.IsActiveCommand( EVtUiCmdUsePrimaryCamera ) ||
+              iAppUi.IsActiveCommand( EVtUiCmdUseSecondaryCamera ) ||
+              // Audio routing to blocking
+              iAppUi.IsActiveCommand( EVtUiCmdActivateBT ) ||
+              iAppUi.IsActiveCommand( EVtUiCmdSwitchFromBTToIHF ) ||
+              iAppUi.IsActiveCommand( EVtUiCmdActivateLoudspeaker ) ||
+              iAppUi.IsActiveCommand( EVtUiCmdDeactivateLoudspeaker )
+              );
+
+    __VTPRINTEXITR( "CVtUiToolbarButton.IsCommandActive=%d", value )
+    return value;
+    }
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/toolbar/cvtuitoolbarcmdpolicy.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* 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:  Toolbar command policy implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuitoolbarcmdpolicy.h"
+#include "cvtuicmdvalidationactionbase.h"
+#include "tvtuicmdvalidatorcallback.h"
+#include "cvtuitoolbarbase.h"
+#include "videotelui.hrh"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarCmdPolicy::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiToolbarCmdPolicy* CVtUiToolbarCmdPolicy::NewL( CVtUiToolbarBase& aToolbar )
+    {
+    __VTPRINTENTER( "ToolbarCmdPolicy.NewL" )
+    CVtUiToolbarCmdPolicy* self = new ( ELeave ) CVtUiToolbarCmdPolicy(
+        aToolbar );
+    __VTPRINTEXIT( "ToolbarCmdPolicy.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarCmdPolicy::ValidateMenuItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiToolbarCmdPolicy::ValidateMenuItemsL(
+    CVtUiCmdValidationActionBase& aAction, TInt /*aReferencePriority*/ )
+    {
+    __VTPRINTENTER( "ToolbarCmdPolicy.ValidateMenuItemsL" )
+    aAction.ProcessL(
+        TVtUiCmdValidatorCallBack< CVtUiToolbarCmdPolicy >( *this,
+            ValidateMenuCommand ) );
+    __VTPRINTEXIT( "ToolbarCmdPolicy.ValidateMenuItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarCmdPolicy::ValidateSoftkeyItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiToolbarCmdPolicy::ValidateSoftkeyItemsL(
+    CVtUiCmdValidationActionBase& /*aAction*/, TInt /*aReferencePriority*/ )
+    {
+    __VTPRINTENTER( "ToolbarCmdPolicy.ValidateSoftkeyItemsL" )
+    __VTPRINTEXIT( "ToolbarCmdPolicy.ValidateSoftkeyItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarCmdPolicy::ValidateToolbarItemsL
+// ---------------------------------------------------------------------------
+//
+void CVtUiToolbarCmdPolicy::ValidateToolbarItemsL(
+    CVtUiCmdValidationActionBase& /*aAction*/, TInt /*aReferencePriority*/ )
+    {
+    __VTPRINTENTER( "ToolbarCmdPolicy.ValidateToolbarItemsL" )
+    __VTPRINTEXIT( "ToolbarCmdPolicy.ValidateToolbarItemsL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarCmdPolicy::CustomValidationL
+// ---------------------------------------------------------------------------
+//
+void CVtUiToolbarCmdPolicy::CustomValidationL(
+    CVtUiCmdCustomValidationActionBase&, TInt )
+    {
+    __VTPRINTENTER( "ToolbarCmdPolicy.CustomValidationL" )
+    __VTPRINTEXIT( "ToolbarCmdPolicy.CustomValidationL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarCmdPolicy::ValidatesContext
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiToolbarCmdPolicy::ValidatesContext(
+    const TVtUiCmdContextType& aCtxType ) const
+    {
+    __VTPRINTENTER( "ToolbarCmdPolicy.ValidatesContext" )
+
+    TBool result( EFalse );
+
+    switch ( aCtxType )
+        {
+    case EVtUiCmdContextTypeMenu:
+    case EVtUiCmdContextTypeSoftkey:
+    case EVtUiCmdContextTypeToolbar:
+        result = ETrue;
+        break;
+
+    default:
+        break;
+        }
+
+    __VTPRINTEXITR( "ToolbarCmdPolicy.ValidatesContext %d", result )
+
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarCmdPolicy::CVtUiToolbarCmdPolicy
+// ---------------------------------------------------------------------------
+//
+CVtUiToolbarCmdPolicy::CVtUiToolbarCmdPolicy( CVtUiToolbarBase& aToolbar )
+    : CVtUiCmdValidatorBase( EVtUiCmdPolicyPriorityToolbar ),
+      iToolbar( aToolbar )
+    {
+    __VTPRINTENTER( "ToolbarCmdPolicy.ctor" )
+    __VTPRINTEXIT( "ToolbarCmdPolicy.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarCmdPolicy::ValidateMenuCommand
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiToolbarCmdPolicy::ValidateMenuCommand( TInt /*aCommandId*/ ) const
+    {
+    __VTPRINTENTER( "ToolbarCmdPolicy.ValidateMenuCommand" )
+    // all commands are also in options menu
+    __VTPRINTEXIT( "ToolbarCmdPolicy.ValidateMenuCommand")
+    return EFalse;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/toolbar/cvtuitoolbarcontext.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* 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:  Toolbar context implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+
+#include "cvtuitoolbarcontext.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarContext::~CVtUiToolbarContext
+// ---------------------------------------------------------------------------
+//
+CVtUiToolbarContext::~CVtUiToolbarContext()
+    {
+    __VTPRINTENTER( "ToolbarCtx.~" )
+    UnregisterCommandContext();
+    __VTPRINTEXIT( "ToolbarCtx.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarContext::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiToolbarContext* CVtUiToolbarContext::NewL(
+    MVtUiCommandManager& aCommandManager )
+    {
+    __VTPRINTENTER( "ToolbarCtx.NewL" )
+    CVtUiToolbarContext* self =
+        new ( ELeave ) CVtUiToolbarContext( aCommandManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "ToolbarCtx.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarContext::ValidateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiToolbarContext::ValidateL( CVtUiCmdValidationActionBase& aAction )
+    {
+    __VTPRINTENTER( "ToolbarCtx.ValidateL" )
+    ValidateToolbarItemsL( aAction );
+    __VTPRINTEXIT( "ToolbarCtx.ValidateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarContext::CVtUiToolbarContext
+// ---------------------------------------------------------------------------
+//
+CVtUiToolbarContext::CVtUiToolbarContext(
+    MVtUiCommandManager& aCommandManager )
+    : CVtUiCmdContext( aCommandManager, EVtUiCmdContextTypeToolbar,
+      KVtUiToolbarContextPriority )
+    {
+    __VTPRINTENTER( "ToolbarCtx.ctor" )
+    __VTPRINTEXIT( "ToolbarCtx.ctor" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarContext::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiToolbarContext::ConstructL()
+    {
+    __VTPRINTENTER( "ToolbarCtx.ConstructL" )
+    RegisterCommandContextL();
+    __VTPRINTEXIT( "ToolbarCtx.ConstructL" )
+    }
+    
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/toolbar/cvtuitoolbarskmodifier.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* 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:  Softkey modifier class implementation.
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    "cvtuitoolbarskmodifier.h"
+#include    "mvtuicommandsetting.h"
+#include    "tvtuicommandmodifierpriority.h"
+#include    "CVtUiAppUi.h"
+#include    "tvtuistates.h"
+#include    <eikbtgpc.h>
+#include    <videotelui.rsg>
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarSKModifier::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiToolbarSKModifier* CVtUiToolbarSKModifier::NewL( CVtUiAppUi& aAppUi,
+    const TVtUiStates& aUiStates )
+    {
+    __VTPRINTENTER( "CVtUiToolbarSKModifier.NewL" )
+    CVtUiToolbarSKModifier* self =
+        new ( ELeave ) CVtUiToolbarSKModifier( aAppUi, aUiStates );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    __VTPRINTEXIT( "CVtUiToolbarSKModifier.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarSKModifier::~CVtUiToolbarSKModifier
+// ---------------------------------------------------------------------------
+//
+CVtUiToolbarSKModifier::~CVtUiToolbarSKModifier()
+    {
+    __VTPRINTENTER( "CVtUiToolbarSKModifier.~" )
+    __VTPRINTEXIT( "CVtUiToolbarSKModifier.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarSKModifier::CVtUiToolbarSKModifier
+// ---------------------------------------------------------------------------
+//
+CVtUiToolbarSKModifier::CVtUiToolbarSKModifier( CVtUiAppUi& aAppUi,
+    const TVtUiStates& aUiStates ) :
+    CVtUiCommandModifyBase ( EVtUiCmdModifierPriorityToolbar ),
+    iAppUi ( aAppUi ), iUiStates ( aUiStates )
+    {
+    __VTPRINTENTER( "CVtUiToolbarSKModifier.Ctr" )
+    __VTPRINTEXIT( "CVtUiToolbarSKModifier.Ctr" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarSKModifier::CVtUiToolbarSKModifier
+// ---------------------------------------------------------------------------
+//
+void CVtUiToolbarSKModifier::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiToolbarSKModifier.ConstructL" )
+    __VTPRINTEXIT( "CVtUiToolbarSKModifier.ConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiToolbarSKModifier::CVtUiToolbarSKModifier
+// ---------------------------------------------------------------------------
+//
+void CVtUiToolbarSKModifier::ModifyCommandsL(
+     MVtUiCommandSetting& aCommandSettings )
+    {
+    __VTPRINTENTER( "CVtUiToolbarSKModifier.ModifyCommandsL" )
+    aCommandSettings.DoDefineCommandsL();
+
+    // No need to change MSK during snapshot
+    if ( iUiStates.IsCaptureModeOn() )
+        {
+        return;
+        }
+
+    CEikButtonGroupContainer* cba = iAppUi.GetCba();
+    const TInt mskIndex = 3;
+    // Set selection key to msk
+    cba->SetCommandL( mskIndex, R_VIDEOTELUI_SELECT_CBA_BUTTON );
+    __VTPRINTEXIT( "CVtUiToolbarSKModifier.ModifyCommandsL" )
+    }
+// ---------------------------------------------------------------------------
+// CVtUiToolbarSKModifier::CVtUiToolbarSKModifier
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiToolbarSKModifier::Supports( MVtUiCommandSetting::Type aType ) const
+    {
+    __VTPRINTENTER( "CVtUiToolbarSKModifier.Supports" )
+    __VTPRINTEXIT( "CVtUiToolbarSKModifier.Supports" )
+    return ( aType == MVtUiCommandSetting::ECommandTypeSoftkeys );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/toolbar/tvtuitoolbarcommanditerator.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* 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:  Toolbar command iterator implementation.
+*
+*/
+
+
+#include "cvtuitoolbarbase.h"
+#include "tvtuitoolbarcommanditerator.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// TVtUiToolbarCommandIterator::TVtUiToolbarCommandIterator
+// ---------------------------------------------------------------------------
+//
+TVtUiToolbarCommandIterator::TVtUiToolbarCommandIterator( CVtUiToolbarBase&
+    aToolbar ) : iToolbar( &aToolbar ), iCurrent( 0 )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// TVtUiToolbarCommandIterator::HasNext
+// ---------------------------------------------------------------------------
+//
+TBool TVtUiToolbarCommandIterator::HasNext() const
+    {
+    return ( iCurrent < iToolbar->NumberOfToolbarControls() );
+    }
+
+// ---------------------------------------------------------------------------
+// TVtUiToolbarCommandIterator::Next
+// ---------------------------------------------------------------------------
+//
+TInt TVtUiToolbarCommandIterator::Next()
+    {
+    return iToolbar->CommandIdByCmdIdsArrayIndex( iCurrent++ );
+    }
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/volume/cvtuivolume.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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:  Volume feature implementation.
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    "cvtuivolume.h"
+#include    "tvtuifeatureids.h"
+#include    "cvtuivolumepopup.h"
+#include    "cvtuifeaturemanager.h"
+#include    "tvtuifeatureids.h"
+#include    "tvtuistates.h"
+
+// ---------------------------------------------------------------------------
+// CVtUiVolume::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiVolume* CVtUiVolume::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiVolume.NewL" )
+    CVtUiVolume* self =
+        new ( ELeave ) CVtUiVolume( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiVolume.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolume::~CVtUiVolume
+// ---------------------------------------------------------------------------
+//
+CVtUiVolume::~CVtUiVolume()
+    {
+    __VTPRINTENTER( "CVtUiVolume.~" )
+    __VTPRINTEXIT( "CVtUiVolume.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolume::RefreshL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolume::RefreshL()
+    {
+    __VTPRINTENTER( "CVtUiVolume.RefreshL" )
+    if ( State() == EActive )
+        {
+        __VTPRINT( DEBUG_GEN, "CVtUiPopupBase.RefreshL.EActive" )
+        static_cast< CVtUiVolumePopup& >( Popup() ).RefreshL();
+        }
+    else
+        {
+        __VTPRINT( DEBUG_GEN, "CVtUiVolume.RefreshL.Else" )
+        static_cast< CVtUiVolumePopup& >( Popup() ).UpdateVolumeAndRoutingL();
+        }        
+    __VTPRINTEXIT( "CVtUiVolume.RefreshL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolume::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolume::StartL()
+    {
+    __VTPRINTENTER( "CVtUiVolume.StartL" )
+    // if brightness or contrast slider is active stop those
+    MVtUiFeature* br = iFeatureManager.
+    	GetFeatureById( EVtUiFeatureIdBrightness );
+    if ( br && br->State() == EActive )
+    	{
+        __VTPRINT( DEBUG_GEN, "CVtUiPopupBase.StartL.br->Stop" )
+    	br->Stop();
+    	}
+    
+    MVtUiFeature* cr = iFeatureManager.
+	GetFeatureById( EVtUiFeatureIdContrast );
+		if ( cr && cr->State() == EActive )
+			{
+			__VTPRINT( DEBUG_GEN, "CVtUiPopupBase.StartL.cr->Stop" )
+			cr->Stop();
+			}
+
+    if ( State() == EActive )
+        {
+        // need to refresh when already active to replenish the close timer
+        RefreshL();
+        }
+    else
+        {
+        iFeatureManager.UiStates().SetIsFloatingToolbarVisible( ETrue );
+        CVtUiSliderBase::StartL();
+        iFeatureManager.UiStates().SetVolumeModeOn( ETrue );
+        // Toolbar needs to be refreshed if contrat and brightness were dismissed
+        
+        }
+    __VTPRINTEXIT( "CVtUiVolume.StartL" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CVtUiVolume::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolume::Stop()
+    {
+    __VTPRINTENTER( "CVtUiVolume.Stop" )    	
+    iFeatureManager.UiStates().SetVolumeModeOn( EFalse );
+    CVtUiSliderBase::Stop();
+    __VTPRINTEXIT( "CVtUiVolume.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolume::GetVolumeValue
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiVolume::GetVolumeValue()
+    {
+    __VTPRINTENTER( "CVtUiVolume.GetVolumeValue" )    	
+    __VTPRINTEXITR( "CVtUiVolume.GetVolumeValue%d", Popup().Value() )
+    return Popup().Value();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolume::CVtUiVolume
+// ---------------------------------------------------------------------------
+//
+CVtUiVolume::CVtUiVolume( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiSliderBase( aFeatureManager, EVtUiFeatureIdVolume )
+    {
+
+    __VTPRINTENTER( "CVtUiVolume.CVtUiVolume" )
+    __VTPRINTEXIT( "CVtUiVolume.CVtUiVolume" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolume::CVtUiVolume
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolume:: ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiVolume.ConstructL" )
+    BaseConstructL();
+    SetPopup( CVtUiVolumePopup::NewL( iFeatureManager ) );
+    __VTPRINTEXIT( "CVtUiVolume.ConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/volume/cvtuivolumecontrol.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 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 of the cvtuivolumecontrol class.
+*
+*/
+
+
+#include    "cvtuivolumecontrol.h"
+#include    "MVtUiEngineCommandManager.h"
+#include    <mvtengcommandhandler.h>
+#include    <cvtlogger.h>
+#include    "cvtuivolume.h"
+#include    "cvtuifeaturemanager.h"
+
+// -----------------------------------------------------------------------------
+// CVtUiVolumeControl::CVtUiVolumeControl
+// -----------------------------------------------------------------------------
+//
+CVtUiVolumeControl::CVtUiVolumeControl(
+        MVtEngCommandHandler& aCommandHandler,
+        MVtEngAudio& aAudio,
+        MVtUiEngineCommandManager& aCommandManager,
+        CVtUiFeatureManager& aFeatureManager )
+    :  iCommandHandler( aCommandHandler ),
+      iAudio( aAudio ),
+      iCommandManager( aCommandManager ),
+      iVolumePtr( (TUint8*)&iVolume, sizeof( TVolume ) ),
+      iFeatureManager( aFeatureManager )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVolumeControl::~CVtUiVolumeControl
+// -----------------------------------------------------------------------------
+//
+CVtUiVolumeControl::~CVtUiVolumeControl()
+    {
+    if ( iIsActive )
+        {
+        iCommandHandler.CancelCommand( KVtEngSetAudioVolume ); // ignore error
+        }
+    iCommandManager.RemoveObserver( *this );               
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVolumeControl::ExecuteDialogLD
+// -----------------------------------------------------------------------------
+//
+void CVtUiVolumeControl::ConstructL()
+    {
+    CleanupStack::PushL( this );
+    iCommandManager.AddObserverL( *this );
+    CleanupStack::Pop( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVolumeControl::SetVoAdjustVolumeL
+// -----------------------------------------------------------------------------
+//
+void CVtUiVolumeControl::AdjustVolumeL( TVolume aVolume  )
+    {
+    __VTPRINTENTER( "VtUiVolCtrl.AdjustVolumeL")
+    if ( iIsActive )
+        {
+        __VTPRINTENTER( "VtUiVolCtrl.AdjustVolumeL.Isactive")
+        return;
+        }
+    iIsActive = ETrue;         
+    iVolume = aVolume;
+    iCommandHandler.ExecuteL( KVtEngSetAudioVolume, &iVolumePtr );
+    __VTPRINTEXIT( "VtUiVolCtrl.AdjustVolumeL")
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVolumeControl::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+void CVtUiVolumeControl::HandleVTCommandPerformedL(
+        TVtEngCommandId aCommand,
+        const TInt aError )
+    {
+    __VTPRINTENTER( "VtUiVolCtrl.HandleVTCommandPerformedL")
+    if ( aCommand == KVtEngSetAudioVolume )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUiVolCtrl.perf" )
+        TInt error = aError;
+        // If volume has been changed, then try to set volume again.
+        //iIsActive = ETrue;
+        if ( IsVolumeChangedL() )
+            {
+            __VTPRINT( DEBUG_GEN, "VtUiVolCtrl.retry" )
+            TRAP( error,
+               iCommandHandler.ExecuteL(
+                   KVtEngSetAudioVolume,
+                   &iVolumePtr ) );
+            __VTPRINT2( DEBUG_GEN, "VtUiVolCtrl.err.%d", error )
+            iIsActive = ( error == KErrNone );
+            }
+        else
+            {
+             __VTPRINT( DEBUG_GEN,
+              "VtUiVolCtrl.HandleVTCommandPerformedL iIsActive = EFalse; " )
+            iIsActive = EFalse; 
+            }            
+      
+        }
+    __VTPRINTEXIT( "VtUiVolCtrl.HandleVTCommandPerformedL")        
+    }
+
+// -----------------------------------------------------------------------------
+// CVtUiVolumeControl::IsVolumeChangedL
+// -----------------------------------------------------------------------------
+//
+TBool CVtUiVolumeControl::IsVolumeChangedL()
+    {
+    __VTPRINTENTER( "VtUiVolCtrl.IsVolumeChangedL" )
+    MVtEngAudio::TAudioRoutingState audioRouting;
+    User::LeaveIfError( iAudio.GetRoutingState( audioRouting ) );
+    const TInt volume( iAudio.OutputVolume(
+        !( audioRouting == MVtEngAudio::EAudioLoudspeaker ) ) );
+     
+    CVtUiVolume* vp = static_cast< CVtUiVolume* >(
+    iFeatureManager.GetFeatureById( EVtUiFeatureIdVolume ) );
+    TInt sliderVolume( volume );
+    if ( vp )
+        {
+        sliderVolume = vp->GetVolumeValue();
+        // update correct volume
+        if ( audioRouting == MVtEngAudio::EAudioLoudspeaker )
+            {
+            __VTPRINT( DEBUG_GEN, "VtUiVolCtrl.IsVolumeChangedL.LS")
+            iVolume.iHandsfreeVolume = sliderVolume;
+            }
+        else
+            {
+            __VTPRINT( DEBUG_GEN, "VtUiVolCtrl.IsVolumeChangedL.HS")
+            iVolume.iHandsetVolume = sliderVolume;
+            }
+        }
+        
+    __VTPRINT2( DEBUG_GEN, "VtUiVolCtrl.vol %d", volume )        
+    __VTPRINT2( DEBUG_GEN, "VtUiVolCtrl.slidvol %d", sliderVolume )
+    __VTPRINTEXITR( "VtUiVolCtrl.IsVolumeChangedL %d", sliderVolume == volume )    
+    return sliderVolume == volume ? EFalse : ETrue; 
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/volume/cvtuivolumepopup.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,277 @@
+/*
+* 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:  Volume popup implementation.
+*
+*/
+
+
+#include    <aknvolumepopup.h>
+#include    <cvtlogger.h>
+#include    "cvtuivolumepopup.h"
+#include    "cvtuifeaturemanager.h"
+#include	"tVtuifeaturevariation.h"
+#include    "CVtUiAppUi.h"
+#include    "cvtengmodel.h"
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiVolumePopup* CVtUiVolumePopup::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.NewL" )
+    CVtUiVolumePopup* self =
+        new ( ELeave ) CVtUiVolumePopup( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiVolumePopup.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::~CVtUiVolumePopup
+// ---------------------------------------------------------------------------
+//
+CVtUiVolumePopup::~CVtUiVolumePopup()
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.~" )
+    __VTPRINTEXIT( "CVtUiVolumePopup.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::UpdateVolumeAndRouting
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolumePopup::UpdateVolumeAndRoutingL()
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.UpdateVolumeAndRoutingL" )
+    MVtEngAudio& audio( iModel.Audio() );
+    MVtEngAudio::TAudioRoutingState audioRouting;
+    User::LeaveIfError( audio.GetRoutingState( audioRouting ) );
+    //update routing and volume for this routing
+    iAudioRouting = audioRouting;
+    iVolume = OutputVolume( iAudioRouting );
+    SetValue( iVolume );    
+    __VTPRINTEXIT( "CVtUiVolumePopup.UpdateVolumeAndRoutingL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::RefreshL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolumePopup::RefreshL()
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.RefreshL" )
+    MVtEngAudio& audio( iModel.Audio() );
+    MVtEngAudio::TAudioRoutingState audioRouting;
+    User::LeaveIfError( audio.GetRoutingState( audioRouting ) );
+
+    // Check if audio routing has changed
+    if ( audioRouting != iAudioRouting )
+        {
+        __VTPRINT( DEBUG_GEN,
+            "CVtUiVolumePopup.RefreshL audio routing changed" )
+        // Audio routing changed -> update routing and volume for this routing
+        iAudioRouting = audioRouting;
+        iVolume = OutputVolume( iAudioRouting );
+        SetValue( iVolume );
+        __VTPRINT2( DEBUG_GEN, "CVtUiVolumePopup.RefreshL routing = %d",
+            iAudioRouting )
+        __VTPRINT2( DEBUG_GEN, "CVtUiVolumePopup.RefreshL volume = %d",
+            iVolume )
+        ClosePopup();
+        }
+    else
+        {
+        // No change in audio routing
+        const TInt volume( OutputVolume( iAudioRouting ) );
+        if ( volume != iVolume )
+            {
+            __VTPRINT( DEBUG_GEN, "CVtUiVolumePopup.RefreshL volume changed" )
+            iVolume = volume;
+            SetValue( iVolume );
+            __VTPRINT2( DEBUG_GEN, "CVtUiVolumePopup.RefreshL volume = %d",
+                iVolume )
+            if ( !IsPopUpVisible() )
+                {
+                __VTPRINT( DEBUG_GEN, "CVtUiVolumePopup.RefreshL OpenPopupL" )
+                OpenPopupL();
+                }
+            else
+                {
+                __VTPRINT( DEBUG_GEN, "CVtUiVolumePopup.RefreshL ShowPopupL" )
+                ShowPopupL();
+                }
+            }
+        else
+            {
+            __VTPRINT( DEBUG_GEN, "CVtUiVolumePopup.RefreshL ShowPopupL2" )
+            ShowPopupL();
+            }
+        }
+    __VTPRINTEXIT( "CVtUiVolumePopup.RefreshL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::DoActivateL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolumePopup::DoActivateL()
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.DoActivateL" )
+    CVtUiPopupBase::DoActivateL();
+    // In order to refresh softkey.
+    iFeatureManager.AppUi().RefreshSoftkeysL();
+    __VTPRINTEXIT( "CVtUiVolumePopup.DoActivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::OfferKeyEventL()
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CVtUiVolumePopup::OfferKeyEventL( const TKeyEvent& aEvent,
+    TEventCode /*aCode*/ )
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.OfferKeyEventL" )
+    TKeyResponse response( EKeyWasNotConsumed );
+    TVtUiSideVolumeKeysVariation svkvariation;
+    if ( !svkvariation.IsSideVolumeKeysSupported() &&
+         ( aEvent.iScanCode == EStdKeyLeftArrow ||
+           aEvent.iScanCode == EStdKeyRightArrow ) )
+        {
+        ShowPopupL();
+        UpdateVolumeL();
+        }
+    __VTPRINTEXITR( "CVtUiVolumePopup.OfferKeyEventL %d", response )
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::HandleControlEventL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolumePopup::HandleControlEventL( CCoeControl* aControl,
+    TCoeEvent aEventType )
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.HandleControlEventL" )
+    CVtUiPopupBase::HandleControlEventL( aControl, aEventType );
+    if ( aEventType == EEventStateChanged )
+        {
+        UpdateVolumeL();
+        }
+    __VTPRINTEXIT( "CVtUiVolumePopup.HandleControlEventL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::CVtUiVolumePopup
+// ---------------------------------------------------------------------------
+//
+CVtUiVolumePopup::CVtUiVolumePopup( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiPopupBase( aFeatureManager.ComponentManager(),
+      TVtUiBlockListBitField(
+        MVtUiComponent::EComponentIdToolbar |
+        MVtUiComponent::EComponentIdNumberEntry |
+        MVtUiComponent::EComponentIdZoom |
+        MVtUiComponent::EVComponentIdContrast |
+        MVtUiComponent::EVComponentIdBrightness ),
+      EComponentIdVolume ),
+      iModel( aFeatureManager.AppUi().Model() ), 
+      iFeatureManager ( aFeatureManager ) 
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.CVtUiVolumePopup" )
+    __VTPRINTEXIT( "CVtUiVolumePopup.CVtUiVolumePopup" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolumePopup::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.ConstructL" )
+    BaseConstructL();
+    // set default value
+    MVtEngAudio& audio( iModel.Audio() );
+    MVtEngAudio::TAudioRoutingState audioRouting;
+    User::LeaveIfError( audio.GetRoutingState( audioRouting ) );
+    SetValue( OutputVolume( audioRouting ) );
+    // set default audiorouting
+    iAudioRouting = audioRouting;
+    __VTPRINTEXIT( "CVtUiVolumePopup.ConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::OutputVolume
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiVolumePopup::OutputVolume(
+    MVtEngAudio::TAudioRoutingState aRouting ) const
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.OutputVolume" )
+    const MVtEngAudio& audio( iModel.Audio() );
+    const TInt volume( audio.OutputVolume(
+        !( aRouting == MVtEngAudio::EAudioLoudspeaker ) ) );
+    __VTPRINTEXITR( "CVtUiVolumePopup.OutputVolume %d", volume )
+    return volume;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiVolumePopup::UpdateVolumeL
+// ---------------------------------------------------------------------------
+//
+void CVtUiVolumePopup::UpdateVolumeL()
+    {
+    __VTPRINTENTER( "CVtUiVolumePopup.UpdateVolumeL" )
+    
+    MVtEngAudio& audio( iModel.Audio() );
+    MVtEngAudio::TAudioRoutingState audioRouting;
+    User::LeaveIfError( audio.GetRoutingState( audioRouting ) );
+
+    const TInt volume( OutputVolume( iAudioRouting ) );
+    
+    __VTPRINT2( DEBUG_GEN, "CVtUiVolumePopup.UpdateVolumeL volume = %d",
+                volume )      
+    __VTPRINT2( DEBUG_GEN, "CVtUiVolumePopup.UpdateVolumeL Value() = %d",
+                Value() )                
+    if ( volume != Value() )
+        {
+        MVtEngAudio::TVtEngOutputVolume newVolume;
+        
+        // Get current audio values from engine
+        // and set new audio volume to right routing
+        if ( iAudioRouting == MVtEngAudio::EAudioLoudspeaker )
+            {
+            __VTPRINT( DEBUG_GEN, "CVtUiVolumePopup.UpdateVolumeL.LS")
+            // changed value
+            newVolume.iHandsfreeVolume = Value();
+            // old value
+            TInt volume = audio.OutputVolume( ETrue );
+            newVolume.iHandsetVolume = volume;
+            }
+        else
+            {
+            __VTPRINT( DEBUG_GEN, "CVtUiVolumePopup.UpdateVolumeL.HS")
+            // changed value
+            newVolume.iHandsetVolume = Value();
+            // old value
+            TInt volume = audio.OutputVolume( EFalse );
+            newVolume.iHandsfreeVolume = volume;
+            }
+            
+      iFeatureManager.AppUi().CmdUpdateVolumeL( newVolume );
+      }
+    __VTPRINTEXIT( "CVtUiVolumePopup.UpdateVolumeL" )    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/zoom/cvtuizoom.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,139 @@
+/*
+* 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:  Zoom feature implementation.
+*
+*/
+
+
+#include <cvtlogger.h>
+#include "cvtuizoom.h"
+#include "tvtuifeatureids.h"
+#include "cvtuizoompopup.h"
+#include "cvtuifeaturemanager.h"
+#include "tvtuistates.h"
+
+// ---------------------------------------------------------------------------
+// CVtUiZoom::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiZoom* CVtUiZoom::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiZoom.NewL" )
+    CVtUiZoom* self =
+        new ( ELeave ) CVtUiZoom( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiZoom.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoom::~CVtUiZoom
+// ---------------------------------------------------------------------------
+//
+CVtUiZoom::~CVtUiZoom()
+    {
+    __VTPRINTENTER( "CVtUiZoom.~" )
+    __VTPRINTEXIT( "CVtUiZoom.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoom::RefreshL
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoom::RefreshL()
+    {
+    __VTPRINTENTER( "CVtUiZoom.RefreshL" )
+    if ( State() == EActive )
+        {
+        static_cast< CVtUiZoomPopup& >( Popup() ).RefreshL();
+        }
+    __VTPRINTEXIT( "CVtUiZoom.RefreshL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoom::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoom::StartL()
+    {
+    __VTPRINTENTER( "CVtUiZoom.StartL" )
+    if ( State() == EActive )
+        {
+        // need to refresh when already active to replenish the close timer
+        RefreshL();
+        }
+    else
+        {
+        iFeatureManager.UiStates().SetIsFloatingToolbarVisible( ETrue );
+        CVtUiSliderBase::StartL();
+        iFeatureManager.UiStates().SetZoomModeOn( ETrue );
+        }
+    __VTPRINTEXIT( "CVtUiZoom.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoom::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoom::Stop()
+    {
+    __VTPRINTENTER( "CVtUiZoom.Stop" )
+    iFeatureManager.UiStates().SetZoomModeOn( EFalse );
+    CVtUiSliderBase::Stop();
+    __VTPRINTEXIT( "CVtUiZoom.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoom::ComponenStateChangedL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoom::ComponenStateChangedL()
+    {
+    __VTPRINTENTER( "CVtUiZoom.ComponenStateChangedL()" )
+    // Close event received stop the feature
+    // If this was a block event then do not stop the feature
+    // Currently we can't separate block and stop events from component manager
+    if ( !iFeatureManager.UiStates().IsCaptureModeOn() )
+        {
+       __VTPRINT( DEBUG_GEN, "CVtUiZoom.ComponenStateChangedL.Stop" )
+        Stop();
+        }
+    __VTPRINTEXIT( "CVtUiZoom.ComponenStateChangedL()" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoom::CVtUiZoom
+// ---------------------------------------------------------------------------
+//
+CVtUiZoom::CVtUiZoom( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiSliderBase( aFeatureManager, EVtUiFeatureIdZoom )
+    {
+    __VTPRINTENTER( "CVtUiZoom.CVtUiZoom" )
+    __VTPRINTEXIT( "CVtUiZoom.CVtUiZoom" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoom::CVtUiZoom
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoom::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiZoom.ConstructL" )
+    BaseConstructL();
+    SetPopup( CVtUiZoomPopup::NewL( iFeatureManager ) );
+    __VTPRINTEXIT( "CVtUiZoom.ConstructL" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/features/zoom/cvtuizoompopup.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,282 @@
+/*
+* 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:  Zoom popup implementation.
+*
+*/
+
+
+#include    <aknvolumepopup.h>
+#include    <cvtlogger.h>
+#include    "cvtuizoompopup.h"
+#include    "cvtuifeaturemanager.h"
+#include	"tVtuifeaturevariation.h"
+#include    "CVtUiAppUi.h"
+#include    "cvtengmodel.h"
+
+// Number of zoom steps
+static const TInt KZoomStepCount = 10;
+
+// Minimum zoom factor value
+static const TInt KMinZoomFactor = 0;
+
+// default time out time for zoom popup
+const TInt KDefaultZoomTimeOutTime = 5;  
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::NewL
+// ---------------------------------------------------------------------------
+//
+CVtUiZoomPopup* CVtUiZoomPopup::NewL( CVtUiFeatureManager&
+    aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.NewL" )
+    CVtUiZoomPopup* self =
+        new ( ELeave ) CVtUiZoomPopup( aFeatureManager );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    __VTPRINTEXIT( "CVtUiZoomPopup.NewL" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::~CVtUiZoomPopup
+// ---------------------------------------------------------------------------
+//
+CVtUiZoomPopup::~CVtUiZoomPopup()
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.~" )
+    __VTPRINTEXIT( "CVtUiZoomPopup.~" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::RefreshL
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoomPopup::RefreshL()
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.RefreshL" )
+    
+    UpdateAdjustRangeL();
+    
+    iCurrent = CurrentZoomStep();
+    if ( iCurrent < KMinZoomFactor )
+        {
+        User::Leave( KErrArgument );
+        }
+    SetValue( iCurrent );
+    ShowPopupL();
+    __VTPRINTEXIT( "CVtUiZoomPopup.RefreshL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::DoActivateL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoomPopup::DoActivateL()
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.DoActivateL" )
+    UpdateAdjustRangeL();
+    CVtUiPopupBase::DoActivateL();
+    // In order to refresh softkey.
+    iFeatureManager.AppUi().RefreshSoftkeysL();
+    __VTPRINTEXIT( "CVtUiZoomPopup.DoActivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::OfferKeyEventL()
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CVtUiZoomPopup::OfferKeyEventL( const TKeyEvent& aEvent,
+    TEventCode aCode )
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.OfferKeyEventL" )
+    TKeyResponse response( EKeyWasNotConsumed );
+    // Don't  handle other types here
+    if ( aCode != EEventKey )
+        {
+        return response;
+        }
+        
+    if ( aEvent.iScanCode == EStdKeyUpArrow ||
+         aEvent.iScanCode == EStdKeyDownArrow ||
+         aEvent.iCode == EKeyZoomIn ||
+         aEvent.iCode == EKeyZoomOut )
+        {
+        __VTPRINT( DEBUG_GEN, "CVtUiZoomPopup.OfferKeyEventL zoom key" )
+        TInt step( 1 );
+        if ( aEvent.iScanCode == EStdKeyDownArrow ||
+             aEvent.iCode == EKeyZoomOut )
+            {
+            step = -step;
+            }
+        const TInt current( Value() );
+        TInt value( current + step );
+        value = Max( KMinZoomFactor, Min( value, KZoomStepCount ) );
+        if ( value != current )
+            {
+            __VTPRINT2( DEBUG_GEN, "CVtUiZoomPopup.OfferKeyEventL zoom = %d",
+                value )
+            SetValue( value );
+            iFeatureManager.AppUi().SetZoomFactorL( ScaledValue() );
+            response = EKeyWasConsumed;
+            }
+        ShowPopupL();
+        }
+    __VTPRINTEXITR( "CVtUiZoomPopup.OfferKeyEventL %d", response )
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::HandleControlEventL
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoomPopup::HandleControlEventL( CCoeControl* aControl,
+    TCoeEvent aEventType )
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.HandleControlEventL" )
+    CVtUiPopupBase::HandleControlEventL( aControl, aEventType );
+    
+    if ( aEventType == EEventStateChanged )
+        {
+        __VTPRINT2( DEBUG_GEN, "CVtUiZoomPopup.HandleControlEventL zoom = %d", ScaledValue() )
+        
+        if ( CurrentZoomStep() != Value() )
+            {
+            iFeatureManager.AppUi().SetZoomFactorL( ScaledValue() );
+            }
+        }
+        
+    __VTPRINTEXIT( "CVtUiZoomPopup.HandleControlEventL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::CVtUiZoomPopup
+// ---------------------------------------------------------------------------
+//
+CVtUiZoomPopup::CVtUiZoomPopup( CVtUiFeatureManager& aFeatureManager )
+    : CVtUiPopupBase( aFeatureManager.ComponentManager(),
+      TVtUiBlockListBitField(
+        MVtUiComponent::EComponentIdDialer |
+        MVtUiComponent::EComponentIdToolbar |
+        MVtUiComponent::EComponentIdNumberEntry |
+        MVtUiComponent::EComponentIdVolume  |
+        MVtUiComponent::EVComponentIdBrightness |
+        MVtUiComponent::EVComponentIdContrast
+        ),
+      EComponentIdZoom ),
+      iFeatureManager( aFeatureManager ),
+      iMedia( aFeatureManager.AppUi().Model().Media() ),
+      iCurrent( KErrNotReady )
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.CVtUiZoomPopup" )
+    __VTPRINTEXIT( "CVtUiZoomPopup.CVtUiZoomPopup" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoomPopup::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.ConstructL" )
+    BaseConstructL();
+    // Set slider type to percentage
+    SetValueType( EAknSliderValuePercentage );
+    
+    // Set timeout
+    SetTimeOut( KDefaultZoomTimeOutTime );
+    __VTPRINTEXIT( "CVtUiZoomPopup.ConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::UpdateAdjustRangeL
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoomPopup::UpdateAdjustRangeL()
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.UpdateAdjustRangeL" )
+    // Get max zoom step from engine
+    iMax = MaxZoomStep();
+    // Set value range to visible slider control
+    // range 0-10 or 0-iMax if max < 0
+    // stepcount = 10 or iMax if max < 10
+    SetAdjustRange( KMinZoomFactor, Min( KZoomStepCount, iMax ), Min( KZoomStepCount, iMax ) );
+   
+    // Set value range to baseclass
+    // range on e.g. 0-20
+    SetMinAndMaxValues( KMinZoomFactor, iMax );    
+    
+    // Get current zoom step
+    iCurrent = CurrentZoomStep();    
+    
+    if ( iCurrent == KErrNotFound || iMax == KErrNotFound || iCurrent > iMax )
+        {
+        User::Leave( KErrNotFound );
+        }
+    // Set new value
+    SetValue( iCurrent );
+    __VTPRINTEXIT( "CVtUiZoomPopup.UpdateAdjustRangeL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::CurrentZoomStep
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiZoomPopup::CurrentZoomStep() const
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.CurrentZoomStep" )
+    TInt current( KMinZoomFactor );
+    const TInt error( iMedia.GetCurrentZoomStep( current ) );
+    current = ( error ? KErrNotFound : current );
+    
+    // Value asked from the engine must be scaled.
+    // If the current asked  value is 1 then the scaling formula in the 
+    // popupbase doesn't round the value to 1 there fore value is 
+    // initalized to 1.
+    TInt  val = 1; 
+    if ( current != 1 )
+        {
+        val =  SliderValueWithScaling( current );
+        }
+    __VTPRINTEXITR( "CVtUiZoomPopup.CurrentZoomStep %d", val )
+    return val;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::MaxZoomStep
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiZoomPopup::MaxZoomStep() const
+    {
+    __VTPRINTENTER( "CVtUiZoomPopup.MaxZoomStep" )
+    TInt max( KMinZoomFactor );
+    const TInt error( iMedia.GetMaxZoomStep( max ) );
+    max = ( error ? KErrNotFound : max );
+    __VTPRINTEXITR( "CVtUiZoomPopup.MaxZoomStep %d", max )
+    return max;
+    }
+    
+// ---------------------------------------------------------------------------
+// CVtUiZoomPopup::ScaleAndSetZoomFactorL
+// ---------------------------------------------------------------------------
+//
+void CVtUiZoomPopup::ScaleAndSetZoomFactorL( TInt aValue )
+    {
+       __VTPRINTENTER( "CVtUiZoomPopup.ScaleAndSetZoomFactorL" )
+    const TInt value = aValue * MaxZoomStep() / 10; // 10 vakioksi count + 1 ei yhtä
+    iFeatureManager.AppUi().SetZoomFactorL( value );  
+     __VTPRINTEXITR( "CVtUiZoomPopup.ScaleAndSetZoomFactorL %d", value )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/sliders/cvtuipopupbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,509 @@
+/*
+* 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:  Base class for video telephone popups
+*
+*/
+
+
+#include    <cvtlogger.h>
+#include    <aknutils.h>
+#include    <aknvolumepopup.h>
+#include    <fbs.h>
+
+#include    "cvtuipopupbase.h"
+#include    "mvtuicomponentmanager.h"
+#include    "mvtuicomponentstateobserver.h"
+#include    "VtUiPanic.h"
+#include    <layoutmetadata.cdl.h>
+#include    <videotelui.rsg>
+#include    <aknlayoutscalable_apps.cdl.h>
+
+// default time out time for popup
+const TInt KDefaultTimeOutTime = 2;  
+
+// max value for slider is 100 (100%)
+const TInt KMaxSliderValue = 100;  
+
+// Implementation of TVtUiBaseComponentState
+
+// ---------------------------------------------------------------------------
+// TVtUiBaseComponentState::TVtUiBaseComponentState
+// ---------------------------------------------------------------------------
+//
+TVtUiBaseComponentState::TVtUiBaseComponentState(
+    MVtUiComponent& aComponent, TVtUiBlockListBitField aBitField  ) :
+    TVtUiComponentState( aComponent, aBitField )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::~CVtUiPopupBase
+// ---------------------------------------------------------------------------
+//
+CVtUiPopupBase::~CVtUiPopupBase()
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.~CVtUiPopupBase" )
+    if ( iPopup )
+        {
+        iPopup->CloseVolumePopup();
+        }
+     // unregister component change registration
+    iComponentManager.ChangeComponentRegistration(
+        iComponentState, MVtUiComponentManager::EUnregister );
+    delete iPopup;
+    __VTPRINTEXIT( "CVtUiPopupBase.~CVtUiPopupBase" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::ComponentId
+// ---------------------------------------------------------------------------
+//
+ MVtUiComponent::TComponentId CVtUiPopupBase::ComponentId() const
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.ComponentId" )
+    __VTPRINTEXIT( "CVtUiPopupBase.ComponentId" )
+    return iComponentId;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::ComponentAsControl
+// ---------------------------------------------------------------------------
+//
+ CCoeControl* CVtUiPopupBase::ComponentAsControl()
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.ComponentAsControl" )
+    __VTPRINTEXIT( "CVtUiPopupBase.ComponentAsControl" )
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::DoActivateL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::DoActivateL()
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.DoActivateL" )
+    User::LeaveIfError(
+       iComponentManager.ChangeResourceChangeRegistration(
+        *this, MVtUiComponentManager::ERegister ) );
+
+    User::LeaveIfError( iComponentManager.ChangeKeyEventRegistration(
+        *this, MVtUiComponentManager::ERegister ) );
+
+    ShowPopupL();
+    __VTPRINTEXIT( "CVtUiPopupBase.DoActivateL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::DoDeactivateL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::DoDeactivateL()
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.DoDeactivateL()" )
+    iPopup->CloseVolumePopup();
+    //notify observer that popup has been closed
+    if ( iCompStateObserver )
+        {
+        iCompStateObserver->ComponenStateChangedL();
+        }
+    // unregister resource change registration
+    iComponentManager.ChangeResourceChangeRegistration(
+        *this, MVtUiComponentManager::EUnregister );
+
+    iComponentManager.ChangeKeyEventRegistration(
+        *this, MVtUiComponentManager::EUnregister );
+    __VTPRINTEXIT( "CVtUiPopupBase.DoDeactivateL()" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::HandleResourceChangeL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::HandleResourceChangeL( TInt aType )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.HandleResourceChangeL()" )
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        iPopup->SetPosition( PopupPosition() );
+        }
+    __VTPRINTEXIT( "CVtUiPopupBase.HandleResourceChangeL()" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::HandleControlEventL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::HandleControlEventL( CCoeControl* /*aControl*/,
+    TCoeEvent aEventType )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.HandleControlEventL" )
+    if ( aEventType == EEventStateChanged )
+        {
+        // popup closed
+        if( !IsPopUpVisible() )
+            {
+            ClosePopup();
+            }
+        }
+    __VTPRINTEXIT( "CVtUiPopupBase.HandleControlEventL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::OfferKeyEventL()
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CVtUiPopupBase::OfferKeyEventL( const TKeyEvent& aEvent,
+    TEventCode aCode )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.OfferKeyEventL" )
+    TKeyResponse response( EKeyWasNotConsumed );
+    // Don't  handle other types here
+    if ( aCode != EEventKey )
+        {
+        return response;
+        }
+
+    if ( aEvent.iScanCode == EStdKeyUpArrow ||
+            aEvent.iScanCode == EStdKeyDownArrow )
+        {
+        __VTPRINT( DEBUG_GEN, "CVtUiPopupBase.OfferKeyEventL" )
+        TInt step( 1 );
+        if ( aEvent.iScanCode == EStdKeyDownArrow )
+            {
+            step = -step;
+            }
+        
+        const TInt current( Value() );
+        TInt value( current + step );
+        
+        TInt maxValue;
+        TInt minValue;
+        iPopup->GetRange( minValue, maxValue );
+        
+        __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.OfferKeyEventL iPopup minValue = %d",
+                minValue )
+        __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.OfferKeyEventL iPopup maxValue = %d",
+                maxValue )
+         
+        minValue = minValue / iScalingConstant;
+        value = Max( minValue, Min( value, iStepCount ) );
+        if ( value != current )
+            {
+            __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.OfferKeyEventL Volume value = %d",
+                    value )
+            SetValue( value );
+            response = EKeyWasConsumed;
+            }
+        ShowPopupL();
+        }
+    __VTPRINTEXITR( "CVtUiPopupBase.OfferKeyEventL %d", response )
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::SetObserver()
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::SetObserver( MVtUiComponentStateObserver& aCompStateObserver )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.SetObserver()" )
+    iCompStateObserver = &aCompStateObserver;
+    __VTPRINTEXIT( "CVtUiPopupBase.SetObserver()" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::SetValueType()
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::SetValueType( TInt aValueType )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.SetValueType" )
+    iPopup->SetValueType( aValueType );
+    __VTPRINTEXIT( "CVtUiPopupBase.SetValueType" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::SetPermanenVisibility()
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::SetPermanenVisibility( TBool aPermanent )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.SetPermanenVisibility" )
+    __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase = %d", aPermanent  );
+    const TInt longPeriod( 86400 ); // 24 h
+    if ( aPermanent ) 
+        {
+        iPopup->SetTimeOutAsSecond( longPeriod );
+        iPopup->ClosePopupWhenTappedOutside( !aPermanent );
+        }
+     else
+        {
+        iPopup->ClosePopupWhenTappedOutside( !aPermanent );
+        iPopup->SetTimeOutAsSecond( iTimeOutTime );
+        }
+     __VTPRINTEXIT( "CVtUiPopupBase.SetPermanenVisibility" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::CVtUiPopupBase
+// ---------------------------------------------------------------------------
+//
+CVtUiPopupBase::CVtUiPopupBase(  MVtUiComponentManager& aComponentManager,
+  TVtUiBlockListBitField aBitField, TComponentId aComponentId ) :
+  iComponentManager ( aComponentManager ), iComponentState( *this, aBitField ),
+  iComponentId( aComponentId ), iScalingConstant( 1 )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.CVtUiPopupBase" )
+    __VTPRINTEXIT( "CVtUiPopupBase.CVtUiPopupBase" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::BaseConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::BaseConstructL()
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.BaseConstructL" )
+    iPopup = CAknVolumePopup::NewL( NULL, ETrue );
+    iPopup->SetObserver( this );
+
+    // Initialized to 2 seconds
+    iTimeOutTime = KDefaultTimeOutTime;
+    
+    // set position
+    iPopup->SetPosition( PopupPosition() );
+   
+    User::LeaveIfError(
+        iComponentManager.ChangeComponentRegistration(
+        iComponentState, MVtUiComponentManager::ERegister ) );
+    __VTPRINTEXIT( "CVtUiPopupBase.BaseConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::ShowPopupL
+// ---------------------------------------------------------------------------
+//
+void  CVtUiPopupBase::ShowPopupL()
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.ShowPopupL" )
+    iPopup->ShowVolumePopupL();
+    __VTPRINTEXIT( "CVtUiPopupBase.ShowPopupL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::OpenPopupL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::OpenPopupL()
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.OpenPopupL" )
+    TRAPD( error,
+        iComponentManager.RequestActivationL( ComponentId() ) );
+    __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.OpenPopupL reqAct=%d", error );
+    User::LeaveIfError( error );
+    __VTPRINTEXIT( "CVtUiPopupBase.OpenPopupL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::ClosePopup
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::ClosePopup()
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.ClosePopup" )
+    TInt error( KErrNone );
+    TRAP( error, iComponentManager.DeActivateComponentL( ComponentId() ) );
+    __VTPRINTEXITR( "CVtUiPopupBase.ClosePopup %d", error )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::SetTimeOut
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::SetTimeOut( TInt aTime )
+    {
+    iTimeOutTime = aTime;
+    iPopup->SetTimeOutAsSecond( aTime );
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::IsPopUpVisible
+// ---------------------------------------------------------------------------
+//
+TBool CVtUiPopupBase::IsPopUpVisible()
+    {
+    return iPopup->IsVisible();
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::PopupPosition
+// ---------------------------------------------------------------------------
+//
+TPoint CVtUiPopupBase::PopupPosition() const
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.PopupPosition" )
+    TRect mainPaneRect;
+    TAknWindowLineLayout popupLineLayout;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        popupLineLayout =
+            AknLayoutScalable_Apps::aid_placing_vt_slider_lsc().LayoutLine();
+        }
+    else
+        {
+        popupLineLayout = 
+            AknLayoutScalable_Apps::aid_placing_vt_slider_prt().LayoutLine();
+        }
+    
+    TAknLayoutRect layoutRect;
+    layoutRect.LayoutRect( mainPaneRect, popupLineLayout );
+    __VTPRINTEXIT( "CVtUiPopupBase.PopupPosition" )
+    return layoutRect.Rect().iTl;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::SetPopupValue
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::SetPopupValue( TInt aValue )
+    {
+    iPopup->SetValue( aValue * iScalingConstant );
+    }
+       
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::SetAdjustRange
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::SetAdjustRange( TInt aMinValue, TInt aMaxValue,
+    TInt aStepCount )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.SetAdjustRange" )
+    __ASSERT_ALWAYS( aMinValue <= aMaxValue &&
+        ( aMaxValue - aMinValue ) >= aStepCount &&
+        aStepCount > 0, VtUiPanic::Panic( EVtUiPanicOutOfRange ) );
+    
+    // store stepcount
+    iStepCount = aStepCount;
+    
+    // Aknvolumepopup does not do any scaling i.e max value
+    // must be 100 or otherwise the per cent value is not shown right.
+    // Scaling constant is used to multiple max value to be 100.
+    iScalingConstant = KMaxSliderValue / aMaxValue;
+    iPopup->SetRange( aMinValue, KMaxSliderValue );
+    TInt stepSize = KMaxSliderValue / aStepCount;
+    iPopup->SetStepSize( stepSize );
+    __VTPRINTEXIT( "CVtUiPopupBase.SetAdjustRange" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::SetValue
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::SetValue( TInt aValue )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.SetValue" )
+    SetPopupValue( aValue ); 
+    __VTPRINTEXITR( "CVtUiPopupBase.SetValue %d", Value() )
+    }
+ 
+ // ---------------------------------------------------------------------------
+// CVtUiPopupBase::ScaleAndSetValue
+// ---------------------------------------------------------------------------
+//
+ void CVtUiPopupBase::ScaleAndSetValue( TInt aValue )
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.ScaleAndSetValue" )
+    SetPopupValue( SliderValueWithScaling( aValue ) );
+    __VTPRINTEXITR( "CVtUiPopupBase.ScaleAndSetValue %d", Value() )
+    }
+ 
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::ScaledValue
+// ---------------------------------------------------------------------------
+//
+ TInt CVtUiPopupBase::ScaledValue() const
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.ScaledValue" )
+     TInt value = Value() * ( iMax-iMin ) / iStepCount + iMin;
+    __VTPRINTEXITR( "CVtUiPopupBase.ScaledValue %d", value )    
+    return value;
+    }
+    
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::SliderValueWithScaling
+// ---------------------------------------------------------------------------
+//
+ TInt CVtUiPopupBase::SliderValueWithScaling( TInt aValue) const
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.SliderValueWithScaling" )
+    __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.aValue=%d", aValue )
+    __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.iStepCount=%d", iStepCount )
+    __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.iMax=%d", iMax )
+    
+    if ( iMax == aValue)
+        {
+        return iStepCount;
+        }
+    else if ( iMin == aValue )
+        {
+        return 0;
+        }
+    TInt modValue = iStepCount * ( aValue - iMin) % ( iMax - iMin );        
+    TInt value = iStepCount * ( aValue - iMin) / ( iMax - iMin ); 
+           
+    if ( modValue >  ( iMax - iMin ) / 2 )
+        {
+        value++;
+        }
+    
+    __VTPRINTEXITR( "CVtUiPopupBase.SliderValueWithScaling %d", value )    
+    return value;
+    }
+    
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::SetMinAndMaxValues
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::SetMinAndMaxValues( TInt aMin, TInt aMax )
+    {
+     __VTPRINTENTER( "CVtUiPopupBase.SetMaxAndMinValues" )
+     __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase..aMax=%d", aMax )
+     __VTPRINT2( DEBUG_GEN, "CVtUiPopupBase..aMinV=%d", aMin )
+    iMax = aMax;
+    iMin = aMin;
+    __VTPRINTEXIT( "CVtUiPopupBase.SetMaxAndMinValues " ) 
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::Value
+// ---------------------------------------------------------------------------
+//
+TInt CVtUiPopupBase::Value() const
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.Value" )
+    __VTPRINTEXITR( "CVtUiPopupBase.Value %d", iPopup->Value() )
+    return iPopup->Value() / iScalingConstant;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiPopupBase::UpdatePopupL
+// ---------------------------------------------------------------------------
+//
+void CVtUiPopupBase::UpdatePopupL()
+    {
+    __VTPRINTENTER( "CVtUiPopupBase.UpdatePopupL" )
+    __VTPRINTEXIT( "CVtUiPopupBase.UpdatePopupL " ) 
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/sliders/cvtuisliderbase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* 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:  Base class implementation for video telephone sliders
+*
+*/
+
+
+#include    <cvtlogger.h>
+
+#include    "cvtuisliderbase.h"
+#include    "cvtuipopupbase.h"
+#include    "cvtuifeaturemanager.h"
+#include    "mvtuicomponentmanager.h"
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::~CVtUiSliderBase
+// ---------------------------------------------------------------------------
+//
+CVtUiSliderBase::~CVtUiSliderBase()
+    {
+    __VTPRINTENTER( "CVtUiSliderBase.~CVtUiSliderBase" )
+    delete iPopup;
+    __VTPRINTEXIT( "CVtUiSliderBase.~CVtUiSliderBase" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::UpdateSlider
+// ---------------------------------------------------------------------------
+//
+void CVtUiSliderBase::UpdateSlider()
+    {
+    __VTPRINTENTER( "CVtUiSliderBase.UpdateSlider" )
+    
+    iPopup->UpdatePopupL();
+    
+    __VTPRINTEXIT( "CVtUiSliderBase.UpdateSlider" )
+    }
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::StartL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSliderBase::StartL()
+    {
+    __VTPRINTENTER( "CVtUiSliderBase.StartL" )
+    if ( iFeatureState  == MVtUiFeature::EReady )
+        {
+        iFeatureManager.ComponentManager().
+            RequestActivationL( iPopup->ComponentId() );
+        // set state
+        iFeatureState = MVtUiFeature::EActive;
+        }
+    __VTPRINTEXIT( "CVtUiSliderBase.StartL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::Stop
+// ---------------------------------------------------------------------------
+//
+void CVtUiSliderBase::Stop()
+    {
+    __VTPRINTENTER( "CVtUiSliderBase.Stop" )
+    TRAP_IGNORE(
+        {
+        if ( iFeatureState == MVtUiFeature::EActive )
+            {
+            // set state
+            iFeatureState = MVtUiFeature::EReady;
+            iFeatureManager.ComponentManager().
+                DeActivateComponentL( iPopup->ComponentId()  );
+            }
+        } );
+    __VTPRINTEXIT( "CVtUiSliderBase.Stop" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::InitFeatureL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSliderBase::InitFeatureL()
+    {
+    __VTPRINTENTER( "CVtUiSliderBase.InitFeatureL" )
+    iFeatureState = EReady;
+    __VTPRINTEXIT( "CVtUiSliderBase.InitFeatureL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::ComponenStateChangedL()
+// ---------------------------------------------------------------------------
+//
+void CVtUiSliderBase::ComponenStateChangedL()
+    {
+    __VTPRINTENTER( "CVtUiSliderBase.ComponenStateChangedL()" )
+    // Close event received stop the feature
+    Stop();
+    __VTPRINTEXIT( "CVtUiSliderBase.ComponenStateChangedL()" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::SetPermanenVisibility()
+// ---------------------------------------------------------------------------
+//
+void CVtUiSliderBase::SetPermanenVisibility( TBool aPermanent )
+    {
+    if ( iPopup )
+        {
+        iPopup->SetPermanenVisibility( aPermanent );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::CVtUiSliderBase
+// ---------------------------------------------------------------------------
+//
+CVtUiSliderBase::CVtUiSliderBase( CVtUiFeatureManager& aFeatureManager,
+        TVtUiFeatureId aFeatureId  ) : CVtUiFeatureBase(
+    aFeatureId, aFeatureManager )
+    {
+    __VTPRINTENTER( "CVtUiSliderBase.CVtUiSliderBase" )
+    __VTPRINTEXIT( "CVtUiSliderBase.CVtUiSliderBase" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVtUiSliderBase::ConstructL()
+    {
+    __VTPRINTENTER( "CVtUiSliderBase.ConstructL" )
+    BaseConstructL();
+    __VTPRINTEXIT( "CVtUiSliderBase.ConstructL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::SetPopup
+// ---------------------------------------------------------------------------
+//
+void CVtUiSliderBase::SetPopup( CVtUiPopupBase* aPopup )
+    {
+    __VTPRINTENTER( "CVtUiSliderBase.SetPopup" )
+    iPopup = aPopup;
+    if ( iPopup )
+        {
+        iPopup->SetObserver( *this );
+        }
+    __VTPRINTEXIT( "CVtUiSliderBase.SetPopup" )
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::SetPopup
+// ---------------------------------------------------------------------------
+//
+CVtUiPopupBase& CVtUiSliderBase::Popup()
+    {
+    return *iPopup;
+    }
+
+// ---------------------------------------------------------------------------
+// CVtUiSliderBase::SetPopup
+// ---------------------------------------------------------------------------
+//
+const CVtUiPopupBase& CVtUiSliderBase::Popup() const
+    {
+    return *iPopup;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/tvtuiappstatebase.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,399 @@
+/*
+* Copyright (c) 2007 - 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:  base class for application states
+*
+*/
+
+
+#include "tvtuiappstates.h"
+#include "videotelui.hrh"
+#include "tvtuistates.h"
+#include "cvtuiappshutter.h"
+#include "mvtuistatecontext.h"
+#include <videotelui.rsg>
+#include <aknquerydialog.h>
+#include <stringloader.h>
+#include <cvtlogger.h>
+#include <cvtengmodel.h>
+#include <vtengevents.h>
+#include <mvtengcommandhandler.h>
+#include <coreapplicationuisdomainpskeys.h>
+
+// By default call ending command is allowed to send to call handling.
+
+// Initially no shutdown request
+TBool TVtUiAppStateBase::iShutdownRequested = EFalse;
+
+// -----------------------------------------------------------------------------
+// c++ constructor
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TVtUiAppStateBase(
+    MVtUiStateContext& aCtx,
+    TVtUiStates& aUiStates ) : iCtx(aCtx), iUiStates( aUiStates )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::~TVtUiAppStateBase()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::AppUiStartupPhase1DoneL
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::AppUiStartupPhase1DoneL()
+    {
+    // no default behavior
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::AppUiStartupPhase2DoneL
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::AppUiStartupPhase2DoneL()
+    {
+    // no default behavior
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::ShutdownDoneL
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::ShutdownDoneL()
+    {
+    // no default behavior
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::HandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiAppStateBase::HandleForegroundChangedL(
+    const TBool /*aIsForegroung*/ )
+    {
+    // no default behavior
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::PreHandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiAppStateBase::PreHandleForegroundChangedL(
+    const TBool /*aIsForegroung*/ )
+    {
+    // no default behavior
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::StartDtmfTone
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::StartDtmfTone( const TChar& /*aTone*/ )
+    {
+    // no default behavior
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::StopDtmfTone
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::StopDtmfTone()
+    {
+    // no default behavior
+    }
+
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::SetInitialStateL
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::SetInitialStateL(
+    MVtUiStateContext& aCtx,
+    TVtUiStates& aUiStates )
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.SetInitialState" )
+    TVtUiAppStateBase* initialState =
+        TVtUiStateStarting::InstanceL( aCtx, aUiStates );
+    aCtx.ChangeState( initialState );
+    initialState->OpenL();
+    __VTPRINTEXIT( "TVtUiAppStateBase.SetInitialState" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::AppUiStartupFailedL
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::AppUiStartupFailedL()
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.AppUiStartupFailedL" )
+    // Shutdown
+    ChangeStateL( *TVtUiStateResetting::InstanceL( iCtx, iUiStates ) );
+    __VTPRINTEXIT( "TVtUiAppStateBase.AppUiStartupFailedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::OpenL
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::OpenL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::Close
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::Close()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::ChangeStateL
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::ChangeStateL( TVtUiAppStateBase& aNewState )
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.ChangeStateL" )
+
+    // Check for transition to already active state.
+    TVtUiAppStateBase* state = &aNewState;
+    if ( state == this )
+        {
+        __VTPRINTEXITR( "TVtUiAppStateBase.ChangeStateL %d", 0 )
+        return;
+        }
+    const TVtEngCommandId pending =
+        iCtx.Model().CommandHandler().PendingCommand();
+    if ( pending !=  KVtEngCommandNone &&
+         state == TVtUiStateResetting::InstanceL( iCtx, iUiStates ) )
+        {
+        // delay shutdown until engine command completes
+        __VTPRINT2( DEBUG_GEN, "TVtUiAppStateBase.ChangeStateL, pengind command is: %d", pending );
+        TVtUiAppStateBase::iShutdownRequested = ETrue;
+
+        if ( pending == KVtEngInitializeShareImage )
+            {
+            iCtx.Model().CommandHandler().CancelCommand( pending );
+            }
+
+        __VTPRINTEXITR( "TVtUiAppStateBase.ChangeStateL %d", KErrNotReady )
+        return;
+        }
+    __VTPRINT( DEBUG_GEN,
+        " TVtUiAppStateBase.ChangeStateL !! STATE TRANSITION !!" )
+    iCtx.ChangeState( &aNewState );
+    Close();
+    // perform entry action for new state
+    aNewState.OpenL();
+    __VTPRINTEXITR( "TVtUiAppStateBase.ChangeStateL %d", 1 )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::CleanupResetPushL
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::CleanupResetPushL()
+    {
+    // Shutdown if leave occurs in critical ops.
+    CleanupStack::PushL(
+        TCleanupItem( TransitionToReset, this ) );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::TransitionToReset
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::TransitionToReset( TAny* aAny )
+    {
+    TVtUiAppStateBase* state = reinterpret_cast< TVtUiAppStateBase* >( aAny );
+    TRAP_IGNORE( state->ChangeStateL( *TVtUiStateResetting::InstanceL(
+        state->iCtx, state->iUiStates ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiAppStateBase::HandleVTCommandPerformedL(
+            TVtEngCommandId /*aCommand*/,
+            const TInt /*aError*/ )
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.HandleVTCommandPerformedL" )
+    // By default all UI is allowed to handle all command completions.
+    TEventResponse handled = EEventNotHandled;
+
+    // check if shutdown requested while command was pending
+    const TVtEngCommandId pending = iCtx.Model().CommandHandler().PendingCommand();
+    if ( pending == KVtEngCommandNone &&
+          TVtUiAppStateBase::iShutdownRequested )
+        {
+        __VTPRINT( DEBUG_GEN, "Handling delayed shutdown" );
+        ChangeStateL( *TVtUiStateResetting::InstanceL(
+            iCtx, iUiStates ) );
+        }
+    __VTPRINTEXIT( "TVtUiAppStateBase.HandleVTCommandPerformedL" )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::HandleVtEventL
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiAppStateBase::HandleVtEventL(
+    const TInt aEvent )
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.HandleVtEventL" )
+    TEventResponse handled = EEventHandled;
+    switch ( aEvent )
+        {
+    case KVtEngDeviceLockOn:
+    case KVtEngDeviceLockOff:
+        HandleDeviceLockEventL( aEvent == KVtEngDeviceLockOn );
+        break;
+    case KVtEngRemoteDisconnect:
+        /** Don't allow sending of end active call command to call handling
+         *  because requesting disconnect from the network after NW originated
+         *  termination violates standards.
+         */
+        break;
+    default:
+        handled = EEventNotHandled;
+        break;
+        }
+    __VTPRINTEXIT( "TVtUiAppStateBase.HandleVtEventL" )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::HandleCommandL
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiAppStateBase::HandleCommandL(
+    const TInt /*aCommand*/ )
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.HandleCommandL" )
+    TEventResponse handled = EEventNotHandled;
+    __VTPRINTEXITR( "TVtUiAppStateBase.HandleCommandL %d", handled )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::HandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::HandleLayoutChangedL( )
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.HandleLayoutChangedL" )
+    // By default only indicate that layout change needs to be handled.
+    iUiStates.SetLayoutChangeNeeded( ETrue );
+    __VTPRINTEXIT( "TVtUiAppStateBase.HandleLayoutChangedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::HandleShutdownReady
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::HandleShutdownReady()
+    {
+     __VTPRINTENTER( "TVtUiAppStateBase.HandleShutdownReady" )
+    // forwarded to AppUi which handles UI framework exit
+    iCtx.HandleShutdownReady();
+    iCtx.ChangeState( NULL );
+    // deletes current state
+    Close();
+     __VTPRINTEXIT( "TVtUiAppStateBase.HandleShutdownReady" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::HandleDeviceLockEventL
+//
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::HandleDeviceLockEventL( const TBool aDeviceIsLocked )
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.HandleDeviceLockEventL" )
+    iUiStates.SetDeviceLockOn( aDeviceIsLocked );
+    if ( aDeviceIsLocked )
+        {
+        iCtx.ChangeApplicationFocus( EFalse );
+        }
+    __VTPRINTEXITR( "TVtUiAppStateBase.HandleDeviceLockEventL lock state=%d",
+        aDeviceIsLocked )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::CheckEndActiveCallL
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiAppStateBase::CheckEndActiveCallL()
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.CheckEndActiveCallL" )
+    const MVtEngSessionInfo::TSessionState state = SessionState( EFalse );
+    TBool shutdownStarted( EFalse );
+    if ( state == MVtEngSessionInfo::EIdle )
+        {
+        __VTPRINT( DEBUG_GEN, "VtUi.Release bearer" )
+        // h.245 session is ended
+        ChangeStateL( *TVtUiStateResetting::InstanceL( iCtx, iUiStates ) );        
+        shutdownStarted = ETrue;
+        }
+    __VTPRINTEXITR( "TVtUiAppStateBase.CheckEndActiveCallL %d",
+        shutdownStarted )
+    return shutdownStarted;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::SessionState
+// -----------------------------------------------------------------------------
+//
+MVtEngSessionInfo::TSessionState TVtUiAppStateBase::SessionState(
+    const TBool aUpdate ) const
+    {
+    const CVtEngModel& model = iCtx.Model();
+    const MVtEngSessionInfo& session = model.Session();
+    return session.State( aUpdate );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::SetLightsState
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::SetLightsState( const TBool aOn )
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.SetLightsState" )
+    const TInt value = aOn ? EForcedLightsOn : EForcedLightsOff;
+    RProperty::Set(
+            KPSUidCoreApplicationUIs,
+            KLightsVTForcedLightsOn,
+            value );
+    __VTPRINTEXIT( "TVtUiAppStateBase.SetLightsState" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiAppStateBase::SetExecState
+// -----------------------------------------------------------------------------
+//
+void TVtUiAppStateBase::SetExecState( const TVtUiStates::TVtUiExecState aState )
+    {
+    __VTPRINTENTER( "TVtUiAppStateBase.SetExecState" )
+    iUiStates.SetExecState( aState );
+    __VTPRINTEXITR( "TVtUiAppStateBase.SetExecState %d", aState )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/tvtuistateresetting.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,243 @@
+/*
+* 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:  waiting details application state
+*
+*/
+
+
+#include "tvtuistates.h"
+#include "tvtuiappstates.h"
+#include "mvtuistatecontext.h"
+#include "cvtuiappshutter.h"
+#include <cvtlogger.h>
+#include <vtengevents.h>
+
+TVtUiStateResetting* TVtUiStateResetting::iInstance = NULL;
+
+// c++ constructor
+TVtUiStateResetting::TVtUiStateResetting( 
+    MVtUiStateContext& aCtx, 
+    TVtUiStates& aUiStates, 
+    const TVtEngCommandId aCommand )
+    : TVtUiAppStateBase( aCtx, aUiStates ), 
+      iCommand( aCommand )
+    {
+    	__VTPRINT2( DEBUG_GEN, "TVtUiStateResetting.ctr iCommand=%d", iCommand )
+    }
+
+// Destructor
+TVtUiStateResetting::~TVtUiStateResetting()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::
+// -----------------------------------------------------------------------------
+//
+TVtUiStateResetting* TVtUiStateResetting::InstanceL( 
+    MVtUiStateContext& aCtx, 
+    TVtUiStates& aUiStates,
+    const TVtEngCommandId aCommand )
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.InstanceL" )
+    if ( iInstance == NULL )
+        {
+        iInstance = new ( ELeave ) TVtUiStateResetting( 
+            aCtx, aUiStates, aCommand );
+        }
+    else if ( aCommand != KVtEngCommandNone )
+        { // if call ending is UI originated, command is given
+        iInstance->iCommand  = aCommand;
+        __VTPRINT2( DEBUG_GEN, "TVtUiStateResetting.InstanceL iCommand=%d", 
+            iInstance->iCommand )
+        }
+    __VTPRINTEXIT( "TVtUiStateResetting.InstanceL" )
+    return iInstance;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::ShutdownDoneL
+// AppUi has finished its own shutdown steps. Notify app shutter that it may 
+// proceed.
+// 
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateResetting::ShutdownDoneL()
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.ShutdownDone" )
+    CVtUiAppShutter* shutter = CVtUiAppShutter::InstanceL( *this );
+    if ( shutter )
+        {
+        shutter->StartShutdown();
+        }
+    __VTPRINTEXIT( "TVtUiStateResetting.ShutdownDone" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::AppUiStartupFailedL
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateResetting::AppUiStartupFailedL()
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.AppUiStartupFailedL" )
+    // no-op (overrides default behavior)
+    __VTPRINTEXIT( "TVtUiStateResetting.AppUiStartupFailedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::HandleVTCommandPerformedL
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiStateResetting::HandleVTCommandPerformedL
+    ( 
+    TVtEngCommandId aCommand,
+    const TInt /*aError*/ )
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.HandleVTCommandPerformedL" )
+    // By default responses to commands are ignored while resetting
+    TEventResponse handled = EEventHandled;
+    switch ( aCommand )
+        {
+        case KVtEngResetEngine:
+            // Allow UI to process reset command response        
+            handled = EEventNotHandled;
+            break;
+        case KVtEngTerminateSession:
+        case KVtEngSwitchToVoice:
+            // 
+            iCtx.ShutdownL();
+            break;
+        default:
+            break;            
+        }
+    __VTPRINTEXIT( "TVtUiStateResetting.HandleVTCommandPerformedL" )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::HandleVtEventL
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiStateResetting::HandleVtEventL(
+    const TInt aEvent )
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.HandleVtEventL" )
+    TEventResponse handled = EEventHandled;
+    switch ( aEvent )
+        {
+    // While resetting appUi should not handle these events.
+    case KVtEngSourceChanged:
+    case KVtEngCameraChanged:
+    case KVtEngSourceCapsChanged:
+    case KVtEngSessionStateChanged:
+    case KVtEngDurationSettingChanged:
+    case KVtEngAudioOutputVolumeChanged:
+    case KVtEngAudioRoutingAvailabilityChanged:
+    case KVtEngAudioRoutingChanged:
+    case KVtEngAudioMuted:
+    case KVtEngAudioUnmuted:
+    case KVtEngRemoteVideoStopped:
+    case KVtEngSessionWaitingCallActive:
+    case KVtEngSessionWaitingCallInactive:
+        break;
+    default:
+        // allow appUi to handle other events
+        handled = EEventNotHandled;
+        break;
+        }
+    __VTPRINTEXIT( "TVtUiStateResetting.HandleVtEventL" )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::HandleCommandL
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiStateResetting::HandleCommandL(
+    const TInt /*aCommand*/ )
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.HandleCommandL" )
+    /* All commands ignored while resetting. CAknAppUi::Exit() is called
+       when shutdown is completed with asistance of CVtUiAppShutter */
+    __VTPRINTEXIT( "TVtUiStateResetting.HandleCommandL" )
+     return EEventHandled;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::HandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStateResetting::HandleForegroundChangedL(
+    const TBool /*aIsForeground*/ )
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.HandleForegroundChangedL" )
+    __VTPRINTEXIT( "TVtUiStateResetting.HandleForegroundChangedL" )
+    // not on "foreground" while resetting
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::HandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateResetting::HandleLayoutChangedL()
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.HandleLayoutChangedL" )
+    // no-op (overrides default behavior)
+    __VTPRINTEXIT( "TVtUiStateResetting.HandleLayoutChangedL" )
+    }
+        
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::OpenL
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateResetting::OpenL()
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.OpenL" )
+    SetExecState( TVtUiStates::EExecStateResetting );
+    iCtx.StopDtmfTone();
+    iCtx.ChangeApplicationFocus( EFalse );
+    
+    if ( iCommand != KVtEngCommandNone )
+        {        
+        // Command is either KVtEngTerminateSession or KVtEngSwitchToVoice
+        // Need to wait for callback before ShutdownL can be called on context.
+        iCtx.DoExecuteCmdL( iCommand, NULL );
+        }
+    else
+        {
+        // This branch is executed when resetting state is opened due
+        // to emergency call or state change to one causing shutdown.
+        // No need to wait for any callbacks (emergency call callback
+        // handled by CVtUiAppShutter).
+        iCtx.ShutdownL();
+        }
+    __VTPRINTEXIT( "TVtUiStateResetting.OpenL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateResetting::Close
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateResetting::Close()
+    {
+    __VTPRINTENTER( "TVtUiStateResetting.Close" )
+    SetExecState( TVtUiStates::EExecStateFinalized );
+    if ( TVtUiStateResetting::iInstance )
+        {
+        delete TVtUiStateResetting::iInstance;
+        TVtUiStateResetting::iInstance = NULL;
+        }
+    __VTPRINTEXIT( "TVtUiStateResetting.Close" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/tvtuistaterunning.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,303 @@
+/*
+* 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:  running (normal operation) application state
+*
+*/
+
+
+#include "tvtuistates.h"
+#include "tvtuiappstates.h"
+#include "mvtuistatecontext.h"
+#include "cvtuiappshutter.h"
+#include "videotelui.hrh"
+#include <cvtlogger.h>
+#include <vtengevents.h>
+#include <stringloader.h>
+#include <aknquerydialog.h>
+#include <videotelui.rsg>
+
+TVtUiStateRunning* TVtUiStateRunning::iInstance = NULL;
+
+// c++ constructor
+TVtUiStateRunning::TVtUiStateRunning(
+    MVtUiStateContext& aCtx, TVtUiStates& aUiStates )
+    : TVtUiAppStateBase( aCtx, aUiStates ), iCreateVoiceCallDlg( NULL )
+    {
+    }
+
+// Destructor
+TVtUiStateRunning::~TVtUiStateRunning()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::InstanceL
+// -----------------------------------------------------------------------------
+//
+TVtUiStateRunning * TVtUiStateRunning::InstanceL(
+    MVtUiStateContext& aCtx,
+    TVtUiStates& aUiStates )
+    {
+    __VTPRINTENTER( "UiStateRunning.InstanceL" )
+    if ( iInstance == NULL )
+        iInstance = new ( ELeave ) TVtUiStateRunning( aCtx, aUiStates );
+    __VTPRINTEXIT( "UiStateRunning.InstanceL" )
+    return iInstance;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::HandleVtEventL
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiStateRunning::HandleVtEventL(
+    const TInt aEvent )
+    {
+    __VTPRINTENTER( "UiStateRunning.HandleVtEventL" )
+    // let TVtUiAppStateBase base class do common tasks
+    TEventResponse handled = TVtUiAppStateBase::HandleVtEventL( aEvent );
+    switch ( aEvent )
+        {
+    case KVtEngDeviceLockOn:
+    case KVtEngDeviceLockOff:
+        TVtUiAppStateBase::HandleVtEventL( aEvent );
+        if ( aEvent == KVtEngDeviceLockOff )
+            {
+            iCtx.ChangeApplicationFocus( ETrue );
+            }
+        break;
+    case KVtEngSessionStateChanged:
+        if ( CheckEndActiveCallL() )
+            {
+            // At this point shutdown is in progress. Don't allow
+            // appUi to do actions due to this event.
+            handled = EEventHandled;
+            }
+        break;
+    default:
+        break;
+        }
+    __VTPRINTEXIT( "UiStateRunning.HandleVtEventL" )
+    return handled;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::HandleCommandL
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiStateRunning::HandleCommandL(
+    const TInt aCommand )
+    {
+    __VTPRINTENTER( "UiStateRunning.HandleCommandL" )
+    /** By default all commands are enabled by running state.
+      * Other details command validations are done elsewhere
+      */
+    TEventResponse handled = EEventHandled;
+    switch ( aCommand )
+        {
+    case EVtUiCmdEndActiveCall:
+        ShutdownWithEngineCommandL( KVtEngTerminateSession );
+        break;
+    case EVtUiCmdCreateVoice:
+        CreateVoiceCallL();
+        break;
+    case EVtUiCmdDialEmergency:
+        // Attempt emergency call. Note that emergency number check is done
+        // after calling DialEmergencyCallL and if supplied number is not
+        // emergency leave occurs.
+        TRAP_IGNORE( DialEmergencyCallL() );
+        break;
+    default:
+        handled = TVtUiAppStateBase::HandleCommandL( aCommand );
+        break;
+        }
+    __VTPRINTEXITR( "UiStateRunning.HandleCommandL %d", handled )
+    return handled;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::HandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStateRunning::HandleForegroundChangedL( const TBool aIsForeground )
+    {
+    __VTPRINTENTER( "UiStateRunning.HandleForegroundChangedL" )
+
+    // Closes create voice call dialog if it is open
+    delete iCreateVoiceCallDlg; iCreateVoiceCallDlg = NULL;
+
+    SetLightsState( aIsForeground );
+
+    iCtx.RefreshL( MVtUiStateContext::ENaviPane );
+
+    TBool handleAsForeground( aIsForeground );
+    TPtrC8 params( reinterpret_cast< TUint8* >( &handleAsForeground ),
+        sizeof( TBool ) );
+    iCtx.DoExecuteCmdL( KVtEngSetUIForeground, &params );
+    __VTPRINTEXIT( "UiStateRunning.HandleForegroundChangedL" )
+    return handleAsForeground;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::PreHandleForegroundChangedL
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStateRunning::PreHandleForegroundChangedL( const TBool aIsForeground )
+    {
+    __VTPRINTENTER( "UiStateRunning.PreHandleForegroundChangedL" )
+    TBool handleAsForeground( aIsForeground );
+    TPtrC8 params( reinterpret_cast< TUint8* >( &handleAsForeground ), sizeof( TBool ) );
+    iCtx.DoExecuteCmdL( KVtEngSetUIForeground, &params );
+    __VTPRINTEXIT( "UiStateRunning.PreHandleForegroundChangedL" )
+    return handleAsForeground;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::HandleLayoutChangedL
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateRunning::HandleLayoutChangedL( )
+    {
+    __VTPRINTENTER( "UiStateRunning.HandleLayoutChangedL" )
+    iUiStates.SetLayoutChangeNeeded( EFalse );
+    iCtx.DoHandleLayoutChangedL();
+    __VTPRINTEXIT( "UiStateRunning.HandleLayoutChangedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::StartDtmfTone
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateRunning::StartDtmfTone( const TChar& aTone )
+    {
+    iCtx.StartDtmfTone( aTone );
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::StopDtmfTone
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateRunning::StopDtmfTone()
+    {
+    iCtx.StopDtmfTone();
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::CreateVoiceCallL
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateRunning::CreateVoiceCallL()
+    {
+    __VTPRINTENTER( "TVtUiStateRunning.CreateVoiceCallL" )
+    HBufC* prompt =
+    	StringLoader::LoadLC( R_VIDEOTELUI_QTN_QUERY_CREATE_VOICE_CALL );
+
+    // Create and initialize query dialog
+    CAknQueryDialog* createVoiceCallDlg = CAknQueryDialog::NewL();
+    CleanupStack::PushL( createVoiceCallDlg );
+    createVoiceCallDlg->SetPromptL( *prompt );
+    CleanupStack::Pop(); // createVoiceCallDlg
+
+    iCreateVoiceCallDlg = createVoiceCallDlg;
+    TInt result( KErrNone );
+    TRAPD( error, result = iCreateVoiceCallDlg->ExecuteLD(
+        R_VIDEOTELUI_CREATE_VOICE_QUERY ) );
+    // Just set to NULL because ExecuteLD() deletes instance
+    iCreateVoiceCallDlg = NULL;
+    // Leave if ExecuteLD() left
+    User::LeaveIfError( error );
+    CleanupStack::PopAndDestroy( ); // prompt
+    if ( result )
+        {
+        //user answered yes
+		iCtx.DoExecuteCmdL( KVtEngSwitchToVoice, NULL );
+        }
+    __VTPRINTEXITR( "TVtUiAppStateBase.CreateVoiceCallL %d", result )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::ShutdownWithEngineCommandL
+// Starts shutdown with command to engine.
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateRunning::ShutdownWithEngineCommandL( const TInt aCommand )
+    {
+    __VTPRINTENTER(
+        "TVtUiStateRunning.ShutdownWithEngineCommandL" )
+    TVtUiAppStateBase* resetState =
+        TVtUiStateResetting::InstanceL( iCtx, iUiStates, aCommand ); 
+    CVtUiAppShutter* shutter = CVtUiAppShutter::InstanceL( *resetState );
+    if ( shutter )
+        {
+        // open resetting state, handles engine command request/reply
+        ChangeStateL( *resetState );
+#ifdef _DEBUG
+        __VTPRINTEXIT(
+            "TVtUiStateRunning.ShutdownWithEngineCommandL 1" )
+        return;
+#endif
+        }    
+       
+    __VTPRINTEXIT(
+        "TVtUiStateRunning.ShutdownWithEngineCommandL 0" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::DialEmergencyCallL
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateRunning::DialEmergencyCallL()
+    {
+    __VTPRINTENTER(
+        "TVtUiStateRunning.DialEmergencyCallL" )
+    TVtUiAppStateBase* resetState =
+        TVtUiStateResetting::InstanceL( iCtx, iUiStates );
+    CVtUiAppShutter* shutter = CVtUiAppShutter::InstanceL( *resetState );
+    if ( shutter )
+        {
+        // Make emergency call and proceed when 1) state has given permission 
+        // and 2) callback from emergency call api is received
+        shutter->ShutdownWithEmergencyCallL( iCtx );
+        ChangeStateL( *resetState );
+        }
+    __VTPRINTEXIT( "TVtUiStateRunning.DialEmergencyCallL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::OpenL
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateRunning::OpenL()
+    {
+    __VTPRINTENTER( "TVtUiStateRunning.OpenL" )
+    SetExecState( TVtUiStates::EExecStateRunning );
+    iCtx.RefreshStatesL();
+    __VTPRINTEXIT( "TVtUiStateRunning.OpenL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateRunning::Close
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateRunning::Close()
+    {
+    __VTPRINTENTER( "TVtUiStateRunning.Close" )
+    if ( TVtUiStateRunning::iInstance )
+        {
+        delete TVtUiStateRunning::iInstance;
+        TVtUiStateRunning::iInstance = NULL;
+        }
+    __VTPRINTEXIT( "TVtUiStateRunning.Close" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vtuis/videotelui/src/tvtuistatestarting.cpp	Mon Nov 23 14:47:47 2009 +0200
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2007 - 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:  waiting details application state
+*
+*/
+
+
+#include "tvtuistates.h"
+#include "tvtuiappstates.h"
+#include "mvtuistatecontext.h"
+#include "videotelui.hrh"
+#include "cvtuiappshutter.h"
+#include <cvtlogger.h>
+#include <vtengevents.h>
+#include <vtengcommands.h>
+#include <cvtengmodel.h>
+#include <mvtengsessioninfo.h>
+
+
+TVtUiStateStarting* TVtUiStateStarting::iInstance = NULL;
+
+// c++ constructor
+TVtUiStateStarting::TVtUiStateStarting(
+    MVtUiStateContext& aCtx, TVtUiStates& aUiStates ) 
+    : TVtUiAppStateBase( aCtx, aUiStates )
+    {
+    iPreconditions.Set( EWaitingCLI );
+    iPreconditions.Set( EWaitingPhase1ToComplete );
+    }
+
+// Destructor
+TVtUiStateStarting::~TVtUiStateStarting()
+    {
+    delete iStartCallback;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::InstanceL
+//
+// -----------------------------------------------------------------------------
+//
+TVtUiStateStarting * TVtUiStateStarting::InstanceL(
+    MVtUiStateContext& aCtx, TVtUiStates& aUiStates )
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.InstanceL" )
+    if ( iInstance == NULL )
+        {
+        iInstance = new ( ELeave ) TVtUiStateStarting( aCtx, aUiStates );
+        }
+    __VTPRINTEXIT( "TVtUiStateStarting.InstanceL" )
+    return iInstance;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::AppUiStartupPhase1DoneL
+//
+// Phase 1 of application startup is completed, check if we can proceed to
+// phase 2.
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateStarting::AppUiStartupPhase1DoneL()
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.AppUiStartupPhase1DoneL" )
+    // From startup phase point of view we're ready to proceed
+    // to phase 2. Clear that precondition and proceed if otherwise ready.
+    CheckPhase2StartupL( EWaitingPhase1ToComplete );
+    __VTPRINTEXIT( "TVtUiStateStarting.AppUiStartupPhase1DoneL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::AppUiStartupPhase2DoneL
+//
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateStarting::AppUiStartupPhase2DoneL()
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.AppUiStartupPhase2DoneL" )
+    // Phase 2 completed, proceed to next state
+    ChangeStateL( *TVtUiStateRunning::InstanceL( iCtx, iUiStates ) );
+    __VTPRINTEXIT( "TVtUiStateStarting.AppUiStartupPhase2DoneL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::HandleVtEventL
+//
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiStateStarting::HandleVtEventL(
+    const TInt aEvent )
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.HandleVtEventL" )
+    TEventResponse handled = EEventHandled;
+    switch ( aEvent )
+        {
+    case KVtEngRemoteDisconnect:
+        // base class handles this.
+        handled = TVtUiAppStateBase::HandleVtEventL( aEvent );
+        break;
+    case KVtEngSessionStateChanged:
+        {
+        // check if session state is proper for proceeding to next phase
+        // in startup.
+        CheckSessionStateL();
+        }
+        break;
+    case KVtEngRemoteVideoStarted:
+        // allow to start remote video rendering
+    case KVtEngSourceChanged:
+        // allow handling of source changed event
+        handled = EEventNotHandled; 
+        break;
+    case KVtEngCLIAvailable:
+        HandleCLIReceivedL();
+        break;
+        
+    case KVtEngRemoteUIIIA5StringSupport:
+        break;
+    case KVtEngDeviceLockOn:
+    case KVtEngDeviceLockOff:
+    default:
+        handled = TVtUiAppStateBase::HandleVtEventL( aEvent );
+        break;
+        }
+    __VTPRINTEXIT( "TVtUiStateStarting.HandleVtEventL" )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::HandleCommandL
+//
+// -----------------------------------------------------------------------------
+//
+TVtUiAppStateBase::TEventResponse TVtUiStateStarting::HandleCommandL(
+    const TInt /*aCommand*/ )
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.HandleCommandL" )
+    __VTPRINTEXIT( "TVtUiStateStarting.HandleCommandL" )
+    return EEventNotHandled;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::HandleForegroundChangedL
+//
+// -----------------------------------------------------------------------------
+//
+TBool TVtUiStateStarting::HandleForegroundChangedL( const TBool aIsForeground )
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.HandleForegroundChangedL" )
+        
+    SetLightsState( aIsForeground );
+    iCtx.RefreshL( MVtUiStateContext::ENaviPane );
+    
+    // behave as in background if CLI (=details) has not yet received
+    TBool handleAsForeground( aIsForeground && iUiStates.IsDetailsReceived() ); 
+    TVtUiAppStateBase::ExecuteEngineCommand( KVtEngSetUIForeground, 
+        handleAsForeground );
+    
+    __VTPRINTEXIT( "TVtUiStateStarting.HandleForegroundChangedL" )
+    return handleAsForeground;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::OpenL
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateStarting::OpenL()
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.OpenL" )
+    iStartCallback = new ( ELeave ) CAsyncCallBack (
+            TCallBack( &AsynchOpen, this ),
+            CActive::EPriorityStandard );
+    iStartCallback->CallBack();  
+    __VTPRINTEXIT( "TVtUiStateStarting.OpenL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::AsynchOpen
+// asynchronous entry to the state.
+// -----------------------------------------------------------------------------
+//
+TInt TVtUiStateStarting::AsynchOpen( TAny* aAny )
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.AsynchOpen" )
+    TVtUiStateStarting* state = reinterpret_cast<TVtUiStateStarting*>( aAny );
+    delete state->iStartCallback;
+    state->iStartCallback = NULL;
+    TRAPD( res, state->DoOpenL() );
+    __VTPRINTEXITR( "TVtUiStateStarting.AsynchOpen err=%d>", res )
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::DoOpenL
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateStarting::DoOpenL()
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.DoOpenL" )
+    if ( !CheckEndActiveCallL() )
+        {
+        // not shutting down, proceed to phase 1
+        iCtx.StartupPhase1L();
+        }
+    __VTPRINTEXIT( "TVtUiStateStarting.DoOpenL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::CheckSessionStateL
+// Resolve action based on session state change in the engine.
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateStarting::CheckSessionStateL()
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.CheckSessionStateL" )
+    const MVtEngSessionInfo::TSessionState state = SessionState( EFalse );
+    switch ( state )
+        {
+    case MVtEngSessionInfo::EConnected:
+    case MVtEngSessionInfo::ENegotiating:
+    case MVtEngSessionInfo::EOpen:
+        // From session state point of view we're ready to proceed.
+        // Clear precondition and proceed if otherwise ready.
+        CheckPhase2StartupL( EWaitingSessionState );
+        break;
+    default:
+        // Is session state such that we need to shutdown?
+        CheckEndActiveCallL();
+        break;
+        }
+    __VTPRINTEXIT( "TVtUiStateStarting.CheckSessionStateL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::CheckPhase2StartupL
+//
+// mark precondition passed and if no more preconditions exist proceed
+// in startup.
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateStarting::CheckPhase2StartupL(
+    const TPreconditions aCond )
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.CheckPhase2StartupL" )
+    // First check that at least one precondition holds
+    if ( iPreconditions.Value() )
+        {
+        iPreconditions.Clear( aCond );
+        if ( !iPreconditions.Value() )
+            {
+            CleanupResetPushL();  // start shutdown if StartupPhase2L leaves
+            iCtx.StartupPhase2L();
+            CleanupStack::Pop(); // CleanupResetPushL
+            }
+        }
+#ifdef VTDEBUG
+    else {
+        __VTPRINT( DEBUG_GEN, "TVtUiStateStarting.CheckPhase2StartupL NoOp!" )
+        }
+#endif // VTDEBUG
+    __VTPRINTEXITR( "TVtUiStateStarting.CheckPhase2StartupL cond=%d",
+        (TInt) iPreconditions.Value() )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::HandleCLIReceivedL
+// CLI reception from engine is one of the two preconditions for proceeding
+// to phase2 startup.
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateStarting::HandleCLIReceivedL()
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.HandleCLIReceivedL" )
+    const MVtEngSessionInfo& session = iCtx.Model().Session();
+    MVtEngSessionInfo::TCLI cli;
+    if ( session.GetCLI( cli ) == KErrNone )
+        {
+        iUiStates.SetDetailsReceived( ETrue );
+        iUiStates.SetCLIReceived( cli.iVoiceCallPossible );
+        iCtx.SetCallIdL( cli.iCallId );
+        iCtx.SetCallNameL( cli.iName );
+        }
+    CheckPhase2StartupL( EWaitingCLI );
+    __VTPRINTEXIT( "TVtUiStateStarting.HandleCLIReceivedL" )
+    }
+
+// -----------------------------------------------------------------------------
+// TVtUiStateStarting::Close
+// -----------------------------------------------------------------------------
+//
+void TVtUiStateStarting::Close()
+    {
+    __VTPRINTENTER( "TVtUiStateStarting.Close" )
+    if ( TVtUiStateStarting::iInstance )
+        {
+        delete TVtUiStateStarting::iInstance;
+        TVtUiStateStarting::iInstance = NULL;
+        }
+    __VTPRINTEXIT( "TVtUiStateStarting.Close" )
+    }