Revision: 201017 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 16:42:02 +0300
branchRCL_3
changeset 17 3570217d8c21
parent 13 f5c5c82a163e
child 18 2eb3b066cc7d
Revision: 201017 Kit: 201019
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioControllerUtility/Src/MP3AudioControllerUtility.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerPlugin.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudioplaycontroller/Src/AMRAudioPlayControllerPlugin.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerPlugin.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerPlugin.cpp
mmmw_plat/audio_metadata_reader_api/inc/MetaDataField.hrh
mmmw_plat/telephony_multimedia_service_api/inc/tmssource.h
mmmw_plat/telephony_multimedia_service_api/tsrc/Conf/TMSAudioServicesTestClass.cfg
mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/inc/TMSAudioServicesTestClass.h
mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/src/TmsAudioServicesTestClassBlocks.cpp
mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/src/TmsAudioServicesTestClassBlocksCallbacks.cpp
mmserv/metadatautility/Src/MetaDataParser.cpp
mmserv/metadatautility/Src/MetaDataParser.h
mmserv/metadatautility/Src/MetaDataUtilityBody.cpp
mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp
mmserv/radioutility/radioserver/Server/Src/RadioServerShutdown.cpp
mmserv/radioutility/radioserver/Server/Src/RadioServerShutdown.h
mmserv/thumbnailengine/TneAPISrc/HXTneserver.cpp
mmserv/tms/inc/tmsbufferimpl.h
mmserv/tms/inc/tmseffectimpl.h
mmserv/tms/inc/tmsformatimpl.h
mmserv/tms/inc/tmssinkimpl.h
mmserv/tms/tmscallserver/group/tmscallserver.mmp
mmserv/tms/tmscallserver/inc/calladpt.h
mmserv/tms/tmscallserver/inc/callcsadpt.h
mmserv/tms/tmscallserver/inc/callipadpt.h
mmserv/tms/tmscallserver/inc/csdownlink.h
mmserv/tms/tmscallserver/inc/cspdevsound.h
mmserv/tms/tmscallserver/inc/csuplink.h
mmserv/tms/tmscallserver/inc/delaytimer.h
mmserv/tms/tmscallserver/inc/ipcallstream.h
mmserv/tms/tmscallserver/inc/mcspdevsoundobserver.h
mmserv/tms/tmscallserver/inc/tarsettings.h
mmserv/tms/tmscallserver/inc/tmscalladpt.h
mmserv/tms/tmscallserver/inc/tmscallcsadpt.h
mmserv/tms/tmscallserver/inc/tmscallipadpt.h
mmserv/tms/tmscallserver/inc/tmscsdevsound.h
mmserv/tms/tmscallserver/inc/tmscsdevsoundobserver.h
mmserv/tms/tmscallserver/inc/tmscsdownlink.h
mmserv/tms/tmscallserver/inc/tmscsuplink.h
mmserv/tms/tmscallserver/inc/tmsdelaytimer.h
mmserv/tms/tmscallserver/inc/tmsipcallstream.h
mmserv/tms/tmscallserver/inc/tmstarsettings.h
mmserv/tms/tmscallserver/src/calladpt.cpp
mmserv/tms/tmscallserver/src/callcsadpt.cpp
mmserv/tms/tmscallserver/src/callipadpt.cpp
mmserv/tms/tmscallserver/src/csdownlink.cpp
mmserv/tms/tmscallserver/src/cspdevsound.cpp
mmserv/tms/tmscallserver/src/csuplink.cpp
mmserv/tms/tmscallserver/src/delaytimer.cpp
mmserv/tms/tmscallserver/src/ipcalldownlink.cpp
mmserv/tms/tmscallserver/src/ipcalldownlinkds.cpp
mmserv/tms/tmscallserver/src/ipcallstreambase.cpp
mmserv/tms/tmscallserver/src/ipcalluplink.cpp
mmserv/tms/tmscallserver/src/ipcalluplinkds.cpp
mmserv/tms/tmscallserver/src/tarsettings.cpp
mmserv/tms/tmscallserver/src/tmscalladpt.cpp
mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp
mmserv/tms/tmscallserver/src/tmscallipadpt.cpp
mmserv/tms/tmscallserver/src/tmscallserver.cpp
mmserv/tms/tmscallserver/src/tmscallsession.cpp
mmserv/tms/tmscallserver/src/tmscsdevsound.cpp
mmserv/tms/tmscallserver/src/tmscsdownlink.cpp
mmserv/tms/tmscallserver/src/tmscsuplink.cpp
mmserv/tms/tmscallserver/src/tmsdelaytimer.cpp
mmserv/tms/tmscallserver/src/tmsipcalldownlink.cpp
mmserv/tms/tmscallserver/src/tmsipcalldownlinkds.cpp
mmserv/tms/tmscallserver/src/tmsipcallstreambase.cpp
mmserv/tms/tmscallserver/src/tmsipcalluplink.cpp
mmserv/tms/tmscallserver/src/tmsipcalluplinkds.cpp
mmserv/tms/tmscallserver/src/tmstarsettings.cpp
mmserv/tms/tmsimpl/eabi/tmsimpl.def
mmserv/tms/tmsimpl/src/tmsbufferimpl.cpp
mmserv/tms/tmsimpl/src/tmseffectimpl.cpp
mmserv/tms/tmsimpl/src/tmsformatimpl.cpp
mmserv/tms/tmsimpl/src/tmssinkimpl.cpp
mmserv/tms/tmsimpl/src/tmssourceimpl.cpp
mmserv/tms/tmsserver/src/tmsserver.cpp
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp	Tue May 11 16:42:02 2010 +0300
@@ -841,17 +841,6 @@
 
     // we need to block this until duration is calculated if using mmfplayutility
     iBlockDuration = EFalse;
-// ou1cimx1#205863
-    if (!iDataSourceAdapter->IsLocalPlayback()) 
-    	{
-	    DP0(_L("CAdvancedAudioPlayController::AddDataSourceL not file source"));        
-	    if (iSharedBufferMaxNum <= 2)
-	        {
-	        	iSharedBufferMaxNum = 3;
-	        }
-		 iSharedBufferMaxSize = iSharedBufferMaxSizeForNonSeekableSrc;
-	    DP2(_L("CAdvancedAudioPlayController::AddDataSourceL new iSharedBufferMaxNum[%d] iSharedBufferMaxSize[%d]"), iSharedBufferMaxNum, iSharedBufferMaxSize);
-    	}
     
     if ((!iEventsEnabled) && (!iDataSourceAdapter->OnlyHeaderPresent()))
         {
@@ -997,11 +986,6 @@
     {
     DP0(_L("CAdvancedAudioPlayController::RemoveDataSinkL"));
 
-    if (!iDataSink)
-		{
-        User::Leave(KErrNotReady);
-		}
-
     if (iDataSink != &aDataSink)
 		{
         User::Leave(KErrArgument);
@@ -1011,9 +995,12 @@
 		{
         User::Leave(KErrNotReady);
 		}
-
-    iDataSink->SinkStopL();         // should always stop source before logoff
-	iDataSink->SinkThreadLogoff();
+		
+   if (iDataSink)
+   	{
+       iDataSink->SinkStopL();         // should always stop source before logoff
+	     iDataSink->SinkThreadLogoff();
+	  }
 
     // dereference Decoder from Utility before deleting AudioOutput (which took ownership of decoder)
     if (iAudioUtility)
@@ -1021,8 +1008,8 @@
         iAudioUtility->DeReferenceDecoder();
     	}
     
-	delete iAudioOutput;
-	iAudioOutput = NULL;
+    delete iAudioOutput;
+	  iAudioOutput = NULL;
     iDataSink = NULL;
     iDecoderExists = EFalse;
     }
@@ -1036,7 +1023,12 @@
     DP0(_L("CAdvancedAudioPlayController::ResetL"));
 
     RemoveDataSourceL(*iDataSource);
-    RemoveDataSinkL(*iDataSink);
+    
+    if (iDataSink)
+    	{
+    		  DP0(_L("CAdvancedAudioPlayController::ResetL, calling RemoveDataSinkL"));
+          RemoveDataSinkL(*iDataSink);
+      }
     }
 
 // -----------------------------------------------------------------------------
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioControllerUtility/Src/MP3AudioControllerUtility.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioControllerUtility/Src/MP3AudioControllerUtility.cpp	Tue May 11 16:42:02 2010 +0300
@@ -175,6 +175,8 @@
 	TInt frameBytes = 0;
 	TInt avgFrameLen = 0;
 	TInt frames = 0;
+	TInt scaling=0;
+	TInt round=0;
 	// We could have used the bitrate found above for CBR MP3 content and not continue to average
 	// the bitrate. However, some users can manipulated the file and append other bitrate content.
 	// Since it is not too difficult, we can update the bitrate above with an averaged bitrate.
@@ -203,6 +205,12 @@
 			frames++;    	        	
 			}	
 		avgFrameLen = frameBytes / frames; // frames is always non-zero here
+		scaling = frameBytes*10/frames;
+		round = scaling%10;
+		if(round > 5)
+		    {
+		     ++avgFrameLen;
+		    }
 		}
 	iBitRate = (avgFrameLen * 8 * iSamplingRate) / iSamplesPerFrame;
 	}
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerPlugin.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerPlugin.cpp	Tue May 11 16:42:02 2010 +0300
@@ -111,6 +111,18 @@
 void CAACAudioPlayControllerPlugin::DoAddDataSourceL()
     {
     DP0(_L("CAACAudioPlayControllerPlugin::DoAddDataSourceL"));
+        // ou1cimx1#205863
+    if (iSourceType != KUidMmfFileSource) 
+    	{
+	    DP0(_L("CAACAudioPlayControllerPlugin::DoAddDataSourceL not file source"));        
+	    if (iSharedBufferMaxNum <= 2)
+	        {
+	        	iSharedBufferMaxNum = 3;
+	        }
+		 iSharedBufferMaxSize = iSharedBufferMaxSizeForNonSeekableSrc;
+	    DP2(_L("CAACAudioPlayControllerPlugin::DoAddDataSourceL new iSharedBufferMaxNum[%d] iSharedBufferMaxSize[%d]"), iSharedBufferMaxNum, iSharedBufferMaxSize);
+    	}
+
 	}
 
 // -----------------------------------------------------------------------------
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudioplaycontroller/Src/AMRAudioPlayControllerPlugin.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudioplaycontroller/Src/AMRAudioPlayControllerPlugin.cpp	Tue May 11 16:42:02 2010 +0300
@@ -104,6 +104,18 @@
 void CAMRAudioPlayControllerPlugin::DoAddDataSourceL()
     {
     DP0(_L("CAMRAudioPlayControllerPlugin::DoAddDataSourceL"));
+        // ou1cimx1#205863
+    if (iSourceType != KUidMmfFileSource) 
+    	{
+	    DP0(_L("CAMRAudioPlayControllerPlugin::DoAddDataSourceL not file source"));        
+	    if (iSharedBufferMaxNum <= 2)
+	        {
+	        	iSharedBufferMaxNum = 3;
+	        }
+		 iSharedBufferMaxSize = iSharedBufferMaxSizeForNonSeekableSrc;
+	    DP2(_L("CAMRAudioPlayControllerPlugin::DoAddDataSourceL new iSharedBufferMaxNum[%d] iSharedBufferMaxSize[%d]"), iSharedBufferMaxNum, iSharedBufferMaxSize);
+    	}
+
     }
 
 // -----------------------------------------------------------------------------
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerPlugin.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerPlugin.cpp	Tue May 11 16:42:02 2010 +0300
@@ -103,6 +103,18 @@
 void CAWBAudioPlayControllerPlugin::DoAddDataSourceL()
     {
 DP0(_L("CAWBAudioPlayControllerPlugin::DoAddDataSourceL"));
+    // ou1cimx1#205863
+    if (iSourceType != KUidMmfFileSource) 
+    	{
+	    DP0(_L("CAWBAudioPlayControllerPlugin::DoAddDataSourceL not file source"));        
+	    if (iSharedBufferMaxNum <= 2)
+	        {
+	        	iSharedBufferMaxNum = 3;
+	        }
+		 iSharedBufferMaxSize = iSharedBufferMaxSizeForNonSeekableSrc;
+	    DP2(_L("CAWBAudioPlayControllerPlugin::DoAddDataSourceL new iSharedBufferMaxNum[%d] iSharedBufferMaxSize[%d]"), iSharedBufferMaxNum, iSharedBufferMaxSize);
+    	}
+
     }
 
 // -----------------------------------------------------------------------------
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerPlugin.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerPlugin.cpp	Tue May 11 16:42:02 2010 +0300
@@ -102,6 +102,18 @@
 void CMP3AudioPlayControllerPlugin::DoAddDataSourceL()
     {
     DP0(_L("CMP3AudioPlayControllerPlugin::DoAddDataSourceL"));
+    // ou1cimx1#205863
+    if (iSourceType != KUidMmfFileSource) 
+    	{
+	    DP0(_L("CMP3AudioPlayControllerPlugin::DoAddDataSourceL not file source"));        
+	    if (iSharedBufferMaxNum <= 2)
+	        {
+	        	iSharedBufferMaxNum = 3;
+	        }
+		 iSharedBufferMaxSize = iSharedBufferMaxSizeForNonSeekableSrc;
+	    DP2(_L("CMP3AudioPlayControllerPlugin::DoAddDataSourceL new iSharedBufferMaxNum[%d] iSharedBufferMaxSize[%d]"), iSharedBufferMaxNum, iSharedBufferMaxSize);
+    	}
+
     }
 
 // -----------------------------------------------------------------------------
--- a/mmmw_plat/audio_metadata_reader_api/inc/MetaDataField.hrh	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmmw_plat/audio_metadata_reader_api/inc/MetaDataField.hrh	Tue May 11 16:42:02 2010 +0300
@@ -22,38 +22,40 @@
 
 // DATA TYPES
 enum TMetaDataFieldId		// Possible metadata fields
-	{
-	EUnknownMetaDataField = 0,
+    {
+    EUnknownMetaDataField = 0,
 
-	EMetaDataSongTitle = 1,
-	EMetaDataArtist,
-	EMetaDataAlbum,
-	EMetaDataYear,
-	EMetaDataComment,
-	EMetaDataAlbumTrack,
-	EMetaDataGenre,
-	EMetaDataComposer,
-	EMetaDataCopyright,
-	EMetaDataOriginalArtist,
-	EMetaDataUrl,
-	EMetaDataUserUrl,
-	EMetaDataJpeg,
-	EMetaDataVendor,
-	EMetaDataRating,
-	EMetaDataUniqueFileIdentifier,
-	EMetaDataDuration,
-	EMetaDataDate,
-	EMetaDataUnsyncLyrics
-	// More later...
-	};
+    EMetaDataSongTitle = 1,
+    EMetaDataArtist,
+    EMetaDataAlbum,
+    EMetaDataYear,
+    EMetaDataComment,
+    EMetaDataAlbumTrack,
+    EMetaDataGenre,
+    EMetaDataComposer,
+    EMetaDataCopyright,
+    EMetaDataOriginalArtist,
+    EMetaDataUrl,
+    EMetaDataUserUrl,
+    EMetaDataJpeg,
+    EMetaDataVendor,
+    EMetaDataRating,
+    EMetaDataUniqueFileIdentifier,
+    EMetaDataDuration,
+    EMetaDataDate,
+    EMetaDataUnsyncLyrics,
+    EMetaDataProtected        // get the Protected info, "0"=non protected, "1"=protected
+	
+    // More later...
+    };
 
 // ENUM for ID3 Version
 enum TID3Version
-	{
-	ENonID3,
-	EID3Version1,
-	EID3Version2
-	};
+    {
+    ENonID3,
+    EID3Version1,
+    EID3Version2
+    };
 
 #endif      // CMETADATAFIELD_HRH
 
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmssource.h	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmssource.h	Tue May 11 16:42:02 2010 +0300
@@ -48,22 +48,6 @@
     virtual gint GetType(TMSSourceType& sourcetype) = 0;
     };
 
-/*class TMSDeviceMic:public TMSSource
-    {
-public:
-    virtual gint GetType(TMSSourceType& sourcetype){return iSourceType};
-private:
-    TMSSourceType iSourceType;
-    };*/
-
-/*class TMSModem:public TMSSource
-    {
-public:
-    virtual gint GetType(TMSSourceType& sourcetype){return iSourceType};
-private:
-    TMSSourceType iSourceType;
-    };*/
-
 } //namespace TMS
 
 #endif //TMS_SOURCE_H
--- a/mmmw_plat/telephony_multimedia_service_api/tsrc/Conf/TMSAudioServicesTestClass.cfg	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/tsrc/Conf/TMSAudioServicesTestClass.cfg	Tue May 11 16:42:02 2010 +0300
@@ -700,12 +700,12 @@
 Tms CreateDownlinkStream
 Tms CreateEffect 9
 allownextresult TMS_RESULT_DOES_NOT_EXIST
-Tms RemoveGlobleVolumeEffectToStream
-Tms AddGlobleVolumeEffectToStream
+Tms RemoveGlobalVolumeEffectToStream
+Tms AddGlobalVolumeEffectToStream
 allownextresult TMS_RESULT_ALREADY_EXIST
-Tms AddGlobleVolumeEffectToStream
-Tms RemoveGlobleVolumeEffectToStream
-Tms AddGlobleVolumeEffectToStream
+Tms AddGlobalVolumeEffectToStream
+Tms RemoveGlobalVolumeEffectToStream
+Tms AddGlobalVolumeEffectToStream
 delete Tms
 [Endtest]
 
@@ -717,12 +717,12 @@
 Tms CreateUplinkStream
 Tms CreateEffect 10
 allownextresult TMS_RESULT_DOES_NOT_EXIST
-Tms RemoveGlobleGainEffectToStream
-Tms AddGlobleGainEffectToStream
+Tms RemoveGlobalGainEffectToStream
+Tms AddGlobalGainEffectToStream
 allownextresult TMS_RESULT_ALREADY_EXIST
-Tms AddGlobleGainEffectToStream
-Tms RemoveGlobleGainEffectToStream
-Tms AddGlobleGainEffectToStream
+Tms AddGlobalGainEffectToStream
+Tms RemoveGlobalGainEffectToStream
+Tms AddGlobalGainEffectToStream
 delete Tms
 [Endtest]
 
--- a/mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/inc/TMSAudioServicesTestClass.h	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/inc/TMSAudioServicesTestClass.h	Tue May 11 16:42:02 2010 +0300
@@ -104,8 +104,7 @@
 _LIT( KTagPrivate, "Private");
 
 // MACROS
-//#define ?macro ?macro_def
-// Logging path
+
 #ifdef __WINSCW__
 _LIT( KTmsAudioServicesTestClassLogPath, "\\logs\\testframework\\" );
 _LIT16(KTestFile1, "\\testing\\data\\alarm 1.aac");
@@ -332,6 +331,7 @@
     TInt CreateUplinkStream(CStifItemParser& aItem);
     TInt GetUplinkVersion(CStifItemParser& aItem);
     TInt GetSupportedFormats(CStifItemParser& aItem);
+
     TInt IsCallTypeSupported(CStifItemParser& aItem);
     TInt SetDownlinkFormat(CStifItemParser& aItem);
     TInt SetUplinkFormat(CStifItemParser& aItem);
@@ -347,7 +347,6 @@
     TInt Gain(CStifItemParser& aItem);
     TInt Volume(CStifItemParser& aItem);
 
-    TInt GetBufferType(CStifItemParser& aItem);
 
     //  TInt GetSupportedBitrates( CStifItemParser& aItem );
 
@@ -369,6 +368,7 @@
     void DisplayFormat(TMSFormatType aFormat);
     void GetSupportedBitrates(RArray<TUint>& aBrArr);
     void DisplayDevice(TMSAudioOutput device);
+    TInt GetBufferType(CStifItemParser& aItem);
 
     TInt ConfigEncAudDevice(CStifItemParser& aItem);
 
@@ -391,15 +391,15 @@
     TInt RemoveSinkObserver(CStifItemParser& aItem);
 
     gint CreateVolumeEffect();
-    gint CreateVolumeGlobleEffect();
+    gint CreateVolumeGlobalEffect();
     TInt AddVolumeEffectToStream(CStifItemParser& aItem);
-    TInt AddGlobleVolumeEffectToStream(CStifItemParser& aItem);
-    TInt RemoveGlobleVolumeEffectToStream(CStifItemParser& aItem);
+    TInt AddGlobalVolumeEffectToStream(CStifItemParser& aItem);
+    TInt RemoveGlobalVolumeEffectToStream(CStifItemParser& aItem);
     gint CreateGainEffect();
-    gint CreateGlobleGainEffect();
+    gint CreateGlobalGainEffect();
     TInt AddGainEffectToStream(CStifItemParser& aItem);
-    TInt AddGlobleGainEffectToStream(CStifItemParser& aItem);
-    TInt RemoveGlobleGainEffectToStream(CStifItemParser& aItem);
+    TInt AddGlobalGainEffectToStream(CStifItemParser& aItem);
+    TInt RemoveGlobalGainEffectToStream(CStifItemParser& aItem);
     TInt GetStreamType(CStifItemParser& aItem);
     TInt GetStreamState(CStifItemParser& aItem);
 
--- a/mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/src/TmsAudioServicesTestClassBlocks.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/src/TmsAudioServicesTestClassBlocks.cpp	Tue May 11 16:42:02 2010 +0300
@@ -148,8 +148,7 @@
 //
 TInt CTmsAudioServicesTestClass::RunMethodL(CStifItemParser& aItem)
     {
-    static TStifFunctionInfo const
-    KFunctions[] =
+    static TStifFunctionInfo const KFunctions[] =
         {
         // Copy this line for every implemented function.
         // First string is the function name used in TestScripter script file.
@@ -180,12 +179,12 @@
         ENTRY( "OpenDownlink", CTmsAudioServicesTestClass::OpenDownlink ),
         ENTRY( "OpenUplink", CTmsAudioServicesTestClass::OpenUplink ),
         ENTRY( "Gain", CTmsAudioServicesTestClass::Gain ),
-        ENTRY( "AddGlobleGainEffectToStream", CTmsAudioServicesTestClass::AddGlobleGainEffectToStream),
-        ENTRY( "RemoveGlobleGainEffectToStream", CTmsAudioServicesTestClass::RemoveGlobleGainEffectToStream),
+        ENTRY( "AddGlobalGainEffectToStream", CTmsAudioServicesTestClass::AddGlobalGainEffectToStream),
+        ENTRY( "RemoveGlobalGainEffectToStream", CTmsAudioServicesTestClass::RemoveGlobalGainEffectToStream),
         ENTRY( "Volume", CTmsAudioServicesTestClass::Volume ),
-        ENTRY( "AddGlobleVolumeEffectToStream", CTmsAudioServicesTestClass::AddGlobleVolumeEffectToStream),
-        ENTRY( "RemoveGlobleVolumeEffectToStream", CTmsAudioServicesTestClass::RemoveGlobleVolumeEffectToStream),
-        ENTRY( "CreateGlobleGainEffect", CTmsAudioServicesTestClass::CreateGlobleGainEffect),
+        ENTRY( "AddGlobalVolumeEffectToStream", CTmsAudioServicesTestClass::AddGlobalVolumeEffectToStream),
+        ENTRY( "RemoveGlobalVolumeEffectToStream", CTmsAudioServicesTestClass::RemoveGlobalVolumeEffectToStream),
+        ENTRY( "CreateGlobalGainEffect", CTmsAudioServicesTestClass::CreateGlobalGainEffect),
         ENTRY( "Close", CTmsAudioServicesTestClass::Close ),
         ENTRY( "Start", CTmsAudioServicesTestClass::Start ),
         ENTRY( "Pause", CTmsAudioServicesTestClass::Pause ),
@@ -675,8 +674,8 @@
                 break;
             case TMS_EFFECT_GLOBAL_VOL:
                 {
-                error = CreateVolumeGlobleEffect();
-                //       AddGlobleVolumeEffectToStream();
+                error = CreateVolumeGlobalEffect();
+                //       AddGlobalVolumeEffectToStream();
                 }
                 break;
             case TMS_EFFECT_GAIN:
@@ -687,8 +686,8 @@
                 break;
             case TMS_EFFECT_GLOBAL_GAIN:
                 {
-                error = CreateGlobleGainEffect();
-                //        AddGlobleGainEffectToStream();
+                error = CreateGlobalGainEffect();
+                //        AddGlobalGainEffectToStream();
                 }
                 break;
             default:
@@ -1034,7 +1033,8 @@
     return error;
     }
 
-TInt CTmsAudioServicesTestClass::CreateDownlinkStream(CStifItemParser& /*aItem*/)
+TInt CTmsAudioServicesTestClass::CreateDownlinkStream(
+        CStifItemParser& /*aItem*/)
     {
     FTRACE(FPrint(_L("CTmsAudioServicesTestClass::CreateDownlinkStream")));
     iLog->Log(_L("CTmsAudioServicesTestClass::CreateDownlinkStream"));
@@ -1196,8 +1196,7 @@
 
         if (error != KErrNone)
             {
-            iLog->Log(_L("CTmsAudioServicesTestClass::SetDownlinkFormat - failed, return error = %d" ),
-                    error);
+            iLog->Log(_L("CTmsAudioServicesTestClass::SetDownlinkFormat - failed, return error = %d" ), error);
             return error;
             }
         }
@@ -1221,8 +1220,7 @@
         error = iTmsDnlink->ResetFormat(iTmsFormatDn);
         if (error != KErrNone)
             {
-            iLog->Log(_L("CTmsAudioServicesTestClass::ReSetDownlinkFormat - failed, return error = %d" ),
-                    error);
+            iLog->Log(_L("CTmsAudioServicesTestClass::ReSetDownlinkFormat - failed, return error = %d" ), error);
             return error;
             }
         }
@@ -1273,8 +1271,7 @@
         {
         if (iTmsFormatUp)
             {
-            iLog->Log(
-                    _L("CTmsAudioServicesTestClass::SetUplinkFormat - iTmsFormatUp"));
+            iLog->Log(_L("CTmsAudioServicesTestClass::SetUplinkFormat - iTmsFormatUp"));
             error = iTmsUplink->SetFormat(iTmsFormatUp);
             }
         else
@@ -1285,8 +1282,7 @@
 
         if (error != KErrNone)
             {
-            iLog->Log(_L("CTmsAudioServicesTestClass::SetUplinkFormat - failed, return error = %d" ),
-                    error);
+            iLog->Log(_L("CTmsAudioServicesTestClass::SetUplinkFormat - failed, return error = %d" ), error);
             return error;
             }
         }
@@ -1397,6 +1393,7 @@
             iRecBufReady = EFalse;
             //iUpLinkCodec = ENULL;
             iTmsUplink->Deinit();
+            iTmsUplink->RemoveObserver(*this);
             iUpLinkStatus = UNINITIALIZED;
             iLog->Log(_L("Close Uplink"));
             AddExpectedEvent(EUplinkClosed, KMediumTimeout);
@@ -1405,6 +1402,7 @@
             {
             //iPlayBufPtr.Set(NULL, 0, 0);
             iTmsDnlink->Deinit();
+            iTmsDnlink->RemoveObserver(*this);
             iDnLinkStatus = UNINITIALIZED;
             iPlayBufReady = EFalse;
             // iDnLinkCodec = ENULL;
@@ -1591,7 +1589,7 @@
     if (effecttype == TMS_EFFECT_GAIN)
         {
         RDebug::Printf("[TMS STIF] GAIN, GetMaxLevel");
-        ret = static_cast<TMSGainEffect*>(iTmsUplinkEffect)->GetMaxLevel(
+        ret = static_cast<TMSGainEffect*> (iTmsUplinkEffect)->GetMaxLevel(
                 iMaxGain);
         RDebug::Printf("[TMS STIF] GAIN, GetMaxLevel Level [%d] Ret Err [%d]", iMaxGain, ret);
         RDebug::Printf("[TMS STIF] GAIN, SetLevel to [%d]", iMaxGain);
@@ -1599,7 +1597,7 @@
         RDebug::Printf("[TMS STIF] GAIN, SetLevel ret [%d]", ret);
         iLog->Log(_L("SetMaxGain: %d"), iMaxGain);
         RDebug::Printf("[TMS STIF] GAIN, GetLevel");
-        ret = static_cast<TMSGainEffect*>(iTmsUplinkEffect)->GetLevel(iGain);
+        ret = static_cast<TMSGainEffect*> (iTmsUplinkEffect)->GetLevel(iGain);
         RDebug::Printf("[TMS STIF] GAIN, Exp Level [%d] Ret Level [%d] Ret Err [%d]", iMaxGain, iGain, ret);
         if (iGain != iMaxGain)
             {
@@ -1607,9 +1605,9 @@
             return KErrUnexpectedValue;
             }
 
-        static_cast<TMSGainEffect*>(iTmsUplinkEffect)->SetLevel(0);
+        static_cast<TMSGainEffect*> (iTmsUplinkEffect)->SetLevel(0);
         iLog->Log(_L("MuteMic"));
-        static_cast<TMSGainEffect*>(iTmsUplinkEffect)->GetLevel(iGain);
+        static_cast<TMSGainEffect*> (iTmsUplinkEffect)->GetLevel(iGain);
 
         if (iGain != 0)
             {
@@ -1620,26 +1618,26 @@
     else if (effecttype == TMS_EFFECT_GLOBAL_GAIN)
         {
         RDebug::Printf("[TMS STIF] GLOBAL GAIN, GetMaxLevel");
-        ret = static_cast<TMSGlobalGainEffect*>(iGlobalGain)->GetMaxLevel(
+        ret = static_cast<TMSGlobalGainEffect*> (iGlobalGain)->GetMaxLevel(
                 iMaxGain);
         RDebug::Printf("[TMS STIF] GLOBAL GAIN, GetMaxLevel Level [%d] Ret Err [%d]", iMaxGain, ret);
         RDebug::Printf("[TMS STIF] GLOBAL GAIN, SetLevel to [%d]", iMaxGain);
-        ret = static_cast<TMSGlobalGainEffect*>(iGlobalGain)->SetLevel(
+        ret = static_cast<TMSGlobalGainEffect*> (iGlobalGain)->SetLevel(
                 iMaxGain);
         RDebug::Printf("[TMS STIF] GLOBAL GAIN, SetLevel ret [%d]", ret);
-        iLog->Log(_L("SetGlobleMaxGain: %d"), iMaxGain);
+        iLog->Log(_L("SetGlobalMaxGain: %d"), iMaxGain);
         RDebug::Printf("[TMS STIF] GLOBAL GAIN, GetLevel");
         ret = static_cast<TMSGlobalGainEffect*>(iGlobalGain)->GetLevel(iGain);
         RDebug::Printf("[TMS STIF] GLOBAL GAIN, Exp Level [%d] Ret Level [%d] Ret Err [%d]", iMaxGain, iGain, ret);
         if (iGain != iMaxGain)
             {
-            iLog->Log(_L("GetGain doesn't return expected Globle MaxGain!!! returned Gain = %d"), iGain);
+            iLog->Log(_L("GetGain doesn't return expected Global MaxGain!!! returned Gain = %d"), iGain);
             return KErrUnexpectedValue;
             }
 
-        static_cast<TMSGlobalGainEffect*>(iGlobalGain)->SetLevel(0);
+        static_cast<TMSGlobalGainEffect*> (iGlobalGain)->SetLevel(0);
         iLog->Log(_L("MuteMic"));
-        static_cast<TMSGlobalGainEffect*>(iGlobalGain)->GetLevel(iGain);
+        static_cast<TMSGlobalGainEffect*> (iGlobalGain)->GetLevel(iGain);
 
         if (iGain != 0)
             {
@@ -1665,16 +1663,16 @@
     if (effecttype == TMS_EFFECT_VOLUME)
         {
         RDebug::Printf("[TMS STIF] Volume, GetMaxLevel");
-        ret = static_cast<TMSVolumeEffect*>(iTmsDnlinkEffect)->GetMaxLevel(
+        ret = static_cast<TMSVolumeEffect*> (iTmsDnlinkEffect)->GetMaxLevel(
                 iMaxVolume);
         RDebug::Printf("[TMS STIF] MaxLevel [%d] Ret Error [%d]", iMaxVolume, ret);
         RDebug::Printf("[TMS STIF] Volume, SetLevel to MaxLevel [%d]", iMaxVolume);
-        ret = static_cast<TMSVolumeEffect*>(iTmsDnlinkEffect)->SetLevel(
+        ret = static_cast<TMSVolumeEffect*> (iTmsDnlinkEffect)->SetLevel(
                 iMaxVolume);
         RDebug::Printf("[TMS STIF] SetLevel Ret Error [%d]", ret);
         iLog->Log(_L("SetMaxVolume: %d"), iMaxVolume);
         RDebug::Printf("[TMS STIF] GetLevel");
-        ret = static_cast<TMSVolumeEffect*>(iTmsDnlinkEffect)->GetLevel(
+        ret = static_cast<TMSVolumeEffect*> (iTmsDnlinkEffect)->GetLevel(
                 iVolume);
         RDebug::Printf("[TMS STIF] Level [%d] Ret Error [%d]", iVolume, ret);
         if (iVolume != iMaxVolume)
@@ -1684,10 +1682,10 @@
             }
 
         RDebug::Printf("[TMS STIF] Volume, SetLevel to 0 ");
-        ret = static_cast<TMSVolumeEffect*>(iTmsDnlinkEffect)->SetLevel(0);
+        ret = static_cast<TMSVolumeEffect*> (iTmsDnlinkEffect)->SetLevel(0);
         RDebug::Printf("[TMS STIF] SetLevel Ret Error [%d]", ret);
         iLog->Log(_L("Mute Volume"));
-        ret = static_cast<TMSVolumeEffect*>(iTmsDnlinkEffect)->GetLevel(
+        ret = static_cast<TMSVolumeEffect*> (iTmsDnlinkEffect)->GetLevel(
                 iVolume);
         RDebug::Printf("[TMS STIF] Level [%d] Ret Error [%d]", iVolume, ret);
         if (iVolume != 0)
@@ -1699,34 +1697,34 @@
     else if (effecttype == TMS_EFFECT_GLOBAL_VOL)
         {
         RDebug::Printf("[TMS STIF] GLOBAL_VOL, Get Current Level");
-        ret = static_cast<TMSGlobalVolEffect*>(iGlobalVol)->GetLevel(iVolume);
+        ret = static_cast<TMSGlobalVolEffect*> (iGlobalVol)->GetLevel(iVolume);
         RDebug::Printf("[TMS STIF] Current Vol Level [%d] Ret Error [%d]", iVolume, ret);
         RDebug::Printf("[TMS STIF] GLOBAL_VOL, GetMaxLevel");
-        ret = static_cast<TMSGlobalVolEffect*>(iGlobalVol)->GetMaxLevel(
+        ret = static_cast<TMSGlobalVolEffect*> (iGlobalVol)->GetMaxLevel(
                 iMaxVolume);
         RDebug::Printf("[TMS STIF] MaxLevel [%d] Ret Error [%d]", iMaxVolume, ret);
         RDebug::Printf("[TMS STIF] GLOBAL_VOL, SetLevel to [%d]", iMaxVolume);
-        ret = static_cast<TMSGlobalVolEffect*>(iGlobalVol)->SetLevel(
+        ret = static_cast<TMSGlobalVolEffect*> (iGlobalVol)->SetLevel(
                 iMaxVolume);
         RDebug::Printf("[TMS STIF] SetLevel Ret Error [%d]", ret);
-        iLog->Log(_L("SetMaxGlobleVolume: %d"), iMaxVolume);
+        iLog->Log(_L("SetMaxGlobalVolume: %d"), iMaxVolume);
         RDebug::Printf("[TMS STIF] GLOBAL_VOL,GetLevel");
-        ret = static_cast<TMSGlobalVolEffect*>(iGlobalVol)->GetLevel(iVolume);
+        ret = static_cast<TMSGlobalVolEffect*> (iGlobalVol)->GetLevel(iVolume);
         RDebug::Printf("[TMS STIF] Expected Level [%d] Ret Level [%d] Ret Error [%d]", iMaxVolume, iVolume, ret);
-        iLog->Log(_L("GetMaxGlobleVolume: %d"), iVolume);
+        iLog->Log(_L("GetMaxGlobalVolume: %d"), iVolume);
         if (iVolume != iMaxVolume)
             {
-            iLog->Log(_L("GetGlobleVolume doesn't return expected MaxVolume!!! returned Volume = %d"), iVolume);
+            iLog->Log(_L("GetGlobalVolume doesn't return expected MaxVolume!!! returned Volume = %d"), iVolume);
             return KErrUnexpectedValue;
             }
 
-        static_cast<TMSGlobalVolEffect*>(iGlobalVol)->SetLevel(0);
-        iLog->Log(_L("Mute Globle Volume"));
-        static_cast<TMSGlobalVolEffect*>(iGlobalVol)->GetLevel(iVolume);
+        static_cast<TMSGlobalVolEffect*> (iGlobalVol)->SetLevel(0);
+        iLog->Log(_L("Mute Global Volume"));
+        static_cast<TMSGlobalVolEffect*> (iGlobalVol)->GetLevel(iVolume);
 
         if (iVolume != 0)
             {
-            iLog->Log(_L("GetGlobleVolume does not return expected Mute value!!! returned Volume = %d"), iVolume);
+            iLog->Log(_L("GetGlobalVolume does not return expected Mute value!!! returned Volume = %d"), iVolume);
             return KErrUnexpectedValue;
             }
         }
@@ -1808,7 +1806,8 @@
     return error;
     }
 
-TInt CTmsAudioServicesTestClass::AddGlobalRoutingObserver(CStifItemParser& /*aItem */)
+TInt CTmsAudioServicesTestClass::AddGlobalRoutingObserver(
+        CStifItemParser& /*aItem */)
     {
     iLog->Log(_L("CTmsAudioServicesTestClass::AddGlobalRoutingObserver"));
     TInt error = KErrNone;
@@ -1825,7 +1824,8 @@
     return error;
     }
 
-TInt CTmsAudioServicesTestClass::DeleteGlobalRoutingObserver(CStifItemParser& /*aItem*/)
+TInt CTmsAudioServicesTestClass::DeleteGlobalRoutingObserver(
+        CStifItemParser& /*aItem*/)
     {
     iLog->Log(_L("CTmsAu dioServicesTestClass::DeleteGlobalRoutingObserver"));
     TInt error = KErrNone;
@@ -1898,7 +1898,7 @@
             return error;
             }
 
-        AddExpectedEvent(ESetOutputComplete, KLongTimeout);
+        AddExpectedEvent(ESetOutputComplete, KShortTimeout);
         }
 
     return error;
@@ -2159,8 +2159,7 @@
             {
             if (iBitratesVector.size() > 0)
                 {
-                std::vector<guint>::iterator iBitrate =
-                        iBitratesVector.begin();
+                std::vector<guint>::iterator iBitrate = iBitratesVector.begin();
                 error = iTmsFormatUp -> SetBitRate(*iBitrate);
                 iLog->Log(_L("BR set %d"), *iBitrate);
                 }
@@ -2241,13 +2240,16 @@
     switch (iUpLinkCodec)
         {
         case TMS_FORMAT_G711:
-            error = static_cast<TMSG711Format*>(iTmsFormatUp)->GetVADMode(aVad);
+            error = static_cast<TMSG711Format*> (iTmsFormatUp)->GetVADMode(
+                    aVad);
             break;
         case TMS_FORMAT_G729:
-            error = static_cast<TMSG729Format*>(iTmsFormatUp)->GetVADMode(aVad);
+            error = static_cast<TMSG729Format*> (iTmsFormatUp)->GetVADMode(
+                    aVad);
             break;
         case TMS_FORMAT_ILBC:
-            error = static_cast<TMSILBCFormat*>(iTmsFormatUp)->GetVADMode(aVad);
+            error = static_cast<TMSILBCFormat*> (iTmsFormatUp)->GetVADMode(
+                    aVad);
             break;
         default:
             break;
@@ -2272,13 +2274,16 @@
     switch (iUpLinkCodec)
         {
         case TMS_FORMAT_G711:
-            error = static_cast<TMSG711Format*>(iTmsFormatUp)->SetVADMode(iVad);
+            error = static_cast<TMSG711Format*> (iTmsFormatUp)->SetVADMode(
+                    iVad);
             break;
         case TMS_FORMAT_G729:
-            error = static_cast<TMSG729Format*>(iTmsFormatUp)->SetVADMode(iVad);
+            error = static_cast<TMSG729Format*> (iTmsFormatUp)->SetVADMode(
+                    iVad);
             break;
         case TMS_FORMAT_ILBC:
-            error = static_cast<TMSILBCFormat*>(iTmsFormatUp)->SetVADMode(iVad);
+            error = static_cast<TMSILBCFormat*> (iTmsFormatUp)->SetVADMode(
+                    iVad);
             break;
         default:
             break;
@@ -2298,7 +2303,7 @@
         if ((linkType == KTagUplink) && (iUpLinkCodec == TMS_FORMAT_G711))
             {
             TMSG711CodecMode aMode;
-            static_cast<TMSG711Format*>(iTmsFormatUp)->GetMode(aMode);
+            static_cast<TMSG711Format*> (iTmsFormatUp)->GetMode(aMode);
 
             if (aMode == TMS_G711_CODEC_MODE_ALAW)
                 {
@@ -2317,7 +2322,7 @@
                 && (iUpLinkCodec == TMS_FORMAT_ILBC))
             {
             TMSILBCCodecMode aMode;
-            static_cast<TMSILBCFormat*>(iTmsFormatUp)->GetMode(aMode);
+            static_cast<TMSILBCFormat*> (iTmsFormatUp)->GetMode(aMode);
 
             if (aMode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
                 {
@@ -2336,7 +2341,7 @@
                 && (iDnLinkCodec == TMS_FORMAT_G711))
             {
             TMSG711CodecMode aMode;
-            static_cast<TMSG711Format*>(iTmsFormatDn)->GetMode(aMode);
+            static_cast<TMSG711Format*> (iTmsFormatDn)->GetMode(aMode);
 
             if (aMode == TMS_G711_CODEC_MODE_ALAW)
                 {
@@ -2355,7 +2360,7 @@
                 && (iDnLinkCodec == TMS_FORMAT_ILBC))
             {
             TMSILBCCodecMode aMode;
-            static_cast<TMSILBCFormat*>(iTmsFormatDn)->GetMode(aMode);
+            static_cast<TMSILBCFormat*> (iTmsFormatDn)->GetMode(aMode);
 
             if (aMode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
                 {
@@ -2398,56 +2403,56 @@
                 && (mode == KTagALaw))
             {
             iLog->Log(_L("UPL Mode Set: aLaw"));
-            static_cast<TMSG711Format*>(iTmsFormatUp)->SetMode(
+            static_cast<TMSG711Format*> (iTmsFormatUp)->SetMode(
                     TMS_G711_CODEC_MODE_ALAW);
             }
         else if ((linkType == KTagUplink)
                 && (iUpLinkCodec == TMS_FORMAT_G711) && (mode == KTagULaw))
             {
             iLog->Log(_L("UPL Mode Set: uLaw"));
-            static_cast<TMSG711Format*>(iTmsFormatUp)->SetMode(
+            static_cast<TMSG711Format*> (iTmsFormatUp)->SetMode(
                     TMS_G711_CODEC_MODE_MULAW);
             }
         else if ((linkType == KTagUplink)
                 && (iUpLinkCodec == TMS_FORMAT_ILBC) && (mode == KTag20ms))
             {
             iLog->Log(_L("UPL Mode Set: 20ms frame"));
-            static_cast<TMSILBCFormat*>(iTmsFormatUp)->SetMode(
+            static_cast<TMSILBCFormat*> (iTmsFormatUp)->SetMode(
                     TMS_ILBC_CODEC_MODE_20MS_FRAME);
             }
         else if ((linkType == KTagUplink)
                 && (iUpLinkCodec == TMS_FORMAT_ILBC) && (mode == KTag30ms))
             {
             iLog->Log(_L("UPL Mode Set: 30ms frame"));
-            static_cast<TMSILBCFormat*>(iTmsFormatUp)->SetMode(
+            static_cast<TMSILBCFormat*> (iTmsFormatUp)->SetMode(
                     TMS_ILBC_CODEC_MODE_30MS_FRAME);
             }
         else if ((linkType == KTagDnlink)
                 && (iDnLinkCodec == TMS_FORMAT_G711) && (mode == KTagALaw))
             {
             iLog->Log(_L("DNL Mode Set: aLaw"));
-            static_cast<TMSG711Format*>(iTmsFormatDn)->SetMode(
+            static_cast<TMSG711Format*> (iTmsFormatDn)->SetMode(
                     TMS_G711_CODEC_MODE_ALAW);
             }
         else if ((linkType == KTagDnlink)
                 && (iDnLinkCodec == TMS_FORMAT_G711) && (mode == KTagULaw))
             {
             iLog->Log(_L("DNL Mode Set: uLaw"));
-            static_cast<TMSG711Format*>(iTmsFormatDn)->SetMode(
+            static_cast<TMSG711Format*> (iTmsFormatDn)->SetMode(
                     TMS_G711_CODEC_MODE_MULAW);
             }
         else if ((linkType == KTagDnlink)
                 && (iDnLinkCodec == TMS_FORMAT_ILBC) && (mode == KTag20ms))
             {
             iLog->Log(_L("DNL Mode Set: 20ms frame"));
-            static_cast<TMSILBCFormat*>(iTmsFormatDn)->SetMode(
+            static_cast<TMSILBCFormat*> (iTmsFormatDn)->SetMode(
                     TMS_ILBC_CODEC_MODE_20MS_FRAME);
             }
         else if ((linkType == KTagDnlink)
                 && (iDnLinkCodec == TMS_FORMAT_ILBC) && (mode == KTag30ms))
             {
             iLog->Log(_L("DNL Mode Set: 30ms frame"));
-            static_cast<TMSILBCFormat*>(iTmsFormatDn)->SetMode(
+            static_cast<TMSILBCFormat*> (iTmsFormatDn)->SetMode(
                     TMS_ILBC_CODEC_MODE_30MS_FRAME);
             }
         else
@@ -2468,11 +2473,11 @@
     switch (iDnLinkCodec)
         {
         case TMS_FORMAT_G711:
-            error = static_cast<TMSG711Format*>(iTmsFormatDn)->GetCNG(aCng);
+            error = static_cast<TMSG711Format*> (iTmsFormatDn)->GetCNG(aCng);
             iLog->Log(_L("CNG: %d"), aCng);
             break;
         case TMS_FORMAT_ILBC:
-            error = static_cast<TMSILBCFormat*>(iTmsFormatDn)->GetCNG(aCng);
+            error = static_cast<TMSILBCFormat*> (iTmsFormatDn)->GetCNG(aCng);
             iLog->Log(_L("CNG: %d"), aCng);
             break;
         default:
@@ -2489,18 +2494,17 @@
 
 TInt CTmsAudioServicesTestClass::ToggleCNG(CStifItemParser & /*aItem*/)
     {
-
     iLog ->Log(_L("CTmsAudioServicesTestClass::ToggleCNG"));
     TInt error = KErrNone;
     iCng = (iCng) ? EFalse : ETrue;
     switch (iDnLinkCodec)
         {
         case TMS_FORMAT_G711:
-            static_cast<TMSG711Format*>(iTmsFormatDn)->SetCNG(iCng);
+            static_cast<TMSG711Format*> (iTmsFormatDn)->SetCNG(iCng);
             iLog->Log(_L("CNG set: %d"), iCng);
             break;
         case TMS_FORMAT_ILBC:
-            static_cast<TMSILBCFormat*>(iTmsFormatDn)->SetCNG(iCng);
+            static_cast<TMSILBCFormat*> (iTmsFormatDn)->SetCNG(iCng);
             iLog->Log(_L("CNG set: %d"), iCng);
             break;
         default:
@@ -2516,7 +2520,7 @@
     TBool aPlc = EFalse;
     if (iDnLinkCodec == TMS_FORMAT_G711)
         {
-        static_cast<TMSG711Format*>(iTmsFormatDn)->GetPlc(aPlc);
+        static_cast<TMSG711Format*> (iTmsFormatDn)->GetPlc(aPlc);
         iLog->Log(_L("PLC: %d"), aPlc);
         }
 
@@ -2536,7 +2540,7 @@
     iPlc = (iPlc) ? EFalse : ETrue;
     if (iDnLinkCodec == TMS_FORMAT_G711)
         {
-        error = static_cast<TMSG711Format*>(iTmsFormatDn)->SetPlc(iPlc);
+        error = static_cast<TMSG711Format*> (iTmsFormatDn)->SetPlc(iPlc);
         iLog->Log(_L("PLC set: %d"), iPlc);
         }
 
@@ -2560,9 +2564,7 @@
         {
         error = iTmsDnlink->AddSource(iTmsClientSource);
         }
-    iLog->Log(
-            _L("CTmsAudioServicesTestClass::AddClientSrcToDnlStream Error [%d]"),
-            error);
+    iLog->Log(_L("CTmsAudioServicesTestClass::AddClientSrcToDnlStream Error [%d]"), error);
     return error;
     }
 
@@ -2640,7 +2642,7 @@
     TInt error = KErrNone;
     if (iTmsClientSource)
         {
-        error = static_cast<TMSClientSource*>(iTmsClientSource)->AddObserver(
+        error = static_cast<TMSClientSource*> (iTmsClientSource)->AddObserver(
                 *this, NULL);
         }
     return error;
@@ -2653,8 +2655,7 @@
     TInt error = KErrNone;
     if (iTmsClientSource)
         {
-        error = static_cast<TMSClientSource*>(iTmsClientSource)->RemoveObserver(
-                *this);
+        error = static_cast<TMSClientSource*> (iTmsClientSource)->RemoveObserver(*this);
         }
     return error;
     }
@@ -2739,8 +2740,8 @@
     TInt error = KErrNone;
     if (iTmsUplink && iTmsClientSink)
         {
-        error = static_cast<TMSClientSink*>(iTmsClientSink)->AddObserver(*this,
-                NULL);
+        error = static_cast<TMSClientSink*> (iTmsClientSink)->AddObserver(
+                *this, NULL);
         }
     return error;
     }
@@ -2751,7 +2752,7 @@
     TInt error = KErrNone;
     if (iTmsUplink && iTmsClientSink)
         {
-        error = static_cast<TMSClientSink*>(iTmsClientSink)->RemoveObserver(
+        error = static_cast<TMSClientSink*> (iTmsClientSink)->RemoveObserver(
                 *this);
         }
     return error;
@@ -2766,30 +2767,29 @@
         status = iFactory->CreateEffect(TMS_EFFECT_VOLUME, iTmsDnlinkEffect);
         if (status == KErrNone)
             {
-            static_cast<TMSVolumeEffect*>(iTmsDnlinkEffect)->AddObserver(*this,
-                    NULL);
+            static_cast<TMSVolumeEffect*> (iTmsDnlinkEffect)->AddObserver(
+                    *this, NULL);
             }
         }
     RDebug::Printf("[TMS STIF] CreateVolumeEffect Return [%d]", status);
     return status;
     }
 
-gint CTmsAudioServicesTestClass::CreateVolumeGlobleEffect()
+gint CTmsAudioServicesTestClass::CreateVolumeGlobalEffect()
     {
-    iLog->Log(_L("CTmsAudioServicesTestClass::CreateVolumeGlobleEffect"));
+    iLog->Log(_L("CTmsAudioServicesTestClass::CreateVolumeGlobalEffect"));
     gint status(KErrNone);
     if (iFactory && !iGlobalVol)
         {
         status = iFactory->CreateEffect(TMS_EFFECT_GLOBAL_VOL, iGlobalVol);
-
         if (status == KErrNone)
             {
-            static_cast<TMSGlobalVolEffect*>(iGlobalVol)->AddObserver(*this,
+            static_cast<TMSGlobalVolEffect*> (iGlobalVol)->AddObserver(*this,
                     NULL);
-            iLog->Log(_L("CTmsAudioServicesTestClass::CreateVolumeGlobleEffect - AddObserver"));
+            iLog->Log(_L("CTmsAudioServicesTestClass::CreateVolumeGlobalEffect - AddObserver"));
             }
         }
-    RDebug::Printf("[TMS STIF] CreateVolumeGlobleEffect Return [%d]", status);
+    RDebug::Printf("[TMS STIF] CreateVolumeGlobalEffect Return [%d]", status);
     return status;
     }
 
@@ -2805,10 +2805,10 @@
     return error;
     }
 
-TInt CTmsAudioServicesTestClass::AddGlobleVolumeEffectToStream(
+TInt CTmsAudioServicesTestClass::AddGlobalVolumeEffectToStream(
         CStifItemParser& /*aItem*/)
     {
-    iLog->Log(_L("CTmsAudioServicesTestClass::AddGlobleVolumeEffectToStream"));
+    iLog->Log(_L("CTmsAudioServicesTestClass::AddGlobalVolumeEffectToStream"));
     TInt error = KErrNone;
     if (iTmsDnlink && iGlobalVol)
         {
@@ -2817,10 +2817,10 @@
     return error;
     }
 
-TInt CTmsAudioServicesTestClass::RemoveGlobleVolumeEffectToStream(
+TInt CTmsAudioServicesTestClass::RemoveGlobalVolumeEffectToStream(
         CStifItemParser& /*aItem*/)
     {
-    iLog->Log(_L("CTmsAudioServicesTestClass::RemoveGlobleVolumeEffectToStream"));
+    iLog->Log(_L("CTmsAudioServicesTestClass::RemoveGlobalVolumeEffectToStream"));
     TInt error = KErrNone;
     if (iTmsDnlink && iGlobalVol)
         {
@@ -2839,28 +2839,28 @@
         status = iFactory->CreateEffect(TMS_EFFECT_GAIN, iTmsUplinkEffect);
         if (status == KErrNone)
             {
-            static_cast<TMSGainEffect*>(iTmsUplinkEffect)->AddObserver(*this,
-                    NULL);
+            static_cast<TMSGainEffect*> (iTmsUplinkEffect)->AddObserver(
+                    *this, NULL);
             }
         }
     RDebug::Printf("[TMS STIF] CreateGainEffect Return [%d]", status);
     return status;
     }
 
-gint CTmsAudioServicesTestClass::CreateGlobleGainEffect()
+gint CTmsAudioServicesTestClass::CreateGlobalGainEffect()
     {
-    iLog->Log(_L("CTmsAudioServicesTestClass::CreateGlobleGainEffect"));
+    iLog->Log(_L("CTmsAudioServicesTestClass::CreateGlobalGainEffect"));
     gint status(KErrNone);
     if (iFactory && !iGlobalGain)
         {
         status = iFactory->CreateEffect(TMS_EFFECT_GLOBAL_GAIN, iGlobalGain);
         if (status == KErrNone)
             {
-            static_cast<TMSGlobalGainEffect*>(iGlobalGain)->AddObserver(*this,
-                    NULL);
+            static_cast<TMSGlobalGainEffect*> (iGlobalGain)->AddObserver(
+                    *this, NULL);
             }
         }
-    RDebug::Printf("[TMS STIF] CreateGlobleGainEffect Return [%d]", status);
+    RDebug::Printf("[TMS STIF] CreateGlobalGainEffect Return [%d]", status);
     return status;
     }
 
@@ -2876,10 +2876,10 @@
     return error;
     }
 
-TInt CTmsAudioServicesTestClass::AddGlobleGainEffectToStream(
+TInt CTmsAudioServicesTestClass::AddGlobalGainEffectToStream(
         CStifItemParser& /*aItem*/)
     {
-    iLog->Log(_L("CTmsAudioServicesTestClass::AddGlobleGainEffectToStream"));
+    iLog->Log(_L("CTmsAudioServicesTestClass::AddGlobalGainEffectToStream"));
     TInt error = KErrNone;
     if (iTmsUplink && iGlobalGain)
         {
@@ -2888,10 +2888,10 @@
     return error;
     }
 
-TInt CTmsAudioServicesTestClass::RemoveGlobleGainEffectToStream(
+TInt CTmsAudioServicesTestClass::RemoveGlobalGainEffectToStream(
         CStifItemParser& /*aItem*/)
     {
-    iLog->Log(_L("CTmsAudioServicesTestClass::RemoveGlobleGainEffectToStream"));
+    iLog->Log(_L("CTmsAudioServicesTestClass::RemoveGlobalGainEffectToStream"));
     TInt error = KErrNone;
     if (iTmsUplink && iGlobalGain)
         {
@@ -2925,12 +2925,12 @@
 
         Mem::Copy(desptr, srcptr, srcsize);
 
-        static_cast<TMSClientSource*>(iTmsClientSource)->BufferFilled(
+        static_cast<TMSClientSource*> (iTmsClientSource)->BufferFilled(
                 *iPlayBuf);
-        static_cast<TMSClientSink*>(iTmsClientSink)->BufferProcessed(iRecBuf);
+        static_cast<TMSClientSink*> (iTmsClientSink)->BufferProcessed(iRecBuf);
 
         iPlayBufReady = EFalse; // buf filled, ready for FillBuffer
-        iRecBufReady = EFalse; // buf consumed, ready for EmptyBuffer
+        iRecBufReady = EFalse;  // buf consumed, ready for EmptyBuffer
         }
 
     iLog->Log(_L("CTmsAudioServicesTestClass::DoLoopback END"));
--- a/mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/src/TmsAudioServicesTestClassBlocksCallbacks.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/src/TmsAudioServicesTestClassBlocksCallbacks.cpp	Tue May 11 16:42:02 2010 +0300
@@ -144,6 +144,7 @@
 void CTmsAudioServicesTestClass::EffectsEvent(const TMSEffect& tmseffect,
         TMSSignalEvent /*event*/)
     {
+    iLog->Log(_L("[tms cb]CTmsAudioServicesTestClass::EffectsEvent"));
     TMSEffectType effecttype;
     const_cast<TMSEffect&>(tmseffect).GetType(effecttype);
     switch (effecttype)
--- a/mmserv/metadatautility/Src/MetaDataParser.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataParser.cpp	Tue May 11 16:42:02 2010 +0300
@@ -19,13 +19,16 @@
 
 
 // INCLUDE FILES
-#include "MetaDataParser.h"
 #include <syslangutil.h>
 #include <languages.hrh>
 #include <TopCharacterSet.rsg>
 #include <data_caging_path_literals.hrh>
 #include <bautils.h>
 
+#include "MetaDataParser.h"
+#include "MetaDataSourceFile.h"
+#include "MetaDataFieldContainer.h"
+
 _LIT(KCharacterSetRscFile, "TopCharacterSet.rsc");
 
 // ============================ MEMBER FUNCTIONS ===============================
@@ -121,6 +124,10 @@
 TInt CMetaDataParser::UnicodeBOM(
 	const TDesC8& aUnicode )
 	{
+#ifdef _DEBUG
+     RDebug::Print(_L("CMetaDataParser::UnicodeBOM"));
+#endif
+    
 	TPtrC8 bomData( aUnicode.Left( 2 ) );
 
 	TBuf8<2> BEbom; // Big endian BOM
@@ -162,6 +169,10 @@
 //
 void CMetaDataParser::MapID3GenreToStringL(TInt aNum, TDes& aGenrePtr)
 {
+#ifdef _DEBUG
+     RDebug::Print(_L("CMetaDataParser::MapID3GenreToStringL"));
+#endif
+    
 	if(aNum < 0 || aNum > 125 && aNum != 199)
 		{
 		return;
@@ -560,6 +571,10 @@
 //
 void CMetaDataParser::MapID3GenreToStringL(TInt aNum, TDes8& aGenrePtr)
 {
+#ifdef _DEBUG
+     RDebug::Print(_L("CMetaDataParser::MapID3GenreToStringL"));
+#endif
+
 	if(aNum < 0 || aNum > 125 && aNum != 199)
 		{
 		return;
@@ -1242,4 +1257,46 @@
 		}
 	return EFalse;
 	}
+
+
+// -----------------------------------------------------------------------------
+// CMetaDataParser::CommonParseL
+// -----------------------------------------------------------------------------
+//
+void CMetaDataParser::CommonParseL(
+    CMetaDataSourceFile* aSource,
+    const RArray<TMetaDataFieldId>& aWantedFields,
+    CMetaDataFieldContainer& aContainer )
+    {
+#ifdef _DEBUG
+     RDebug::Print(_L("CMetaDataParser::CommonParseL"));
+#endif
+
+    GetProtectedL(aSource, aContainer);
+    ParseL(aWantedFields, aContainer);
+    }
+
+// -----------------------------------------------------------------------------
+// CMetaDataParser::GetProtectedL
+// -----------------------------------------------------------------------------
+//
+void CMetaDataParser::GetProtectedL( CMetaDataSourceFile* aSource,
+        CMetaDataFieldContainer& aContainer )
+    {
+#ifdef _DEBUG
+     RDebug::Print(_L("CMetaDataParser::GetProtectedL"));
+#endif
+
+    TBool fileProtected = aSource->FileProtected();
+    TBuf16<5> desc16;
+    desc16.AppendNum(fileProtected);
+
+    aContainer.AppendL( EMetaDataProtected, desc16 );
+    
+#ifdef _DEBUG
+     RDebug::Print(_L("CMetaDataParser::GetProtectedL, Protected=%S "), &desc16);
+#endif
+    
+    }
+
 //  End of File
--- a/mmserv/metadatautility/Src/MetaDataParser.h	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataParser.h	Tue May 11 16:42:02 2010 +0300
@@ -26,13 +26,14 @@
 #include <MetaDataField.hrh>
 #include <f32file.h>
 #include <charconv.h>
-#include "MetaDataID3v1Genre.h"
 #include <barsc.h>
 #include <barsread.h>
 
+#include "MetaDataID3v1Genre.h"
 
 // FORWARD DECLARATION
 class CMetaDataFieldContainer;
+class CMetaDataSourceFile;
 
 // CONSTANTS
 const TInt KUnicodeBOMNotFound		= 0;
@@ -97,7 +98,7 @@
         * @since 3.0
         * @return void
         */
-		void MapID3GenreToStringL(TInt aNum, TDes& aGenrePtr);
+		void MapID3GenreToStringL( TInt aNum, TDes& aGenrePtr );
 
 		/**
         * Maps ID3v2 genre integer to string
@@ -107,11 +108,33 @@
         * @return void
         */
 
-		void MapID3GenreToStringL(TInt aNum, TDes8& aGenrePtr);
+		void MapID3GenreToStringL( TInt aNum, TDes8& aGenrePtr );
 		void GenerateTopCharacterSetsL();
-		void SelectCharacterSetsForLanguageL(TInt aLanguage);
-		void ReadCharacterSetResourceL(TInt aResourceId);
-		TBool IsInTopCharacterSet(TUint aCharacterSetId);
+		void SelectCharacterSetsForLanguageL( TInt aLanguage );
+		void ReadCharacterSetResourceL( TInt aResourceId );
+		TBool IsInTopCharacterSet( TUint aCharacterSetId );
+
+		/**
+        * Parses the common metadata, the metadata fields are
+        * inserted into the container.
+        * @since 9.2
+        * @param aSource a Metadata source file.
+        * @param aWantedFields An array of TMetaDataFieldId's. Empty array is interpreted as all fields.
+        * @param aContainer On return, metadata found in aSource is stored here
+        * @return void
+        */
+        void CommonParseL( CMetaDataSourceFile* aSource,
+                const RArray<TMetaDataFieldId>& aWantedFields, 
+                CMetaDataFieldContainer& aContainer );
+
+        /**
+        * Append DRM Protected data to the container.
+        * @param aSource a Metadata source file.
+        * @param aContainer On return, metadata ptotected data is stored here
+        * @return void
+        */
+		void GetProtectedL( CMetaDataSourceFile* aSource,
+		        CMetaDataFieldContainer& aContainer );
 
     protected:
 
@@ -121,8 +144,8 @@
         * @param aDesc The original descriptor
         * @return Pointer to descriptor without whitespace
         */
-        TPtrC8 StripTrailingZeroes( const TDesC8& aDesc, TInt encoding = 0);
-        TPtrC StripTrailingZeroes( const TDesC& aDesc);
+        TPtrC8 StripTrailingZeroes( const TDesC8& aDesc, TInt encoding = 0 );
+        TPtrC StripTrailingZeroes( const TDesC& aDesc );
 
         /**
         * Returns BOM indication in the provided unicode.
--- a/mmserv/metadatautility/Src/MetaDataUtilityBody.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataUtilityBody.cpp	Tue May 11 16:42:02 2010 +0300
@@ -108,7 +108,7 @@
 	iParser = FindParserFileL(aFileName);
 	if ( iParser )
 		{
-		iParser->ParseL(aWantedFields, *iContainer);
+		iParser->CommonParseL((CMetaDataSourceFile*)iSource, aWantedFields, *iContainer);
 		}
 	}
 
@@ -130,7 +130,7 @@
 	iParser = FindParserFileL(aFile);
 	if ( iParser )
 		{
-		iParser->ParseL(aWantedFields, *iContainer);
+		iParser->CommonParseL((CMetaDataSourceFile*)iSource, aWantedFields, *iContainer);
 		}
 	}
 
@@ -152,7 +152,7 @@
 	iParser = FindParserDesL(aDes);
 	if ( iParser )
 		{
-		iParser->ParseL(aWantedFields, *iContainer);
+		iParser->CommonParseL((CMetaDataSourceFile*)iSource, aWantedFields, *iContainer);
 		}
 	}
 
@@ -467,10 +467,7 @@
 		{
 		User::Leave(KErrAlreadyExists);
 		}
-	
-	// iParser = FindParserFileL(aFileName);	
-		
-	if(KErrNone == IsSupportedMimeType(aMimeType))	
+		if(KErrNone == IsSupportedMimeType(aMimeType))	
 	{
 		iParser = FindParserFileL(aFileName, aMimeType);
 	}
@@ -481,7 +478,7 @@
 	
 	if ( iParser )
 	{
-		iParser->ParseL(aWantedFields, *iContainer);
+		iParser->CommonParseL((CMetaDataSourceFile*)iSource, aWantedFields, *iContainer);
 	}	
 	}
 // -----------------------------------------------------------------------------
@@ -501,8 +498,6 @@
 		User::Leave(KErrAlreadyExists);
 	}
 		
-	//iParser = FindParserFileL(aFile);	
-	
 	if(KErrNone == IsSupportedMimeType(aMimeType))	
 	{
 		iParser = FindParserFileL(aFile, aMimeType);
@@ -512,10 +507,9 @@
 		User::Leave(KErrNotSupported);		
 	}
 	
-	//iParser = FindParserFileL(aFile);
 	if ( iParser )
 	{
-		iParser->ParseL(aWantedFields, *iContainer);
+		iParser->CommonParseL((CMetaDataSourceFile*)iSource, aWantedFields, *iContainer);
 	}
 	}
 
@@ -703,7 +697,7 @@
 		}
 	if ( iParser )
 		{
-		iParser->ParseL(aWantedFields, *iContainer);
+		iParser->CommonParseL((CMetaDataSourceFile*)iSource, aWantedFields, *iContainer);
 		}
 	}	
 	
--- a/mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp	Tue May 11 16:42:02 2010 +0300
@@ -491,6 +491,8 @@
     {
     RADIO_RDEBUG_INT3(_L("[RADIO-SVR] TunerOnComplete(%d) State[%d] Trigger[%d]"), aError, iState, iTunerOnTrigger);
     TFourCC radioFourCC;
+    // TBool antennaStatus = iSettings->IsAntennaAttached();
+    
     switch ( iTunerOnTrigger )
         {
         case ETriggerTunerControl:
@@ -559,10 +561,13 @@
             if ( aError == KErrNone )
                 {
                 iState = EStateTunerOn;
-                // AK - begin: to cause publishing (CPHU-73YTQW)
-                iSettings->SetAntennaStatus(EFalse, EFalse);
-                // - end
-                iSettings->SetAntennaStatus(ETrue);
+                if ( iSettings->IsAntennaAttached() )
+                    {
+                    // AK - begin: to cause publishing (CPHU-73YTQW)
+                    iSettings->SetAntennaStatus(EFalse, EFalse);
+                    // - end
+                    iSettings->SetAntennaStatus(ETrue);
+                    }
                 }
             // else
                 // Unable to turn the tuner back on. It's possible that after TunerOn request
@@ -594,6 +599,14 @@
         default:
             break;
         }
+    
+    if ( iSettings->IsAntennaAttached() == EFalse )
+        {
+        // antenna removed during TunerOn sequence, request TunerOff
+        // can not shutdown totally in TunerOffComplete thus set iState to EStateTunerOff
+        iState = EStateTunerOff;
+        iTunerControl->TunerOff();    
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -648,13 +661,14 @@
                     CompleteAsyncRequest(aError);
                     }
                 }
+            else if( aError == KRadioServErrDuplicateRequest )
+                {
+                // tuner off and duplicate request going on, trace it out
+                RADIO_RDEBUG(_L("[RADIO-SVR] TunerOffComplete() - EStateTunerOff - KRadioServErrDuplicateRequest"));
+                }
             else
                 {
-                if( aError == KRadioServErrDuplicateRequest )
-                    {
-                    // tuner off and duplicate request going on, trace it out
-                    RADIO_RDEBUG(_L("[RADIO-SVR] TunerOffComplete() - EStateTunerOff - KRadioServErrDuplicateRequest"));
-                    }
+                RADIO_RDEBUG(_L("[RADIO-SVR] TunerOffComplete() - iState = EStateTunerOff;"));
                 }
             break;
         default:
--- a/mmserv/radioutility/radioserver/Server/Src/RadioServerShutdown.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/radioutility/radioserver/Server/Src/RadioServerShutdown.cpp	Tue May 11 16:42:02 2010 +0300
@@ -86,14 +86,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CRadioServerShutdown::DoCancel
-// -----------------------------------------------------------------------------
-//
-void CRadioServerShutdown::DoCancel()
-    {
-    }
-
-// -----------------------------------------------------------------------------
 // CRadioServerShutdown::RunL
 // -----------------------------------------------------------------------------
 //
--- a/mmserv/radioutility/radioserver/Server/Src/RadioServerShutdown.h	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/radioutility/radioserver/Server/Src/RadioServerShutdown.h	Tue May 11 16:42:02 2010 +0300
@@ -58,12 +58,6 @@
 
 	/**
 	 * From CTimer
-	 * Cancel the shutdown timer.
-	 */
-	void DoCancel();
-
-	/**
-	 * From CTimer
 	 * Timer has expired, stop the RadioServer.
 	 **/
 	void RunL();
--- a/mmserv/thumbnailengine/TneAPISrc/HXTneserver.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/thumbnailengine/TneAPISrc/HXTneserver.cpp	Tue May 11 16:42:02 2010 +0300
@@ -21,6 +21,8 @@
 #include"HXTneclientservercommon.h"
 #include <flogger.h>
 #include <f32file64.h>
+#include <e32math.h> // Sqrt
+#include <stdlib.h> // abs
 static const TInt kDefaultStack = 0x4000;
 
 
@@ -57,7 +59,7 @@
 
 
 
-const TInt KMaxPacketToDecode = 32;
+const TInt KMaxPacketToDecode = 160; // Many clips begin with several seconds of logos / MPAA rating which need to be skipped
 
 //////////////Server///////////////
 
@@ -688,51 +690,126 @@
         }
 }
 
+/* Determines whether a frame contains sufficient data to be considered an useful frame.
+ * The logic scans a set of pixels to confirm:
+ * too bright or too dark pixels are not taken into account. Only mid brightness pixels will be considered
+ * if less than minSamples valid samples the frame is rejected. 
+ * if the mode is more frequent than maxModePrct% the frame is rejected. This is useful to reject the MPAA rating or other simple logos
+ * if the contrast is too low (max - min) frame is rejected
+ * if the standard deviation is too low frame is rejected.
+ */
+
 TBool CTneSession::IsGoodFrame(TUint8* aYUVDataPtr)
 {
-	
  	TInt i;
+    TInt ySize = iWidth*iHeight; 
+    TUint8 * resetYUVPtr = aYUVDataPtr;
+
+    // only these luminances are taken into account
+    TInt minSamples = 5;
+    TInt tooDark = 30;
+    TInt tooBright = 240;
+
+    // Defines how much data we analyze from the image to analyze its validity
+    TInt pixelSkips = iHeight;  // scans about 1 to 3 pixels per line depending on aspect ratio 
+
+    // average luminance profiling
+    TInt runningSum = 0;
+    TInt numberOfSamples = 0;
+    TInt averageValue = 0;
+
+    // contrast profiling
     TInt minValue = 255;
     TInt maxValue = 0;
+    TInt minMaxDeltaThreshold = 20;
+
+    // mode profiling
+    int mode = 0;
+    int modeSamples = 0;
+    int histogram[255] = {0};
+    int maxModePrct = 69;
+
+    // standard deviation profiling
+    TInt minStdDeviation = 5;
+    TUint32 residualsum = 0;
+    TReal stdDeviation = 0;
+
+    // Exit value
     TBool goodFrame = ETrue;
-    TInt runningSum=0;
-    TInt averageValue=0;
-    TInt pixelSkips = 4;
-    TInt numberOfSamples=0;
-    TInt minMaxDeltaThreshold = 20; 
-    TInt extremeRegionThreshold = 20; 
-    TInt ySize = iWidth*iHeight; 
-    
-    // gather image statistics
-    for(i=0, numberOfSamples=0; i<ySize; i+=pixelSkips, aYUVDataPtr+=pixelSkips, numberOfSamples++)
+
+    for(i=0, numberOfSamples=0; i<ySize; i+=pixelSkips, aYUVDataPtr+=pixelSkips)
     {
-        
-        
-        runningSum += *aYUVDataPtr;
-        if(*aYUVDataPtr > maxValue)
-            maxValue = *aYUVDataPtr;
-        if(*aYUVDataPtr < minValue)
-            minValue = *aYUVDataPtr;
+        if ( (*aYUVDataPtr>tooDark) && (*aYUVDataPtr<tooBright) )
+        {
+            runningSum += *aYUVDataPtr;
+            if(*aYUVDataPtr > maxValue)
+                maxValue = *aYUVDataPtr;
+            if(*aYUVDataPtr < minValue)
+                minValue = *aYUVDataPtr;
+            histogram[*aYUVDataPtr]++;
+            numberOfSamples++;
+        }
+    }
+
+    if (numberOfSamples < minSamples)
+    {
+        //FLOG(_L("CTneSession::IsGoodFrame too few good samples"));
+        goodFrame = EFalse;
     }
-    //VDASSERT(numberOfSamples,10);
-    if (numberOfSamples == 0)
+    else
     {
-        FLOG(_L("CTneSession::IsGoodFrame numberOfSamples is zero")); 
-    }
-    else 
-    {
-        averageValue = runningSum/numberOfSamples;
-    }
+        // Find the mode
+        for (i=0; i<255; i++)
+        {
+            if (histogram[i] > modeSamples)
+            {
+                modeSamples = histogram[i];
+                mode = i;
+            }
+        }
+        // Add the mode and most immediate values, as compression may add artifacts that disperse its value
+        for (i = mode-2, modeSamples = 0; i < mode+3; i++)
+        {
+            modeSamples += histogram[i];
+        }
     
-    // make decision based statistics
-    if((maxValue - minValue) < minMaxDeltaThreshold)
-        goodFrame = EFalse;
-    else 
-    {
-        if(averageValue < (minValue + extremeRegionThreshold) || 
-            averageValue > (maxValue - extremeRegionThreshold))
-            goodFrame = EFalse;
+        if (modeSamples * 100 / numberOfSamples > maxModePrct)
+        {
+            //FLOG(_L("Mode (%d) in over %d%% of the image\n", mode, modeSamples * 100 / numberOfSamples);
+            goodFrame = false;
+        }
+        else 
+        {
+            averageValue = runningSum / numberOfSamples;
+            // Rescan the frame now that we the average value is known
+            aYUVDataPtr = resetYUVPtr;
+    
+    
+            // Calculate the sum of residuals: (pixel - avgpixel)^2
+            for(i=0; i<ySize; i+=pixelSkips, aYUVDataPtr+=pixelSkips)
+            {
+                if ( (*aYUVDataPtr>tooDark) && (*aYUVDataPtr<tooBright) )
+                {
+                    residualsum += (*aYUVDataPtr - averageValue) * (*aYUVDataPtr - averageValue);
+                }
+            }
+    
+            // Get the standard deviation
+            Math::Sqrt(stdDeviation , residualsum / numberOfSamples);
+    
+            if (stdDeviation < minStdDeviation)
+            {
+                //FLOG(_L("CTneSession::IsGoodFrame too low StdDeviation: %f"), stdDeviation);
+                goodFrame = EFalse;
+            }
+            else if((maxValue - minValue) < minMaxDeltaThreshold)
+            {
+                //FLOG(_L("CTneSession::IsGoodFrame too little difference between brightest and darkest pixel"));
+                goodFrame = EFalse;
+            }
+        }
     }
+
     return goodFrame;
 }
 
--- a/mmserv/tms/inc/tmsbufferimpl.h	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/inc/tmsbufferimpl.h	Tue May 11 16:42:02 2010 +0300
@@ -29,13 +29,9 @@
 class TMSBufferImpl
     {
 public:
-    ~TMSBufferImpl();
     IMPORT_C static gint Create(TMSBufferType ctype, guint size,
             TMSBuffer*& tmsbuffer);
     IMPORT_C static gint Delete(TMSBuffer*& tmsbuffer);
-
-private:
-    TMSBufferImpl();
     };
 
 } //namespace TMS
--- a/mmserv/tms/inc/tmseffectimpl.h	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/inc/tmseffectimpl.h	Tue May 11 16:42:02 2010 +0300
@@ -29,13 +29,9 @@
 class TMSEffectImpl
     {
 public:
-    ~TMSEffectImpl();
     IMPORT_C static gint Create(TMSEffectType effecttype,
             TMSEffect*& tmseffect);
     IMPORT_C static gint Delete(TMSEffect*& tmseffect);
-
-private:
-    TMSEffectImpl();
     };
 
 } //namespace TMS
--- a/mmserv/tms/inc/tmsformatimpl.h	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/inc/tmsformatimpl.h	Tue May 11 16:42:02 2010 +0300
@@ -30,15 +30,9 @@
 class TMSFormatImpl : public TMSFormat
     {
 public:
-    virtual ~TMSFormatImpl();
     IMPORT_C static gint Create(TMSFormatType formattype,
             TMSFormat*& tmsformat);
     IMPORT_C static gint Delete(TMSFormat*& tmsformat);
-
-    gint SetProxy(TMSCallProxy* aProxy, gpointer queuehandler);
-
-private:
-    TMSFormatImpl();
     };
 
 } //namespace TMS
--- a/mmserv/tms/inc/tmssinkimpl.h	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/inc/tmssinkimpl.h	Tue May 11 16:42:02 2010 +0300
@@ -29,12 +29,8 @@
 class TMSSinkImpl
     {
 public:
-    ~TMSSinkImpl();
     IMPORT_C static gint Create(TMSSinkType sinktype, TMSSink*& tmssink);
     IMPORT_C static gint Delete(TMSSink*& tmssink);
-
-private:
-    TMSSinkImpl();
     };
 
 } //namespace TMS
--- a/mmserv/tms/tmscallserver/group/tmscallserver.mmp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmscallserver/group/tmscallserver.mmp	Tue May 11 16:42:02 2010 +0300
@@ -35,23 +35,23 @@
 
 SOURCE          tmscallserver.cpp
 SOURCE          tmscallsrvrstart.cpp
-SOURCE          delaytimer.cpp
+SOURCE          tmsdelaytimer.cpp
 SOURCE          tmscallsession.cpp
-SOURCE          calladpt.cpp
-SOURCE          callcsadpt.cpp
-SOURCE          callipadpt.cpp
-SOURCE          ipcallstreambase.cpp
+SOURCE          tmscalladpt.cpp
+SOURCE          tmscallcsadpt.cpp
+SOURCE          tmscallipadpt.cpp
+SOURCE          tmsipcallstreambase.cpp
 #ifdef __USE_GSTREAMER__
-SOURCE          ipcalldownlink.cpp
-SOURCE          ipcalluplink.cpp
+SOURCE          tmsipcalldownlink.cpp
+SOURCE          tmsipcalluplink.cpp
 #else //__USE_GSTREAMER__
-SOURCE          ipcalldownlinkds.cpp
-SOURCE          ipcalluplinkds.cpp
+SOURCE          tmsipcalldownlinkds.cpp
+SOURCE          tmsipcalluplinkds.cpp
 #endif //__USE_GSTREAMER__
-SOURCE          cspdevsound.cpp
-SOURCE          csdownlink.cpp
-SOURCE          csuplink.cpp
-SOURCE          tarsettings.cpp
+SOURCE          tmscsdevsound.cpp
+SOURCE          tmscsdownlink.cpp
+SOURCE          tmscsuplink.cpp
+SOURCE          tmstarsettings.cpp
 
 USERINCLUDE     ../inc
 USERINCLUDE     ../../inc
--- a/mmserv/tms/tmscallserver/inc/calladpt.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef CALLADPT_H
-#define CALLADPT_H
-
-#include <e32base.h>
-#include <tms.h>
-
-namespace TMS {
-
-// TMSCallAdpt class
-class TMSCallAdpt
-    {
-public:
-    static gint CreateCallL(gint callType, TMSCallAdpt*& callAdpt);
-    virtual ~TMSCallAdpt();
-    virtual gint CreateStream(TMSCallType callType,
-            TMSStreamType strmType, gint& outStrmId) = 0;
-    virtual gint InitStreamL(TMSCallType callType,
-            TMSStreamType strmType, gint strmId, TMSFormatType frmtType,
-            const RMessage2& aMessage) = 0;
-    virtual gint StartStream(TMSCallType callType,
-            TMSStreamType strmType, gint strmId) = 0;
-    virtual gint PauseStream(TMSCallType callType,
-            TMSStreamType strmType, gint strmId) = 0;
-    virtual gint StopStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId) = 0;
-    virtual gint DeinitStream(TMSCallType callType,
-            TMSStreamType strmType, gint strmId) = 0;
-    virtual gint DeleteStream(TMSCallType callType,
-            TMSStreamType strmType, gint strmId) = 0;
-    virtual gint DataXferBufferEmptied(TMSCallType callType,
-            TMSStreamType strmType, gint strmId) = 0;
-    virtual gint DataXferBufferFilled(TMSCallType callType,
-            TMSStreamType strmType, gint strmId, guint datasize) = 0;
-    virtual gint GetDataXferBufferHndl(const TMSCallType callType,
-            const TMSStreamType strmType, const gint strmId,
-            const guint32 key, RChunk& chunk) = 0;
-
-    virtual gint GetMaxVolume(guint& volume) = 0;
-    virtual gint SetVolume(const guint volume) = 0;
-    virtual gint GetVolume(guint& volume) = 0;
-    virtual gint GetMaxGain(guint& gain) = 0;
-    virtual gint SetGain(const guint gain) = 0;
-    virtual gint GetGain(guint& gain) = 0;
-    virtual gint GetGlobalMaxVolume(guint& volume) = 0;
-    virtual gint SetGlobalVolume(const guint volume) = 0;
-    virtual gint GetGlobalVolume(guint& volume) = 0;
-    virtual gint GetGlobalMaxGain(guint& gain) = 0;
-    virtual gint SetGlobalGain(const guint gain) = 0;
-    virtual gint GetGlobalGain(guint& gain) = 0;
-
-    virtual gint GetCodecMode(const TMSFormatType fmttype,
-            const TMSStreamType strmtype, gint& mode) = 0;
-    virtual gint SetCodecMode(const TMSFormatType fmttype,
-            const TMSStreamType strmtype, const gint mode) = 0;
-    virtual gint GetSupportedBitRatesCount(guint& count) = 0;
-    virtual gint GetSupportedBitRates(CBufFlat*& brbuffer) = 0;
-    virtual gint GetBitRate(guint& bitrate) = 0;
-    virtual gint SetBitRate(const guint bitrate) = 0;
-    virtual gint GetVAD(const TMSFormatType fmttype, gboolean& vad) = 0;
-    virtual gint SetVAD(const TMSFormatType fmttype, const gboolean vad) = 0;
-    virtual gint GetCNG(const TMSFormatType fmttype, gboolean& cng) = 0;
-    virtual gint SetCNG(const TMSFormatType fmttype, const gboolean cng) = 0;
-    virtual gint GetPlc(const TMSFormatType fmttype, gboolean& plc) = 0;
-    virtual gint SetPlc(const TMSFormatType fmttype, const gboolean plc) = 0;
-    virtual gint SetOutput(TMSAudioOutput output) = 0;
-    virtual gint GetOutput(TMSAudioOutput& output) = 0;
-    virtual gint GetPreviousOutput(TMSAudioOutput& output) = 0;
-    virtual gint GetAvailableOutputsL(gint& count,
-            CBufFlat*& outputsbuffer) = 0;
-
-protected:
-    TMSCallAdpt();
-    virtual gint PostConstruct();
-
-protected:
-    gint iGlobalVol;
-    gint iGlobalGain;
-    };
-
-} //namespace TMS
-
-#endif // CALLADPT_H
-
-// End of file
--- a/mmserv/tms/tmscallserver/inc/callcsadpt.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef CALLCSADPT_H
-#define CALLCSADPT_H
-
-#include <TelephonyAudioRouting.h>
-#include <MTelephonyAudioRoutingObserver.h>
-#include <e32msgqueue.h>
-#include "tmsclientserver.h"
-#include "calladpt.h"
-#include "mcspdevsoundobserver.h"
-
-namespace TMS {
-
-// FORWARD DECLARATIONS
-class TMSCSUplink;
-class TMSCSDownlink;
-class TMSTarSettings;
-
-/*
- * CallCSAdapt class
- */
-class TMSCallCSAdpt : public TMSCallAdpt,
-                      public TMSCSPDevSoundObserver,
-                      public MTelephonyAudioRoutingObserver
-    {
-public:
-    TMSCallCSAdpt();
-    virtual ~TMSCallCSAdpt();
-    virtual gint PostConstruct();
-
-    virtual gint CreateStream(TMSCallType callType, TMSStreamType strmType,
-            gint& outStrmId);
-    virtual gint InitStreamL(TMSCallType callType, TMSStreamType strmType,
-            gint strmId, TMSFormatType frmtType, const RMessage2& aMessage);
-    virtual gint StartStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint PauseStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint StopStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint DeinitStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint DeleteStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint DataXferBufferEmptied(TMSCallType callType,
-            TMSStreamType strmType, gint strmId);
-    virtual gint DataXferBufferFilled(TMSCallType callType,
-            TMSStreamType strmType, gint strmId, guint datasize);
-    virtual gint GetDataXferBufferHndl(const TMSCallType callType,
-            const TMSStreamType strmType, const gint strmId,
-            const guint32 key, RChunk& chunk);
-    virtual gint GetMaxVolume(guint& volume);
-    virtual gint SetVolume(const guint volume);
-    virtual gint GetVolume(guint& volume);
-    virtual gint GetMaxGain(guint& gain);
-    virtual gint SetGain(const guint gain);
-    virtual gint GetGain(guint& gain);
-    virtual gint GetGlobalMaxVolume(guint& volume);
-    virtual gint SetGlobalVolume(const guint volume);
-    virtual gint GetGlobalVolume(guint& volume);
-    virtual gint GetGlobalMaxGain(guint& gain);
-    virtual gint SetGlobalGain(const guint gain);
-    virtual gint GetGlobalGain(guint& gain);
-
-    virtual gint GetCodecMode(const TMSFormatType fmttype,
-            const TMSStreamType strmtype, gint& mode);
-    virtual gint SetCodecMode(const TMSFormatType fmttype,
-            const TMSStreamType strmtype, const gint mode);
-    virtual gint GetSupportedBitRatesCount(guint& count);
-    virtual gint GetSupportedBitRates(CBufFlat*& brbuffer);
-    virtual gint GetBitRate(guint& bitrate);
-    virtual gint SetBitRate(const guint bitrate);
-    virtual gint GetVAD(const TMSFormatType fmttype, gboolean& vad);
-    virtual gint SetVAD(const TMSFormatType fmttype, const gboolean vad);
-    virtual gint GetCNG(const TMSFormatType fmttype, gboolean& cng);
-    virtual gint SetCNG(const TMSFormatType fmttype, const gboolean cng);
-    virtual gint GetPlc(const TMSFormatType fmttype, gboolean& plc);
-    virtual gint SetPlc(const TMSFormatType fmttype, const gboolean plc);
-
-    virtual gint SetOutput(TMSAudioOutput output);
-    virtual gint GetOutput(TMSAudioOutput& output);
-    virtual gint GetPreviousOutput(TMSAudioOutput& output);
-    virtual gint GetAvailableOutputsL(gint& count, CBufFlat*& outputsbuffer);
-
-    void NotifyClient(const gint strmId, const gint aCommand,
-            const gint aStatus = KErrNone, const gint64 aInt64 = TInt64(0));
-
-    //From TMSCSPDevSoundObserver
-    void DownlinkInitCompleted(TInt status);
-    void UplinkInitCompleted(TInt status);
-    void UplinkActivatedSuccessfully();
-    void DownlinkActivatedSuccessfully();
-    void UplinkActivationFailed();
-    void DownlinkActivationFailed();
-
-protected:
-    void AvailableOutputsChanged(
-            CTelephonyAudioRouting& aTelephonyAudioRouting);
-    void OutputChanged(CTelephonyAudioRouting& aTelephonyAudioRouting);
-    void SetOutputComplete(CTelephonyAudioRouting& aTelephonyAudioRouting,
-            gint aError);
-    void GetSupportedBitRatesL(CBufFlat*& brbuffer);
-
-private:
-    gint iNextStreamId;
-
-    TMSCSUplink* iCSUplink;
-    TMSCSDownlink* iCSDownlink;
-    CTelephonyAudioRouting* iRouting;
-    TMSTarSettings* iTarSettings;
-    TMSStreamType iStrmtype;
-
-    RMsgQueue<TmsMsgBuf> iMsgQueueUp;
-    RMsgQueue<TmsMsgBuf> iMsgQueueDn;
-    TmsMsgBuf iMsgBuffer;
-
-    gboolean iUplinkInitialized;
-    gint iUplinkStreamId;
-    gboolean iDnlinkInitialized;
-    gint iDnlinkStreamId;
-    };
-
-} //namespace TMS
-
-#endif // CALLCSADPT_H
-
-// End of file
--- a/mmserv/tms/tmscallserver/inc/callipadpt.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef __CALLIPADAPT_H
-#define __CALLIPADAPT_H
-
-// INCLUDES
-#include <e32msgqueue.h>
-#include <mmcccodecinformation.h>
-#include "tmsclientserver.h"
-#include "tmsshared.h"
-#include "calladpt.h"
-
-namespace TMS {
-
-// FORWARD DECLARATIONS
-class TMSIPDownlink;
-class TMSIPUplink;
-
-// TMSCallIPAdpt class
-class TMSCallIPAdpt : public TMSCallAdpt
-    {
-public:
-    // Constractor
-    static TMSCallIPAdpt* NewL();
-
-    virtual ~TMSCallIPAdpt();
-    virtual gint PostConstruct();
-
-    virtual gint CreateStream(TMSCallType callType, TMSStreamType strmType,
-            gint& outStrmId);
-    virtual gint InitStreamL(TMSCallType callType, TMSStreamType strmType,
-            gint strmId, TMSFormatType frmtType, const RMessage2& aMessage);
-    virtual gint StartStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint PauseStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint StopStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint DeinitStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint DeleteStream(TMSCallType callType, TMSStreamType strmType,
-            gint strmId);
-    virtual gint DataXferBufferEmptied(TMSCallType callType,
-            TMSStreamType strmType, gint strmId);
-    virtual gint DataXferBufferFilled(TMSCallType callType,
-            TMSStreamType strmType, gint strmId, guint datasize);
-    virtual gint GetDataXferBufferHndl(const TMSCallType callType,
-            const TMSStreamType strmType, const gint strmId,
-            const guint32 key, RChunk& chunk);
-
-    virtual gint GetMaxVolume(guint& volume);
-    virtual gint SetVolume(const guint volume);
-    virtual gint GetVolume(guint& volume);
-    virtual gint GetMaxGain(guint& gain);
-    virtual gint SetGain(const guint gain);
-    virtual gint GetGain(guint& gain);
-    virtual gint GetGlobalMaxVolume(guint& volume);
-    virtual gint SetGlobalVolume(const guint volume);
-    virtual gint GetGlobalVolume(guint& volume);
-    virtual gint GetGlobalMaxGain(guint& gain);
-    virtual gint SetGlobalGain(const guint gain);
-    virtual gint GetGlobalGain(guint& gain);
-
-    virtual gint GetCodecMode(const TMSFormatType fmttype,
-            const TMSStreamType strmtype, gint& mode);
-    virtual gint SetCodecMode(const TMSFormatType fmttype,
-            const TMSStreamType strmtype, const gint mode);
-    virtual gint GetSupportedBitRatesCount(guint& count);
-    virtual gint GetSupportedBitRates(CBufFlat*& brbuffer);
-    virtual gint GetBitRate(guint& bitrate);
-    virtual gint SetBitRate(const guint bitrate);
-    virtual gint GetVAD(const TMSFormatType fmttype, gboolean& vad);
-    virtual gint SetVAD(const TMSFormatType fmttype, const gboolean vad);
-    virtual gint GetCNG(const TMSFormatType fmttype, gboolean& cng);
-    virtual gint SetCNG(const TMSFormatType fmttype, const gboolean cng);
-    virtual gint GetPlc(const TMSFormatType fmttype, gboolean& plc);
-    virtual gint SetPlc(const TMSFormatType fmttype, const gboolean plc);
-
-    virtual gint SetOutput(TMSAudioOutput output);
-    virtual gint GetOutput(TMSAudioOutput& output);
-    virtual gint GetPreviousOutput(TMSAudioOutput& output);
-    virtual gint GetAvailableOutputsL(TInt& count, CBufFlat*& outputsbuffer);
-
-    gint SetIlbcCodecMode(const gint mode, const TMSStreamType strmtype);
-    gint GetIlbcCodecMode(gint& mode, const TMSStreamType strmtype);
-    gint SetG711CodecMode(const gint mode, const TMSStreamType strmtype);
-    gint GetG711CodecMode(gint& mode, const TMSStreamType strmtype);
-    gint FrameModeRqrdForEC(gboolean& frmodereq);
-    gint SetFrameMode(const gboolean frmode);
-    gint GetFrameMode(gboolean& frmode);
-    gint ConcealErrorForNextBuffer();
-    gint BadLsfNextBuffer();
-
-    gint OpenDownlinkL(const RMessage2& aMessage);
-    gint OpenUplinkL(const RMessage2& aMessage);
-    void SetFormat(const gint strmId, const TUint32 aFormat);
-
-    void BufferFilledL(TUint dataSize);
-    void BufferEmptiedL();
-    gint GetDataXferChunkHndl(const TMSStreamType strmType,
-            const TUint32 key, RChunk& chunk);
-
-private:
-    void ConstructL();
-    TMSCallIPAdpt();
-
-    void NotifyClient(const gint strmId, const TInt aCommand,
-            const TInt aStatus = KErrNone, const TInt64 aInt64 = TInt64(0));
-    //void DetermineG711FrameRateL(); //G711 10/20ms
-    void GetSupportedBitRatesL(CBufFlat*& brbuffer);
-
-private:
-    gint iNextStreamId;
-    gboolean iUplinkInitialized;
-    gint iUplinkStreamId;
-    gboolean iDnlinkInitialized;
-    gint iDnlinkStreamId;
-
-    TMSIPDownlink* iIPDownlink;
-    TMSIPUplink* iIPUplink;
-
-    // Message queues for communication and data transfer back to the client
-    RMsgQueue<TmsMsgBuf> iMsgQueueUp;
-    RMsgQueue<TmsMsgBuf> iMsgQueueDn;
-
-    TmsMsgBuf iMsgBuffer;
-    TMMFPrioritySettings iPriority;
-    TUint32 iUpFourCC;
-    TUint32 iDnFourCC;
-    TInt iMaxVolume;
-    TInt iMaxGain;
-    RArray<TUint> iArrBitrates;
-    RArray<TFourCC> iCodecs;
-    TInt iCodecsCount;
-
-    };
-
-} //namespace TMS
-
-#endif //__CALLIPADAPT_H
-
-// End of file
--- a/mmserv/tms/tmscallserver/inc/csdownlink.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef CSDownlink_H
-#define CSDownlink_H
-
-#include <glib.h>
-#include "cspdevsound.h"
-
-namespace TMS {
-
-//
-class TMSCSPDevSoundObserver;
-
-/**
- *  Provides Downlink functionality.
- *
- */
-NONSHARABLE_CLASS(TMSCSDownlink) : public TMSCSPDevSound
-    {
-public:
-
-    static TMSCSDownlink* NewL(TMSCSPDevSoundObserver& aObserver);
-
-    virtual ~TMSCSDownlink();
-
-    /**
-     * Sets volume.
-     * @param aVolume Volume.
-     */
-    void SetVolume(gint aVolume);
-
-    /**
-     * Gets volume.
-     * @return Current volume.
-     */
-    gint Volume();
-
-    /**
-     * Gets max volume.
-     * @return Current volume.
-     */
-    gint MaxVolume();
-
-    // from base class MDevSoundObserver
-
-    /**
-     * From MDevSoundObserver.
-     * Indication from devsound that stream (Downlink) has been activated
-     * successfully.
-     */
-    void BufferToBeFilled(CMMFBuffer* /*aBuffer*/);
-
-    /**
-     * From MDevSoundObserver.
-     * Indication from devsound that activation of stream( Downlink)
-     * failed.
-     */
-    void PlayError(TInt aErrorCode);
-
-private:
-
-    /**
-     * From CSPDevSound.
-     * Tries to activate the mic stream.
-     */
-    void DoActivateL();
-
-protected:
-
-    TMSCSDownlink(TMSCSPDevSoundObserver& aObserver);
-
-    void ConstructL();
-    };
-
-} //namespace TMS
-
-#endif // CSDownlink_H
--- a/mmserv/tms/tmscallserver/inc/cspdevsound.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef CSPDEVSOUND_H
-#define CSPDEVSOUND_H
-
-#include <sounddevice.h>
-
-namespace TMS {
-
-class TMSCSPDevSoundObserver;
-
-/**
- *  Wrapper for CMMFDevSound
- *
- */
-NONSHARABLE_CLASS(TMSCSPDevSound) : public CBase,
-                                    public MDevSoundObserver
-    {
-public:
-
-    /**
-     * Destructor.
-     */
-    virtual ~TMSCSPDevSound();
-
-    /**
-     * Activates the dev sound stream. TMSCSPDevSoundObserver methods are called
-     * when activation goes ok or fails. If the stream is already active or
-     * activating then nothing is done.
-     */
-    virtual void Activate();
-
-    /**
-     * Deactivates the devsound stream. If stream is not active or
-     * activation is not ongoing then nothing is done.
-     */
-    virtual void Deactivate();
-
-    /**
-     * Indicates that activation is ongoing,
-     * but the result of the activation is still unknown.
-     * @return ETrue - activation ongoing, EFalse - activation not ongoing.
-     */
-    TBool IsActivationOngoing() const;
-
-    /**
-     * Determines wether the devsound stream is active or not.
-     * @return ETrue - Stream is active, EFalse - Stream not active.
-     */
-    TBool IsActive() const;
-
-    CMMFDevSound& DevSound();
-
-    // from base class MDevSoundObserver
-
-    /**
-     * From MDevSoundObserver
-     * Empty implementation
-     */
-    void InitializeComplete(TInt aError);
-
-    /**
-     * From MDevSoundObserver
-     * Empty implementation
-     */
-    void BufferToBeFilled(CMMFBuffer* aBuffer);
-
-    /**
-     * From MDevSoundObserver
-     * Empty implementation
-     */
-    void PlayError(TInt aError);
-
-    /**
-     * From MDevSoundObserver
-     * Empty implementation
-     */
-    void ToneFinished(TInt aError);
-
-    /**
-     * From MDevSoundObserver
-     * Empty implementation
-     */
-    void BufferToBeEmptied(CMMFBuffer* aBuffer);
-
-    /**
-     * From MDevSoundObserver
-     * Empty implementation
-     */
-    void RecordError(TInt aError);
-
-    /**
-     * From MDevSoundObserver
-     * Empty implementation
-     */
-    void ConvertError(TInt aError);
-
-    /**
-     * From MDevSoundObserver
-     * Empty implementation
-     */
-    void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
-
-protected:
-
-    TMSCSPDevSound(TMSCSPDevSoundObserver& aObserver);
-
-    void ConstructL(TMMFState aMode, gint aAudioPreference,
-            gint aAudioPriority);
-
-private:
-
-    /**
-     * Derived class has to activate the stream here.
-     */
-    virtual void DoActivateL() = 0;
-
-protected:
-
-    TUint iStreamType;
-
-    /**
-     * Indication if device is activated. Derived class has to update this.
-     */
-    TBool iActive;
-
-    /**
-     * Indication if activation is ongoing.
-     * Derived class has to update this.
-     */
-    TBool iActivationOngoing;
-
-    /**
-     * Devsound instance
-     * Own.
-     */
-    CMMFDevSound* iDevSound;
-
-    /**
-     * Observer for successfull activation.
-     * Not own.
-     */
-    TMSCSPDevSoundObserver& iObserver;
-
-    };
-
-} //namespace TMS
-
-#endif // CSPDEVSOUND_H
--- a/mmserv/tms/tmscallserver/inc/csuplink.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef CS_UPLINK_H
-#define CS_UPLINK_H
-
-#include <glib.h>
-#include "cspdevsound.h"
-
-namespace TMS {
-
-/**
- *  Provides uplink functionality.
- *
- */
-NONSHARABLE_CLASS(TMSCSUplink) : public TMSCSPDevSound
-    {
-public:
-
-    static TMSCSUplink* NewL(TMSCSPDevSoundObserver& aObserver);
-
-    virtual ~TMSCSUplink();
-
-    /**
-     * Determines mic mute state.
-     *
-     * @return ETrue - mic is muted, EFalse - mic is not muted.
-     */
-    TBool IsMuted();
-
-    /**
-     * Set mic muted.
-     */
-    void SetMuted();
-
-    /**
-     * Set mic unmuted.
-     */
-    void SetUnmuted();
-
-    /**
-     * Set mic gain.
-     */
-    void SetGain(gint aGain);
-
-    /**
-     * Get mic muted.
-     */
-    gint Gain();
-
-    /**
-     * Get max gain.
-     */
-    gint MaxGain();
-
-    // from base class MDevSoundObserver
-
-    /**
-     * From MDevSoundObserver
-     * Notification from Devsound that stream (mic) is
-     * activated successfully.
-     */
-    void BufferToBeEmptied(CMMFBuffer* aBuffer);
-
-    /**
-     * From MDevSoundObserver
-     * Notification from devsound that downstream(mic) activation
-     * feiled.
-     */
-    void RecordError(TInt aError);
-
-private:
-
-    // from base class MCSPDevSound
-
-    /**
-     * From MCSPDevSound.
-     * Tries to activate the mic stream.
-     */
-    void DoActivateL();
-
-protected:
-
-    TMSCSUplink(TMSCSPDevSoundObserver& aObserver);
-    void ConstructL();
-    };
-
-} //namespace TMS
-
-#endif // CSUplink_H
--- a/mmserv/tms/tmscallserver/inc/delaytimer.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef DELAYTIMER_H
-#define DELAYTIMER_H
-
-#include <e32base.h>
-
-namespace TMS {
-
-/**
- * A Timer utility class used by the Server for shutdown purpose.
- */
-class TMSCallDelayTimer : public CActive
-    {
-public:
-    // Construct/destruct
-    static TMSCallDelayTimer* NewL();
-    ~TMSCallDelayTimer();
-
-public:
-    // Request a timeout after aDelay
-    void SetDelay(TTimeIntervalMicroSeconds32 aDelay);
-
-protected:
-    // From CActive
-    void RunL();
-    void DoCancel();
-
-private:
-    // Construct/destruct
-    TMSCallDelayTimer();
-    void ConstructL();
-
-private:
-    RTimer iShutDownTimer; // Has
-    };
-
-} //namespace TMS
-
-#endif //DELAYTIMER_H
-
-// End of File
--- a/mmserv/tms/tmscallserver/inc/ipcallstream.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,312 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef __IPCALLSTREAM_H
-#define __IPCALLSTREAM_H
-
-//#define __PLAY_WAV_FROM_FILE__
-
-#include <e32msgqueue.h>
-#include <mmfbase.h>
-#include <tms.h>
-#include "tmsgstreamer.h"
-#include "tmsshared.h"
-#include "tmsclientserver.h"
-
-#ifdef __USE_GSTREAMER__
-#include <gst.h>
-#include "gstg711encoderinterface.h"
-#include "gstspeechencoderconfig.h"
-#include "gsterrorconcealmentinterface.h"
-#include "gstg711decoderinterface.h"
-#include "gstilbcdecoderinterface.h"
-#include "gstilbcencoderinterface.h"
-#include "gstg729encoderinterface.h"
-#include "gstg729decoderinterface.h"
-#else //__USE_GSTREAMER__
-#include <sounddevice.h>
-#include <voipdownlinkstream.h>
-#include <voipuplinkstream.h>
-
-// FORWARD DECLARATIONS
-class CAudioOutput;
-class CErrorConcealmentIntfc;
-class CSpeechEncoderConfig;
-class CG711DecoderIntfc;
-class CG729DecoderIntfc;
-class CIlbcDecoderIntfc;
-class CG711EncoderIntfc;
-class CG729EncoderIntfc;
-class CIlbcEncoderIntfc;
-#endif //__USE_GSTREAMER__
-
-namespace TMS {
-
-// -----------------------------------------------------------------------------
-//  Class Name:  TMSIPCallStreamBase
-//
-//  Base abstract class for creating VoIP uplink and downlink streams.
-// -----------------------------------------------------------------------------
-class TMSIPCallStreamBase : public CBase
-#ifndef __USE_GSTREAMER__
-                          , public MDevSoundObserver
-#endif //__USE_GSTREAMER__
-    {
-public:
-    enum TStreamState
-        {
-        ENotReady, // not initialized
-        EReady, // initialized and ready for streaming
-        EStreaming
-        // active streaming
-        };
-
-public:
-    virtual ~TMSIPCallStreamBase();
-
-    virtual void Start() = 0;
-    virtual void Stop() = 0;
-    virtual gint SetCodecCi() = 0;
-
-#ifndef __USE_GSTREAMER__
-    void InitDevSoundL(const TMMFState aDevSoundState,
-            const TMMFPrioritySettings priority);
-#endif //__USE_GSTREAMER__
-    void SetMsgQueue(const RMsgQueue<TmsMsgBuf> aMsgQueue);
-    gint DoChunk(const gint aDataLen, TmsMsgBuf& aMsgBuffer);
-    gint ConfigureMedia(const guint32 aCodecID);
-
-protected:
-#ifndef __USE_GSTREAMER__
-    // From MDevSoundObserver
-    virtual void InitializeComplete(TInt aError) = 0;
-    virtual void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {}
-    virtual void RecordError(TInt /*aError*/) {}
-    virtual void BufferToBeFilled(CMMFBuffer* /*aBuffer*/) {}
-    virtual void PlayError(TInt /*aError*/) {}
-    virtual void ToneFinished(TInt /*aError*/) {}
-    virtual void ConvertError(TInt /*aError*/) {}
-    virtual void DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {}
-    virtual void SendEventToClient(const TMMFEvent& /*aEvent*/) {}
-#endif //__USE_GSTREAMER__
-
-protected:
-
-    CActiveScheduler* iActiveScheduler;
-    TStreamState iStatus;
-
-#ifndef __USE_GSTREAMER__
-    CMMFDevSound* iDevSound;
-    CMMFDataBuffer* iDevSoundBufPtr;
-#endif //__USE_GSTREAMER__
-
-    RMsgQueue<TmsMsgBuf> iMsgQueue; // ITC back to client
-    TmsMsgBuf iMsgBuffer;
-    RChunk iChunk;
-    gint iMaxBufLen;
-    guint32 iCodecID;
-    TMMFPrioritySettings iPriority;
-    const gchar* iMediaType;
-
-    gint iG711DecodeMode;
-    gint iILBCDecodeMode;
-    gint iG711EncodeMode;
-    gint iILBCEncodeMode;
-    gint iBufLen;
-    TBool iWriteDataXferHndlToClient;
-    TUint32 iKey;
-    };
-
-// -----------------------------------------------------------------------------
-//  Class Name:  TMSIPDownlink
-//
-//  Class handling VoIP downlink stream object.
-// -----------------------------------------------------------------------------
-class TMSIPDownlink : public TMSIPCallStreamBase
-    {
-public:
-    virtual ~TMSIPDownlink();
-
-#ifdef __USE_GSTREAMER__
-    static void cb_raw_playback_handoff(GstElement* appsrc, guint size);
-    static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
-#endif //__USE_GSTREAMER__
-    static TMSIPDownlink* NewL(const guint32 codecID,
-            const TMMFPrioritySettings priority);
-    TMSIPDownlink();
-    void ConstructL(const guint32 codecID,
-            const TMMFPrioritySettings priority);
-
-    gint SetCodecCi();
-    void Start();
-    void Stop();
-    void BufferFilled(const guint buflen);
-    gint SetVolume(const guint volume);
-    gint GetVolume(guint& volume);
-    gint GetMaxVolume(guint& volume);
-    gint GetDataXferChunkHndl(const TUint32 key, RChunk& chunk);
-
-    // For CIs
-    gint SetIlbcCodecMode(const gint mode);
-    gint GetIlbcCodecMode(gint& mode);
-    gint SetG711CodecMode(const gint mode);
-    gint GetG711CodecMode(gint& mode);
-    gint FrameModeRqrdForEC(gboolean& frmodereq);
-    gint SetFrameMode(gboolean frmode);
-    gint GetFrameMode(gboolean& frmode);
-    gint ConcealErrorForNextBuffer();
-    gint SetCng(const TMSFormatType fmttype, const gboolean cng);
-    gint GetCng(const TMSFormatType fmttype, gboolean& cng);
-    gint SetPlc(const TMSFormatType fmttype, const gboolean plc);
-    gint GetPlc(const TMSFormatType fmttype, gboolean& plc);
-    gint BadLsfNextBuffer();
-
-    void SetAudioDeviceL(TMSAudioOutput output);
-    void GetAudioDeviceL(TMSAudioOutput& output);
-
-private:
-    void SetCodecCiL();
-
-#ifdef __USE_GSTREAMER__
-    void BufferToBeFilled();
-    gint gst_play_raw();
-    gint gst_initialize_play();
-#else //__USE_GSTREAMER__
-    // From MDevSoundObserver
-    virtual void BufferToBeFilled(CMMFBuffer* aBuffer);
-    virtual void InitializeComplete(TInt aError);
-    virtual void PlayError(TInt aError);
-#endif //__USE_GSTREAMER__
-
-private:
-
-    gboolean iFrameMode;
-    gboolean iPlc;
-    gint iMaxVolume;
-
-#ifndef __USE_GSTREAMER__
-    CAudioOutput* iAudioOutput;
-    CErrorConcealmentIntfc* iErrConcealmentIntfc;
-    CG711DecoderIntfc* iG711DecoderIntfc;
-    CG729DecoderIntfc* iG729DecoderIntfc;
-    CIlbcDecoderIntfc* iIlbcDecoderIntfc;
-#else //__USE_GSTREAMER__
-    GstErrorConcealmentIntfc* iErrConcealmentIntfc;
-    GstG711DecoderIntfc* iG711DecoderIntfc;
-    GstG729DecoderIntfc* iG729DecoderIntfc;
-    GstIlbcDecoderIntfc* iIlbcDecoderIntfc;
-    GstElement* iPipelinePlay;
-    GstElement* iAppSrc;
-    GstElement* iSink;
-    GstBus* iBusPlay;
-#endif //__USE_GSTREAMER__
-#ifdef _DEBUG
-    gint iSamplesPlayedCount;
-#endif
-
-#ifdef __PLAY_WAV_FROM_FILE__
-    RFile iFile;
-    gint fsize;
-    gint iReadSize;
-    gint iReadBytes;
-    RFs iFs;
-    HBufC8* fbuf;
-#endif
-    };
-
-// -----------------------------------------------------------------------------
-//  Class Name:  TMSIPUplink
-//
-//  Class handling VoIP uplink stream.
-// -----------------------------------------------------------------------------
-class TMSIPUplink : public TMSIPCallStreamBase
-    {
-public:
-    virtual ~TMSIPUplink();
-
-#ifdef __USE_GSTREAMER__
-    static void cb_record_raw_handoff(GstElement *sink);
-    static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
-#endif //__USE_GSTREAMER__
-    static TMSIPUplink* NewL(const guint32 codecID,
-            const TMMFPrioritySettings priority);
-    TMSIPUplink();
-    void ConstructL(const guint32 codecID,
-            const TMMFPrioritySettings priority);
-
-    gint SetCodecCi();
-    void Start();
-    void Stop();
-    void BufferEmptied();
-    gint SetGain(const guint gain);
-    gint GetGain(guint& gain);
-    gint GetMaxGain(guint& gain);
-    gint GetDataXferChunkHndl(const TUint32 key, RChunk& chunk);
-
-    // For CIs
-    gint SetIlbcCodecMode(const gint mode);
-    gint GetIlbcCodecMode(gint& mode);
-    gint SetG711CodecMode(const gint mode);
-    gint GetG711CodecMode(gint& mode);
-    gint GetSupportedBitrates(RArray<TUint>& bitrates);
-    gint SetBitrate(guint bitrate);
-    gint GetBitrate(guint& bitrate);
-    gint SetVad(const TMSFormatType fmttype, const gboolean vad);
-    gint GetVad(const TMSFormatType fmttype, gboolean& vad);
-
-private:
-    void SetCodecCiL();
-
-#ifdef __USE_GSTREAMER__
-    void BufferToBeEmptied();
-    gint gst_record_raw();
-    gint gst_initialize_record();
-#else //__USE_GSTREAMER__
-    // From MDevSoundObserver
-    virtual void BufferToBeEmptied(CMMFBuffer* aBuffer);
-    virtual void InitializeComplete(TInt aError);
-    virtual void RecordError(TInt /*aError*/);
-#endif //__USE_GSTREAMER__
-
-private:
-    gint iMaxGain;
-
-#ifndef __USE_GSTREAMER__
-    CSpeechEncoderConfig* iSpeechEncoderConfig;
-    CG711EncoderIntfc* iG711EncoderIntfc;
-    CG729EncoderIntfc* iG729EncoderIntfc;
-    CIlbcEncoderIntfc* iIlbcEncoderIntfc;
-#else //__USE_GSTREAMER__
-    GstSpeechEncoderConfigIntfc* iSpeechEncoderConfig;
-    GstG711EncoderIntfc* iG711EncoderIntfc;
-    GstG729EncoderIntfc* iG729EncoderIntfc;
-    GstIlbcEncoderIntfc* iIlbcEncoderIntfc;
-    GstElement* iPipelineRec;
-    GstElement* iSource;
-    GstElement* iAppSink;
-    GstBus* iBusRec;
-#endif //__USE_GSTREAMER__
-#ifdef _DEBUG
-    gint iSamplesRecCount;
-#endif
-    };
-
-} //namespace TMS
-
-#endif  //__IPCALLSTREAM_H
-
-// End of file
--- a/mmserv/tms/tmscallserver/inc/mcspdevsoundobserver.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef MCSPDEVSOUNDOBSERVER_H
-#define MCSPDEVSOUNDOBSERVER_H
-
-namespace TMS {
-
-/**
- *  Observer interface for knowing when audio streams have been
- *  successfully ramped up.
- *
- */
-class TMSCSPDevSoundObserver
-    {
-public:
-    virtual void DownlinkInitCompleted(TInt x) = 0;
-    virtual void UplinkInitCompleted(TInt x) = 0;
-
-    /**
-     * Notification that Mic has been activated successfully
-     *
-     */
-    virtual void UplinkActivatedSuccessfully() = 0;
-
-    /**
-     * Notification that speaker has been activated successfully
-     *
-     */
-    virtual void DownlinkActivatedSuccessfully() = 0;
-
-    /**
-     * Notification that Mic initialisation failed.
-     *
-     */
-    virtual void UplinkActivationFailed() = 0;
-
-    /**
-     * Notification that Speaker activation failed.
-     *
-     */
-    virtual void DownlinkActivationFailed() = 0;
-    };
-
-} //namespace TMS
-
-#endif // MCSPDEVSOUNDOBSERVER_H
--- a/mmserv/tms/tmscallserver/inc/tarsettings.h	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#ifndef TARSETTINGS_H
-#define TARSETTINGS_H
-
-//  INCLUDES
-#include <e32base.h>
-#include <e32property.h>
-#include <sounddevice.h>
-#include "tmsclientserver.h"
-
-namespace TMS {
-
-// CLASS DECLARATION
-class TMSTarSettings
-    {
-public:
-    // Constructors and destructor
-
-    /**
-     * Two-phased constructor.
-     */
-    static TMSTarSettings* NewL();
-
-    /**
-     * Destructor.
-     */
-    virtual ~TMSTarSettings();
-
-public:
-    // New functions
-
-    void SetTar(TRoutingMsgBufPckg rountingpckg, TBool aPublish = ETrue);
-
-private:
-
-    /**
-     * C++ default constructor.
-     */
-    TMSTarSettings();
-
-    /**
-     * By default Symbian 2nd phase constructor is private.
-     */
-    void ConstructL();
-
-private:
-    gint iVolume; //Volume
-    };
-
-} //namespace TMS
-
-#endif      // TarSETTINGS_H
-
-// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmscalladpt.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,101 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#ifndef CALLADPT_H
+#define CALLADPT_H
+
+#include <e32base.h>
+#include <tms.h>
+
+namespace TMS {
+
+// TMSCallAdpt class
+class TMSCallAdpt
+    {
+public:
+    static gint CreateCallL(gint callType, TMSCallAdpt*& callAdpt);
+    virtual ~TMSCallAdpt();
+    virtual gint CreateStream(TMSCallType callType,
+            TMSStreamType strmType, gint& outStrmId) = 0;
+    virtual gint InitStreamL(TMSCallType callType,
+            TMSStreamType strmType, gint strmId, TMSFormatType frmtType,
+            const RMessage2& aMessage) = 0;
+    virtual gint StartStream(TMSCallType callType,
+            TMSStreamType strmType, gint strmId) = 0;
+    virtual gint PauseStream(TMSCallType callType,
+            TMSStreamType strmType, gint strmId) = 0;
+    virtual gint StopStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId) = 0;
+    virtual gint DeinitStream(TMSCallType callType,
+            TMSStreamType strmType, gint strmId) = 0;
+    virtual gint DeleteStream(TMSCallType callType,
+            TMSStreamType strmType, gint strmId) = 0;
+    virtual gint DataXferBufferEmptied(TMSCallType callType,
+            TMSStreamType strmType, gint strmId) = 0;
+    virtual gint DataXferBufferFilled(TMSCallType callType,
+            TMSStreamType strmType, gint strmId, guint datasize) = 0;
+    virtual gint GetDataXferBufferHndl(const TMSCallType callType,
+            const TMSStreamType strmType, const gint strmId,
+            const guint32 key, RChunk& chunk) = 0;
+
+    virtual gint GetMaxVolume(guint& volume) = 0;
+    virtual gint SetVolume(const guint volume) = 0;
+    virtual gint GetVolume(guint& volume) = 0;
+    virtual gint GetMaxGain(guint& gain) = 0;
+    virtual gint SetGain(const guint gain) = 0;
+    virtual gint GetGain(guint& gain) = 0;
+    virtual gint GetGlobalMaxVolume(guint& volume) = 0;
+    virtual gint SetGlobalVolume(const guint volume) = 0;
+    virtual gint GetGlobalVolume(guint& volume) = 0;
+    virtual gint GetGlobalMaxGain(guint& gain) = 0;
+    virtual gint SetGlobalGain(const guint gain) = 0;
+    virtual gint GetGlobalGain(guint& gain) = 0;
+
+    virtual gint GetCodecMode(const TMSFormatType fmttype,
+            const TMSStreamType strmtype, gint& mode) = 0;
+    virtual gint SetCodecMode(const TMSFormatType fmttype,
+            const TMSStreamType strmtype, const gint mode) = 0;
+    virtual gint GetSupportedBitRatesCount(guint& count) = 0;
+    virtual gint GetSupportedBitRates(CBufFlat*& brbuffer) = 0;
+    virtual gint GetBitRate(guint& bitrate) = 0;
+    virtual gint SetBitRate(const guint bitrate) = 0;
+    virtual gint GetVAD(const TMSFormatType fmttype, gboolean& vad) = 0;
+    virtual gint SetVAD(const TMSFormatType fmttype, const gboolean vad) = 0;
+    virtual gint GetCNG(const TMSFormatType fmttype, gboolean& cng) = 0;
+    virtual gint SetCNG(const TMSFormatType fmttype, const gboolean cng) = 0;
+    virtual gint GetPlc(const TMSFormatType fmttype, gboolean& plc) = 0;
+    virtual gint SetPlc(const TMSFormatType fmttype, const gboolean plc) = 0;
+    virtual gint SetOutput(TMSAudioOutput output) = 0;
+    virtual gint GetOutput(TMSAudioOutput& output) = 0;
+    virtual gint GetPreviousOutput(TMSAudioOutput& output) = 0;
+    virtual gint GetAvailableOutputsL(gint& count,
+            CBufFlat*& outputsbuffer) = 0;
+
+protected:
+    TMSCallAdpt();
+    virtual gint PostConstruct();
+
+protected:
+    gint iGlobalVol;
+    gint iGlobalGain;
+    };
+
+} //namespace TMS
+
+#endif // CALLADPT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmscallcsadpt.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,143 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#ifndef CALLCSADPT_H
+#define CALLCSADPT_H
+
+#include <TelephonyAudioRouting.h>
+#include <MTelephonyAudioRoutingObserver.h>
+#include <e32msgqueue.h>
+#include "tmsclientserver.h"
+#include "tmscalladpt.h"
+#include "tmscsdevsoundobserver.h"
+
+namespace TMS {
+
+// FORWARD DECLARATIONS
+class TMSCSUplink;
+class TMSCSDownlink;
+class TMSTarSettings;
+
+/*
+ * CallCSAdapt class
+ */
+class TMSCallCSAdpt : public TMSCallAdpt,
+                      public TMSCSPDevSoundObserver,
+                      public MTelephonyAudioRoutingObserver
+    {
+public:
+    TMSCallCSAdpt();
+    virtual ~TMSCallCSAdpt();
+    virtual gint PostConstruct();
+
+    virtual gint CreateStream(TMSCallType callType, TMSStreamType strmType,
+            gint& outStrmId);
+    virtual gint InitStreamL(TMSCallType callType, TMSStreamType strmType,
+            gint strmId, TMSFormatType frmtType, const RMessage2& aMessage);
+    virtual gint StartStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint PauseStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint StopStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint DeinitStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint DeleteStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint DataXferBufferEmptied(TMSCallType callType,
+            TMSStreamType strmType, gint strmId);
+    virtual gint DataXferBufferFilled(TMSCallType callType,
+            TMSStreamType strmType, gint strmId, guint datasize);
+    virtual gint GetDataXferBufferHndl(const TMSCallType callType,
+            const TMSStreamType strmType, const gint strmId,
+            const guint32 key, RChunk& chunk);
+    virtual gint GetMaxVolume(guint& volume);
+    virtual gint SetVolume(const guint volume);
+    virtual gint GetVolume(guint& volume);
+    virtual gint GetMaxGain(guint& gain);
+    virtual gint SetGain(const guint gain);
+    virtual gint GetGain(guint& gain);
+    virtual gint GetGlobalMaxVolume(guint& volume);
+    virtual gint SetGlobalVolume(const guint volume);
+    virtual gint GetGlobalVolume(guint& volume);
+    virtual gint GetGlobalMaxGain(guint& gain);
+    virtual gint SetGlobalGain(const guint gain);
+    virtual gint GetGlobalGain(guint& gain);
+
+    virtual gint GetCodecMode(const TMSFormatType fmttype,
+            const TMSStreamType strmtype, gint& mode);
+    virtual gint SetCodecMode(const TMSFormatType fmttype,
+            const TMSStreamType strmtype, const gint mode);
+    virtual gint GetSupportedBitRatesCount(guint& count);
+    virtual gint GetSupportedBitRates(CBufFlat*& brbuffer);
+    virtual gint GetBitRate(guint& bitrate);
+    virtual gint SetBitRate(const guint bitrate);
+    virtual gint GetVAD(const TMSFormatType fmttype, gboolean& vad);
+    virtual gint SetVAD(const TMSFormatType fmttype, const gboolean vad);
+    virtual gint GetCNG(const TMSFormatType fmttype, gboolean& cng);
+    virtual gint SetCNG(const TMSFormatType fmttype, const gboolean cng);
+    virtual gint GetPlc(const TMSFormatType fmttype, gboolean& plc);
+    virtual gint SetPlc(const TMSFormatType fmttype, const gboolean plc);
+
+    virtual gint SetOutput(TMSAudioOutput output);
+    virtual gint GetOutput(TMSAudioOutput& output);
+    virtual gint GetPreviousOutput(TMSAudioOutput& output);
+    virtual gint GetAvailableOutputsL(gint& count, CBufFlat*& outputsbuffer);
+
+    void NotifyClient(const gint strmId, const gint aCommand,
+            const gint aStatus = KErrNone, const gint64 aInt64 = TInt64(0));
+
+    //From TMSCSPDevSoundObserver
+    void DownlinkInitCompleted(TInt status);
+    void UplinkInitCompleted(TInt status);
+    void UplinkActivatedSuccessfully();
+    void DownlinkActivatedSuccessfully();
+    void UplinkActivationFailed();
+    void DownlinkActivationFailed();
+
+protected:
+    void AvailableOutputsChanged(
+            CTelephonyAudioRouting& aTelephonyAudioRouting);
+    void OutputChanged(CTelephonyAudioRouting& aTelephonyAudioRouting);
+    void SetOutputComplete(CTelephonyAudioRouting& aTelephonyAudioRouting,
+            gint aError);
+    void GetSupportedBitRatesL(CBufFlat*& brbuffer);
+
+private:
+    gint iNextStreamId;
+
+    TMSCSUplink* iCSUplink;
+    TMSCSDownlink* iCSDownlink;
+    CTelephonyAudioRouting* iRouting;
+    TMSTarSettings* iTarSettings;
+    TMSStreamType iStrmtype;
+
+    RMsgQueue<TmsMsgBuf> iMsgQueueUp;
+    RMsgQueue<TmsMsgBuf> iMsgQueueDn;
+    TmsMsgBuf iMsgBuffer;
+
+    gboolean iUplinkInitialized;
+    gint iUplinkStreamId;
+    gboolean iDnlinkInitialized;
+    gint iDnlinkStreamId;
+    };
+
+} //namespace TMS
+
+#endif // CALLCSADPT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmscallipadpt.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,157 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#ifndef __CALLIPADAPT_H
+#define __CALLIPADAPT_H
+
+// INCLUDES
+#include <e32msgqueue.h>
+#include <mmcccodecinformation.h>
+#include "tmsclientserver.h"
+#include "tmsshared.h"
+#include "tmscalladpt.h"
+
+namespace TMS {
+
+// FORWARD DECLARATIONS
+class TMSIPDownlink;
+class TMSIPUplink;
+
+// TMSCallIPAdpt class
+class TMSCallIPAdpt : public TMSCallAdpt
+    {
+public:
+    // Constractor
+    static TMSCallIPAdpt* NewL();
+
+    virtual ~TMSCallIPAdpt();
+    virtual gint PostConstruct();
+
+    virtual gint CreateStream(TMSCallType callType, TMSStreamType strmType,
+            gint& outStrmId);
+    virtual gint InitStreamL(TMSCallType callType, TMSStreamType strmType,
+            gint strmId, TMSFormatType frmtType, const RMessage2& aMessage);
+    virtual gint StartStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint PauseStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint StopStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint DeinitStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint DeleteStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId);
+    virtual gint DataXferBufferEmptied(TMSCallType callType,
+            TMSStreamType strmType, gint strmId);
+    virtual gint DataXferBufferFilled(TMSCallType callType,
+            TMSStreamType strmType, gint strmId, guint datasize);
+    virtual gint GetDataXferBufferHndl(const TMSCallType callType,
+            const TMSStreamType strmType, const gint strmId,
+            const guint32 key, RChunk& chunk);
+
+    virtual gint GetMaxVolume(guint& volume);
+    virtual gint SetVolume(const guint volume);
+    virtual gint GetVolume(guint& volume);
+    virtual gint GetMaxGain(guint& gain);
+    virtual gint SetGain(const guint gain);
+    virtual gint GetGain(guint& gain);
+    virtual gint GetGlobalMaxVolume(guint& volume);
+    virtual gint SetGlobalVolume(const guint volume);
+    virtual gint GetGlobalVolume(guint& volume);
+    virtual gint GetGlobalMaxGain(guint& gain);
+    virtual gint SetGlobalGain(const guint gain);
+    virtual gint GetGlobalGain(guint& gain);
+
+    virtual gint GetCodecMode(const TMSFormatType fmttype,
+            const TMSStreamType strmtype, gint& mode);
+    virtual gint SetCodecMode(const TMSFormatType fmttype,
+            const TMSStreamType strmtype, const gint mode);
+    virtual gint GetSupportedBitRatesCount(guint& count);
+    virtual gint GetSupportedBitRates(CBufFlat*& brbuffer);
+    virtual gint GetBitRate(guint& bitrate);
+    virtual gint SetBitRate(const guint bitrate);
+    virtual gint GetVAD(const TMSFormatType fmttype, gboolean& vad);
+    virtual gint SetVAD(const TMSFormatType fmttype, const gboolean vad);
+    virtual gint GetCNG(const TMSFormatType fmttype, gboolean& cng);
+    virtual gint SetCNG(const TMSFormatType fmttype, const gboolean cng);
+    virtual gint GetPlc(const TMSFormatType fmttype, gboolean& plc);
+    virtual gint SetPlc(const TMSFormatType fmttype, const gboolean plc);
+
+    virtual gint SetOutput(TMSAudioOutput output);
+    virtual gint GetOutput(TMSAudioOutput& output);
+    virtual gint GetPreviousOutput(TMSAudioOutput& output);
+    virtual gint GetAvailableOutputsL(TInt& count, CBufFlat*& outputsbuffer);
+
+    gint SetIlbcCodecMode(const gint mode, const TMSStreamType strmtype);
+    gint GetIlbcCodecMode(gint& mode, const TMSStreamType strmtype);
+    gint SetG711CodecMode(const gint mode, const TMSStreamType strmtype);
+    gint GetG711CodecMode(gint& mode, const TMSStreamType strmtype);
+    gint FrameModeRqrdForEC(gboolean& frmodereq);
+    gint SetFrameMode(const gboolean frmode);
+    gint GetFrameMode(gboolean& frmode);
+    gint ConcealErrorForNextBuffer();
+    gint BadLsfNextBuffer();
+
+    gint OpenDownlinkL(const RMessage2& aMessage);
+    gint OpenUplinkL(const RMessage2& aMessage);
+    void SetFormat(const gint strmId, const TUint32 aFormat);
+
+    void BufferFilledL(TUint dataSize);
+    void BufferEmptiedL();
+    gint GetDataXferChunkHndl(const TMSStreamType strmType,
+            const TUint32 key, RChunk& chunk);
+
+private:
+    void ConstructL();
+    TMSCallIPAdpt();
+
+    void NotifyClient(const gint strmId, const TInt aCommand,
+            const TInt aStatus = KErrNone, const TInt64 aInt64 = TInt64(0));
+    //void DetermineG711FrameRateL(); //G711 10/20ms
+    void GetSupportedBitRatesL(CBufFlat*& brbuffer);
+
+private:
+    gint iNextStreamId;
+    gboolean iUplinkInitialized;
+    gint iUplinkStreamId;
+    gboolean iDnlinkInitialized;
+    gint iDnlinkStreamId;
+
+    TMSIPDownlink* iIPDownlink;
+    TMSIPUplink* iIPUplink;
+
+    // Message queues for communication and data transfer back to the client
+    RMsgQueue<TmsMsgBuf> iMsgQueueUp;
+    RMsgQueue<TmsMsgBuf> iMsgQueueDn;
+
+    TmsMsgBuf iMsgBuffer;
+    TMMFPrioritySettings iPriority;
+    TUint32 iUpFourCC;
+    TUint32 iDnFourCC;
+    TInt iMaxVolume;
+    TInt iMaxGain;
+    RArray<TUint> iArrBitrates;
+    RArray<TFourCC> iCodecs;
+    TInt iCodecsCount;
+
+    };
+
+} //namespace TMS
+
+#endif //__CALLIPADAPT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmscsdevsound.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,164 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#ifndef TMSCSDEVSOUND_H
+#define TMSCSDEVSOUND_H
+
+#include <sounddevice.h>
+
+namespace TMS {
+
+class TMSCSPDevSoundObserver;
+
+/**
+ *  Wrapper for CMMFDevSound
+ *
+ */
+NONSHARABLE_CLASS(TMSCSPDevSound) : public CBase,
+                                    public MDevSoundObserver
+    {
+public:
+
+    /**
+     * Destructor.
+     */
+    virtual ~TMSCSPDevSound();
+
+    /**
+     * Activates the dev sound stream. TMSCSPDevSoundObserver methods are called
+     * when activation goes ok or fails. If the stream is already active or
+     * activating then nothing is done.
+     */
+    virtual void Activate();
+
+    /**
+     * Deactivates the devsound stream. If stream is not active or
+     * activation is not ongoing then nothing is done.
+     */
+    virtual void Deactivate();
+
+    /**
+     * Indicates that activation is ongoing,
+     * but the result of the activation is still unknown.
+     * @return ETrue - activation ongoing, EFalse - activation not ongoing.
+     */
+    TBool IsActivationOngoing() const;
+
+    /**
+     * Determines wether the devsound stream is active or not.
+     * @return ETrue - Stream is active, EFalse - Stream not active.
+     */
+    TBool IsActive() const;
+
+    CMMFDevSound& DevSound();
+
+    // from base class MDevSoundObserver
+
+    /**
+     * From MDevSoundObserver
+     * Empty implementation
+     */
+    void InitializeComplete(TInt aError);
+
+    /**
+     * From MDevSoundObserver
+     * Empty implementation
+     */
+    void BufferToBeFilled(CMMFBuffer* aBuffer);
+
+    /**
+     * From MDevSoundObserver
+     * Empty implementation
+     */
+    void PlayError(TInt aError);
+
+    /**
+     * From MDevSoundObserver
+     * Empty implementation
+     */
+    void ToneFinished(TInt aError);
+
+    /**
+     * From MDevSoundObserver
+     * Empty implementation
+     */
+    void BufferToBeEmptied(CMMFBuffer* aBuffer);
+
+    /**
+     * From MDevSoundObserver
+     * Empty implementation
+     */
+    void RecordError(TInt aError);
+
+    /**
+     * From MDevSoundObserver
+     * Empty implementation
+     */
+    void ConvertError(TInt aError);
+
+    /**
+     * From MDevSoundObserver
+     * Empty implementation
+     */
+    void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
+
+protected:
+
+    TMSCSPDevSound(TMSCSPDevSoundObserver& aObserver);
+
+    void ConstructL(TMMFState aMode, gint aAudioPreference,
+            gint aAudioPriority);
+
+private:
+
+    /**
+     * Derived class has to activate the stream here.
+     */
+    virtual void DoActivateL() = 0;
+
+protected:
+
+    TUint iStreamType;
+
+    /**
+     * Indication if device is activated. Derived class has to update this.
+     */
+    TBool iActive;
+
+    /**
+     * Indication if activation is ongoing.
+     * Derived class has to update this.
+     */
+    TBool iActivationOngoing;
+
+    /**
+     * Devsound instance
+     * Own.
+     */
+    CMMFDevSound* iDevSound;
+
+    /**
+     * Observer for successfull activation.
+     * Not own.
+     */
+    TMSCSPDevSoundObserver& iObserver;
+
+    };
+
+} //namespace TMS
+
+#endif // TMSCSDEVSOUND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmscsdevsoundobserver.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,61 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#ifndef TMSCSDEVSOUNDOBSERVER_H
+#define TMSCSDEVSOUNDOBSERVER_H
+
+namespace TMS {
+
+/**
+ *  Observer interface for knowing when audio streams have been
+ *  successfully ramped up.
+ *
+ */
+class TMSCSPDevSoundObserver
+    {
+public:
+    virtual void DownlinkInitCompleted(TInt status) = 0;
+    virtual void UplinkInitCompleted(TInt status) = 0;
+
+    /**
+     * Notification that Mic has been activated successfully
+     *
+     */
+    virtual void UplinkActivatedSuccessfully() = 0;
+
+    /**
+     * Notification that speaker has been activated successfully
+     *
+     */
+    virtual void DownlinkActivatedSuccessfully() = 0;
+
+    /**
+     * Notification that Mic initialisation failed.
+     *
+     */
+    virtual void UplinkActivationFailed() = 0;
+
+    /**
+     * Notification that Speaker activation failed.
+     *
+     */
+    virtual void DownlinkActivationFailed() = 0;
+    };
+
+} //namespace TMS
+
+#endif // TMSCSDEVSOUNDOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmscsdownlink.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,92 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#ifndef TMSCSDOWNLINK_H
+#define TMSCSDOWNLINK_H
+
+#include <glib.h>
+#include "tmscsdevsound.h"
+
+namespace TMS {
+
+//
+class TMSCSPDevSoundObserver;
+
+/**
+ *  Provides Downlink functionality.
+ *
+ */
+NONSHARABLE_CLASS(TMSCSDownlink) : public TMSCSPDevSound
+    {
+public:
+
+    static TMSCSDownlink* NewL(TMSCSPDevSoundObserver& aObserver);
+
+    virtual ~TMSCSDownlink();
+
+    /**
+     * Sets volume.
+     * @param aVolume Volume.
+     */
+    void SetVolume(gint aVolume);
+
+    /**
+     * Gets volume.
+     * @return Current volume.
+     */
+    gint Volume();
+
+    /**
+     * Gets max volume.
+     * @return Current volume.
+     */
+    gint MaxVolume();
+
+    // from base class MDevSoundObserver
+
+    /**
+     * From MDevSoundObserver.
+     * Indication from devsound that stream (Downlink) has been activated
+     * successfully.
+     */
+    void BufferToBeFilled(CMMFBuffer* /*aBuffer*/);
+
+    /**
+     * From MDevSoundObserver.
+     * Indication from devsound that activation of stream( Downlink)
+     * failed.
+     */
+    void PlayError(TInt aErrorCode);
+
+private:
+
+    /**
+     * From CSPDevSound.
+     * Tries to activate the mic stream.
+     */
+    void DoActivateL();
+
+protected:
+
+    TMSCSDownlink(TMSCSPDevSoundObserver& aObserver);
+
+    void ConstructL();
+    };
+
+} //namespace TMS
+
+#endif // TMSCSDOWNLINK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmscsuplink.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Telephony Multimedia Service
+ *
+ */
+
+#ifndef TMSCSUPLINK_H
+#define TMSCSUPLINK_H
+
+#include <glib.h>
+#include "tmscsdevsound.h"
+
+namespace TMS {
+
+/**
+ *  Provides uplink functionality.
+ *
+ */
+NONSHARABLE_CLASS(TMSCSUplink) : public TMSCSPDevSound
+    {
+public:
+
+    static TMSCSUplink* NewL(TMSCSPDevSoundObserver& aObserver);
+
+    virtual ~TMSCSUplink();
+
+    /**
+     * Determines mic mute state.
+     *
+     * @return ETrue - mic is muted, EFalse - mic is not muted.
+     */
+    TBool IsMuted();
+
+    /**
+     * Set mic muted.
+     */
+    void SetMuted();
+
+    /**
+     * Set mic unmuted.
+     */
+    void SetUnmuted();
+
+    /**
+     * Set mic gain.
+     */
+    void SetGain(gint aGain);
+
+    /**
+     * Get mic muted.
+     */
+    gint Gain();
+
+    /**
+     * Get max gain.
+     */
+    gint MaxGain();
+
+    // from base class MDevSoundObserver
+
+    /**
+     * From MDevSoundObserver
+     * Notification from Devsound that stream (mic) is
+     * activated successfully.
+     */
+    void BufferToBeEmptied(CMMFBuffer* aBuffer);
+
+    /**
+     * From MDevSoundObserver
+     * Notification from devsound that downstream(mic) activation
+     * feiled.
+     */
+    void RecordError(TInt aError);
+
+private:
+
+    // from base class MCSPDevSound
+
+    /**
+     * From MCSPDevSound.
+     * Tries to activate the mic stream.
+     */
+    void DoActivateL();
+
+protected:
+
+    TMSCSUplink(TMSCSPDevSoundObserver& aObserver);
+    void ConstructL();
+    };
+
+} //namespace TMS
+
+#endif // TMSCSUPLINK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmsdelaytimer.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,57 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#ifndef DELAYTIMER_H
+#define DELAYTIMER_H
+
+#include <e32base.h>
+
+namespace TMS {
+
+/**
+ * A Timer utility class used by the Server for shutdown purpose.
+ */
+class TMSCallDelayTimer : public CActive
+    {
+public:
+    // Construct/destruct
+    static TMSCallDelayTimer* NewL();
+    ~TMSCallDelayTimer();
+
+public:
+    // Request a timeout after aDelay
+    void SetDelay(TTimeIntervalMicroSeconds32 aDelay);
+
+protected:
+    // From CActive
+    void RunL();
+    void DoCancel();
+
+private:
+    // Construct/destruct
+    TMSCallDelayTimer();
+    void ConstructL();
+
+private:
+    RTimer iShutDownTimer; // Has
+    };
+
+} //namespace TMS
+
+#endif //DELAYTIMER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmsipcallstream.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,312 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#ifndef __IPCALLSTREAM_H
+#define __IPCALLSTREAM_H
+
+//#define __PLAY_WAV_FROM_FILE__
+
+#include <e32msgqueue.h>
+#include <mmfbase.h>
+#include <tms.h>
+#include "tmsgstreamer.h"
+#include "tmsshared.h"
+#include "tmsclientserver.h"
+
+#ifdef __USE_GSTREAMER__
+#include <gst.h>
+#include "gstg711encoderinterface.h"
+#include "gstspeechencoderconfig.h"
+#include "gsterrorconcealmentinterface.h"
+#include "gstg711decoderinterface.h"
+#include "gstilbcdecoderinterface.h"
+#include "gstilbcencoderinterface.h"
+#include "gstg729encoderinterface.h"
+#include "gstg729decoderinterface.h"
+#else //__USE_GSTREAMER__
+#include <sounddevice.h>
+#include <voipdownlinkstream.h>
+#include <voipuplinkstream.h>
+
+// FORWARD DECLARATIONS
+class CAudioOutput;
+class CErrorConcealmentIntfc;
+class CSpeechEncoderConfig;
+class CG711DecoderIntfc;
+class CG729DecoderIntfc;
+class CIlbcDecoderIntfc;
+class CG711EncoderIntfc;
+class CG729EncoderIntfc;
+class CIlbcEncoderIntfc;
+#endif //__USE_GSTREAMER__
+
+namespace TMS {
+
+// -----------------------------------------------------------------------------
+//  Class Name:  TMSIPCallStreamBase
+//
+//  Base abstract class for creating VoIP uplink and downlink streams.
+// -----------------------------------------------------------------------------
+class TMSIPCallStreamBase : public CBase
+#ifndef __USE_GSTREAMER__
+                          , public MDevSoundObserver
+#endif //__USE_GSTREAMER__
+    {
+public:
+    enum TStreamState
+        {
+        ENotReady, // not initialized
+        EReady, // initialized and ready for streaming
+        EStreaming
+        // active streaming
+        };
+
+public:
+    virtual ~TMSIPCallStreamBase();
+
+    virtual void Start() = 0;
+    virtual void Stop() = 0;
+    virtual gint SetCodecCi() = 0;
+
+#ifndef __USE_GSTREAMER__
+    void InitDevSoundL(const TMMFState aDevSoundState,
+            const TMMFPrioritySettings priority);
+#endif //__USE_GSTREAMER__
+    void SetMsgQueue(const RMsgQueue<TmsMsgBuf> aMsgQueue);
+    gint DoChunk(const gint aDataLen, TmsMsgBuf& aMsgBuffer);
+    gint ConfigureMedia(const guint32 aCodecID);
+
+protected:
+#ifndef __USE_GSTREAMER__
+    // From MDevSoundObserver
+    virtual void InitializeComplete(TInt aError) = 0;
+    virtual void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {}
+    virtual void RecordError(TInt /*aError*/) {}
+    virtual void BufferToBeFilled(CMMFBuffer* /*aBuffer*/) {}
+    virtual void PlayError(TInt /*aError*/) {}
+    virtual void ToneFinished(TInt /*aError*/) {}
+    virtual void ConvertError(TInt /*aError*/) {}
+    virtual void DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {}
+    virtual void SendEventToClient(const TMMFEvent& /*aEvent*/) {}
+#endif //__USE_GSTREAMER__
+
+protected:
+
+    CActiveScheduler* iActiveScheduler;
+    TStreamState iStatus;
+
+#ifndef __USE_GSTREAMER__
+    CMMFDevSound* iDevSound;
+    CMMFDataBuffer* iDevSoundBufPtr;
+#endif //__USE_GSTREAMER__
+
+    RMsgQueue<TmsMsgBuf> iMsgQueue; // ITC back to client
+    TmsMsgBuf iMsgBuffer;
+    RChunk iChunk;
+    gint iMaxBufLen;
+    guint32 iCodecID;
+    TMMFPrioritySettings iPriority;
+    const gchar* iMediaType;
+
+    gint iG711DecodeMode;
+    gint iILBCDecodeMode;
+    gint iG711EncodeMode;
+    gint iILBCEncodeMode;
+    gint iBufLen;
+    TBool iWriteDataXferHndlToClient;
+    TUint32 iKey;
+    };
+
+// -----------------------------------------------------------------------------
+//  Class Name:  TMSIPDownlink
+//
+//  Class handling VoIP downlink stream object.
+// -----------------------------------------------------------------------------
+class TMSIPDownlink : public TMSIPCallStreamBase
+    {
+public:
+    virtual ~TMSIPDownlink();
+
+#ifdef __USE_GSTREAMER__
+    static void cb_raw_playback_handoff(GstElement* appsrc, guint size);
+    static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
+#endif //__USE_GSTREAMER__
+    static TMSIPDownlink* NewL(const guint32 codecID,
+            const TMMFPrioritySettings priority);
+    TMSIPDownlink();
+    void ConstructL(const guint32 codecID,
+            const TMMFPrioritySettings priority);
+
+    gint SetCodecCi();
+    void Start();
+    void Stop();
+    void BufferFilled(const guint buflen);
+    gint SetVolume(const guint volume);
+    gint GetVolume(guint& volume);
+    gint GetMaxVolume(guint& volume);
+    gint GetDataXferChunkHndl(const TUint32 key, RChunk& chunk);
+
+    // For CIs
+    gint SetIlbcCodecMode(const gint mode);
+    gint GetIlbcCodecMode(gint& mode);
+    gint SetG711CodecMode(const gint mode);
+    gint GetG711CodecMode(gint& mode);
+    gint FrameModeRqrdForEC(gboolean& frmodereq);
+    gint SetFrameMode(gboolean frmode);
+    gint GetFrameMode(gboolean& frmode);
+    gint ConcealErrorForNextBuffer();
+    gint SetCng(const TMSFormatType fmttype, const gboolean cng);
+    gint GetCng(const TMSFormatType fmttype, gboolean& cng);
+    gint SetPlc(const TMSFormatType fmttype, const gboolean plc);
+    gint GetPlc(const TMSFormatType fmttype, gboolean& plc);
+    gint BadLsfNextBuffer();
+
+    void SetAudioDeviceL(TMSAudioOutput output);
+    void GetAudioDeviceL(TMSAudioOutput& output);
+
+private:
+    void SetCodecCiL();
+
+#ifdef __USE_GSTREAMER__
+    void BufferToBeFilled();
+    gint gst_play_raw();
+    gint gst_initialize_play();
+#else //__USE_GSTREAMER__
+    // From MDevSoundObserver
+    virtual void BufferToBeFilled(CMMFBuffer* aBuffer);
+    virtual void InitializeComplete(TInt aError);
+    virtual void PlayError(TInt aError);
+#endif //__USE_GSTREAMER__
+
+private:
+
+    gboolean iFrameMode;
+    gboolean iPlc;
+    gint iMaxVolume;
+
+#ifndef __USE_GSTREAMER__
+    CAudioOutput* iAudioOutput;
+    CErrorConcealmentIntfc* iErrConcealmentIntfc;
+    CG711DecoderIntfc* iG711DecoderIntfc;
+    CG729DecoderIntfc* iG729DecoderIntfc;
+    CIlbcDecoderIntfc* iIlbcDecoderIntfc;
+#else //__USE_GSTREAMER__
+    GstErrorConcealmentIntfc* iErrConcealmentIntfc;
+    GstG711DecoderIntfc* iG711DecoderIntfc;
+    GstG729DecoderIntfc* iG729DecoderIntfc;
+    GstIlbcDecoderIntfc* iIlbcDecoderIntfc;
+    GstElement* iPipelinePlay;
+    GstElement* iAppSrc;
+    GstElement* iSink;
+    GstBus* iBusPlay;
+#endif //__USE_GSTREAMER__
+#ifdef _DEBUG
+    gint iSamplesPlayedCount;
+#endif
+
+#ifdef __PLAY_WAV_FROM_FILE__
+    RFile iFile;
+    gint fsize;
+    gint iReadSize;
+    gint iReadBytes;
+    RFs iFs;
+    HBufC8* fbuf;
+#endif
+    };
+
+// -----------------------------------------------------------------------------
+//  Class Name:  TMSIPUplink
+//
+//  Class handling VoIP uplink stream.
+// -----------------------------------------------------------------------------
+class TMSIPUplink : public TMSIPCallStreamBase
+    {
+public:
+    virtual ~TMSIPUplink();
+
+#ifdef __USE_GSTREAMER__
+    static void cb_record_raw_handoff(GstElement *sink);
+    static gboolean bus_call(GstBus* bus, GstMessage* msg, gpointer data);
+#endif //__USE_GSTREAMER__
+    static TMSIPUplink* NewL(const guint32 codecID,
+            const TMMFPrioritySettings priority);
+    TMSIPUplink();
+    void ConstructL(const guint32 codecID,
+            const TMMFPrioritySettings priority);
+
+    gint SetCodecCi();
+    void Start();
+    void Stop();
+    void BufferEmptied();
+    gint SetGain(const guint gain);
+    gint GetGain(guint& gain);
+    gint GetMaxGain(guint& gain);
+    gint GetDataXferChunkHndl(const TUint32 key, RChunk& chunk);
+
+    // For CIs
+    gint SetIlbcCodecMode(const gint mode);
+    gint GetIlbcCodecMode(gint& mode);
+    gint SetG711CodecMode(const gint mode);
+    gint GetG711CodecMode(gint& mode);
+    gint GetSupportedBitrates(RArray<TUint>& bitrates);
+    gint SetBitrate(guint bitrate);
+    gint GetBitrate(guint& bitrate);
+    gint SetVad(const TMSFormatType fmttype, const gboolean vad);
+    gint GetVad(const TMSFormatType fmttype, gboolean& vad);
+
+private:
+    void SetCodecCiL();
+
+#ifdef __USE_GSTREAMER__
+    void BufferToBeEmptied();
+    gint gst_record_raw();
+    gint gst_initialize_record();
+#else //__USE_GSTREAMER__
+    // From MDevSoundObserver
+    virtual void BufferToBeEmptied(CMMFBuffer* aBuffer);
+    virtual void InitializeComplete(TInt aError);
+    virtual void RecordError(TInt /*aError*/);
+#endif //__USE_GSTREAMER__
+
+private:
+    gint iMaxGain;
+
+#ifndef __USE_GSTREAMER__
+    CSpeechEncoderConfig* iSpeechEncoderConfig;
+    CG711EncoderIntfc* iG711EncoderIntfc;
+    CG729EncoderIntfc* iG729EncoderIntfc;
+    CIlbcEncoderIntfc* iIlbcEncoderIntfc;
+#else //__USE_GSTREAMER__
+    GstSpeechEncoderConfigIntfc* iSpeechEncoderConfig;
+    GstG711EncoderIntfc* iG711EncoderIntfc;
+    GstG729EncoderIntfc* iG729EncoderIntfc;
+    GstIlbcEncoderIntfc* iIlbcEncoderIntfc;
+    GstElement* iPipelineRec;
+    GstElement* iSource;
+    GstElement* iAppSink;
+    GstBus* iBusRec;
+#endif //__USE_GSTREAMER__
+#ifdef _DEBUG
+    gint iSamplesRecCount;
+#endif
+    };
+
+} //namespace TMS
+
+#endif  //__IPCALLSTREAM_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/inc/tmstarsettings.h	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,70 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#ifndef TARSETTINGS_H
+#define TARSETTINGS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+#include <sounddevice.h>
+#include "tmsclientserver.h"
+
+namespace TMS {
+
+// CLASS DECLARATION
+class TMSTarSettings
+    {
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static TMSTarSettings* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~TMSTarSettings();
+
+public:
+    // New functions
+
+    void SetTar(TRoutingMsgBufPckg rountingpckg, TBool aPublish = ETrue);
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    TMSTarSettings();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private:
+    gint iVolume; //Volume
+    };
+
+} //namespace TMS
+
+#endif      // TarSETTINGS_H
+
+// End of File
--- a/mmserv/tms/tmscallserver/src/calladpt.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <tms.h>
-#include "callipadpt.h"
-#include "callcsadpt.h"
-#include "calladpt.h"
-#include "tmsutility.h"
-
-using namespace TMS;
-
-// -----------------------------------------------------------------------------
-// TMSCallAdpt::TMSCallAdpt
-//
-// -----------------------------------------------------------------------------
-//
-TMSCallAdpt::TMSCallAdpt()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallAdpt::~TMSCallAdpt
-//
-// -----------------------------------------------------------------------------
-//
-TMSCallAdpt::~TMSCallAdpt()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallAdpt::CreateCallL
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallAdpt::CreateCallL(gint callType, TMSCallAdpt*& callAdpt)
-    {
-    TRACE_PRN_FN_ENT;
-    TMSCallAdpt* self(NULL);
-    gint retVal(TMS_RESULT_SUCCESS);
-    switch (callType)
-        {
-        case TMS_CALL_IP:
-            retVal = TMS_RESULT_INSUFFICIENT_MEMORY;
-            self = TMSCallIPAdpt::NewL();
-            if (self)
-                {
-                retVal = self->PostConstruct();
-                if (retVal != TMS_RESULT_SUCCESS)
-                    {
-                    delete self;
-                    self = NULL;
-                    }
-                }
-            break;
-
-        case TMS_CALL_CS:
-            retVal = TMS_RESULT_INSUFFICIENT_MEMORY;
-            self = new TMSCallCSAdpt();
-            if (self)
-                {
-                retVal = self->PostConstruct();
-                if (retVal != TMS_RESULT_SUCCESS)
-                    {
-                    delete self;
-                    self = NULL;
-                    }
-                }
-            break;
-        default:
-            retVal = TMS_RESULT_CALL_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    callAdpt = self;
-    TRACE_PRN_FN_EXT;
-    return retVal;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallAdpt::PostConstruct
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallAdpt::PostConstruct()
-    {
-    return TMS_RESULT_SUCCESS;
-    }
-
-// End of file
--- a/mmserv/tms/tmscallserver/src/callcsadpt.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1056 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <tms.h>
-#include <S60FourCC.h>
-#include <AudioPreference.h>
-#include <TelephonyAudioRouting.h>
-#include "csuplink.h"
-#include "csdownlink.h"
-#include "callcsadpt.h"
-#include "tmsutility.h"
-#include "tmsshared.h"
-#include "tmsclientserver.h"
-#include "tarsettings.h"
-
-using namespace TMS;
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::TMSCallCSAdpt
-//
-// -----------------------------------------------------------------------------
-//
-TMSCallCSAdpt::TMSCallCSAdpt()
-    {
-    TRACE_PRN_FN_ENT;
-
-    iCSDownlink = NULL;
-    iCSUplink = NULL;
-    iRouting = NULL;
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::~TMSCallCSAdpt
-//
-// -----------------------------------------------------------------------------
-//
-TMSCallCSAdpt::~TMSCallCSAdpt()
-    {
-    TRACE_PRN_FN_ENT;
-    delete iCSDownlink;
-    delete iCSUplink;
-    delete iRouting;
-    delete iTarSettings;
-
-    if (iMsgQueueUp.Handle() > 0)
-        {
-        iMsgQueueUp.Close();
-        }
-
-    if (iMsgQueueDn.Handle() > 0)
-        {
-        iMsgQueueDn.Close();
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::PostConstruct
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::PostConstruct()
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    iNextStreamId = 1;
-    iUplinkInitialized = FALSE;
-    iDnlinkInitialized = FALSE;
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::CreateStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::CreateStream(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint& outStrmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            status = TMS_RESULT_ALREADY_EXIST;
-            if (!iUplinkInitialized)
-                {
-                iUplinkInitialized = TRUE;
-                iUplinkStreamId = iNextStreamId;
-                outStrmId = iUplinkStreamId;
-                iNextStreamId++;
-                iUplinkInitialized = TRUE;
-                status = TMS_RESULT_SUCCESS;
-                }
-            break;
-        case TMS_STREAM_DOWNLINK:
-            status = TMS_RESULT_ALREADY_EXIST;
-            if (!iDnlinkInitialized)
-                {
-                iDnlinkInitialized = TRUE;
-                iDnlinkStreamId = iNextStreamId;
-                outStrmId = iDnlinkStreamId;
-                iNextStreamId++;
-                iDnlinkInitialized = TRUE;
-                status = TMS_RESULT_SUCCESS;
-                }
-            break;
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::InitStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::InitStreamL(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId, TMSFormatType /*frmtType*/,
-        const RMessage2& aMessage)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            if (strmId == iUplinkStreamId)
-                {
-                // Open message queue handling client-server communication
-                if (iMsgQueueUp.Handle() <= 0)
-                    {
-                    // Third argument in TMSCallProxy::InitStream
-                    status = iMsgQueueUp.Open(aMessage, 1);
-                    }
-                if (status == TMS_RESULT_SUCCESS)
-                    {
-                    TRAP(status, iCSUplink = TMSCSUplink::NewL(*this));
-                    }
-                iStrmtype = TMS_STREAM_UPLINK;
-                }
-            else
-                {
-                status = TMS_RESULT_DOES_NOT_EXIST;
-                }
-            break;
-        case TMS_STREAM_DOWNLINK:
-            if (strmId == iDnlinkStreamId)
-                {
-                // Open message queue handling client-server communication
-                if (iMsgQueueDn.Handle() <= 0)
-                    {
-                    // Third argument in TMSCallProxy::InitStream
-                    status = iMsgQueueDn.Open(aMessage, 1);
-                    }
-                if (status == TMS_RESULT_SUCCESS)
-                    {
-                    TRAP(status, iCSDownlink = TMSCSDownlink::NewL(*this));
-                    if (status == TMS_RESULT_SUCCESS)
-                        {
-                        TRAP(status, iRouting =
-                             CTelephonyAudioRouting::NewL(*this));
-                        if (status == TMS_RESULT_SUCCESS)
-                            {
-                            iTarSettings = TMSTarSettings::NewL();
-                            }
-                        }
-                    }
-                iStrmtype = TMS_STREAM_DOWNLINK;
-                }
-            else
-                {
-                status = TMS_RESULT_DOES_NOT_EXIST;
-                }
-            break;
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-
-    TRACE_PRN_IF_ERR(status);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::StartStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::StartStream(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            if (iCSUplink && strmId == iUplinkStreamId)
-                {
-                iCSUplink->Activate();
-                }
-            break;
-        case TMS_STREAM_DOWNLINK:
-            if (iCSDownlink && strmId == iDnlinkStreamId)
-                {
-                iCSDownlink->Activate();
-                }
-            break;
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::PauseStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::PauseStream(TMSCallType /*callType*/,
-        TMSStreamType /*strmType*/, gint /*strmId*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::StopStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::StopStream(TMSCallType /*callType*/, TMSStreamType strmType,
-        gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            if (iCSUplink && strmId == iUplinkStreamId)
-                {
-                iCSUplink->Deactivate();
-                NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete,
-                        status, 0);
-                }
-            break;
-        case TMS_STREAM_DOWNLINK:
-            if (iCSDownlink && strmId == iDnlinkStreamId)
-                {
-                iCSDownlink->Deactivate();
-                NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete,
-                        status, 0);
-                }
-            break;
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::DeinitStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::DeinitStream(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            if (iCSUplink && strmId == iUplinkStreamId)
-                {
-                iCSUplink->Deactivate();
-                iUplinkInitialized = FALSE;
-                NotifyClient(iUplinkStreamId, ECmdUplinkDeInitComplete,
-                        status, 0);
-                }
-            break;
-        case TMS_STREAM_DOWNLINK:
-            if (iCSDownlink && strmId == iDnlinkStreamId)
-                {
-                iCSDownlink->Deactivate();
-                iDnlinkInitialized = FALSE;
-                NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete,
-                        status, 0);
-                }
-            break;
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::DeleteStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::DeleteStream(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            if (strmId == iUplinkStreamId)
-                {
-                iUplinkStreamId = -1;
-                iUplinkInitialized = FALSE;
-                }
-            break;
-        case TMS_STREAM_DOWNLINK:
-            if (strmId == iDnlinkStreamId)
-                {
-                iDnlinkStreamId = -1;
-                iDnlinkInitialized = FALSE;
-                }
-            break;
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::DataXferBufferEmptied
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::DataXferBufferEmptied(TMSCallType /*callType*/,
-        TMSStreamType /*strmType*/, gint /*strmId*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::DataXferBufferFilled
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::DataXferBufferFilled(TMSCallType /*callType*/,
-        TMSStreamType /*strmType*/, gint /*strmId*/, guint /*datasize*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetDataXferBufferHndl
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetDataXferBufferHndl(const TMSCallType /*callType*/,
-        const TMSStreamType /*strmType*/, const gint /*strmId*/,
-        const guint32 /*key*/, RChunk& /*chunk*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetMaxVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetMaxVolume(guint& volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iCSDownlink && iDnlinkInitialized)
-        {
-        volume = iCSDownlink->MaxVolume();
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetVolume(const guint volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iCSDownlink && iDnlinkInitialized)
-        {
-        iCSDownlink->SetVolume(volume);
-        status = TMS_RESULT_SUCCESS;
-        NotifyClient(iDnlinkStreamId, ECmdSetVolume, status, 0);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetVolume(guint& volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iCSDownlink && iDnlinkInitialized)
-        {
-        volume = iCSDownlink->Volume();
-        status = TMS_RESULT_SUCCESS;
-        }
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetMaxGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetMaxGain(guint& gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iCSUplink && iUplinkInitialized)
-        {
-        gain = iCSUplink->MaxGain();
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetGain(const guint gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iUplinkInitialized)
-        {
-        iCSUplink->SetGain(gain);
-        status = TMS_RESULT_SUCCESS;
-        NotifyClient(iUplinkInitialized, ECmdSetGain, status, 0);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetGain(guint& gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iCSUplink && iUplinkInitialized)
-        {
-        gain = iCSUplink->Gain();
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetGlobalMaxVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetGlobalMaxVolume(guint& volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iCSDownlink && iDnlinkInitialized)
-        {
-        volume = iCSDownlink->MaxVolume();
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetGlobalVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetGlobalVolume(const guint volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-
-    iGlobalVol = volume;
-    if (iCSDownlink && iDnlinkInitialized)
-        {
-        iCSDownlink->SetVolume(volume);
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetGlobalVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetGlobalVolume(guint& volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iCSDownlink && iDnlinkInitialized)
-        {
-        volume = iCSDownlink->Volume();
-        status = TMS_RESULT_SUCCESS;
-        }
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetMaxGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetGlobalMaxGain(guint& gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iCSUplink && iUplinkInitialized)
-        {
-        gain = iCSUplink->MaxGain();
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetGlobalGain(const guint gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-
-    iGlobalGain = gain;
-    if (iCSUplink && iUplinkInitialized)
-        {
-        iCSUplink->SetGain(gain);
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetGlobalGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetGlobalGain(guint& gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_ILLEGAL_OPERATION);
-    if (iCSUplink && iUplinkInitialized)
-        {
-        gain = iCSUplink->Gain();
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetCodecMode(const TMSFormatType /*fmttype*/,
-        const TMSStreamType /*strmtype*/, gint& /*mode*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetCodecMode(const TMSFormatType /*fmttype*/,
-        const TMSStreamType /*strmtype*/, const gint /*mode*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetSupportedBitRatesCount
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetSupportedBitRatesCount(guint& /*count*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetSupportedBitRates
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetSupportedBitRates(CBufFlat*& brbuffer)
-    {
-    TRACE_PRN_FN_ENT;
-    TRAPD(status, GetSupportedBitRatesL(brbuffer));
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetSupportedBitRatesL
-//
-// GetSupportedBitRates implementation which can leave.
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::GetSupportedBitRatesL(CBufFlat*& /*brbuffer*/)
-    {
-    User::Leave(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetBitRate
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetBitRate(guint& /*bitrate*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetBitRate
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetBitRate(const guint /*bitrate*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetVAD
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetVAD(const TMSFormatType /*fmttype*/, gboolean& /*vad*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetVAD
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetVAD(const TMSFormatType /*fmttype*/, const gboolean /*vad*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetCNG
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetCNG(const TMSFormatType /*fmttype*/, gboolean& /*cng*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetCNG
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetCNG(const TMSFormatType /*fmttype*/,
-        const gboolean /*cng*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetPlc
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetPlc(const TMSFormatType /*fmttype*/, gboolean& /*plc*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetPlc
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetPlc(const TMSFormatType /*fmttype*/,
-        const gboolean /*plc*/)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetOutput
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::SetOutput(TMSAudioOutput output)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-
-    if (iRouting)
-        {
-        CTelephonyAudioRouting::TAudioOutput taroutput = TOTAROUTPUT(output);
-        TRAP(status, iRouting->SetOutputL(taroutput));
-        if (status == KErrArgument)
-            {
-            status = TMS_RESULT_INVALID_ARGUMENT;
-            }
-        else
-            {
-            status = TMS_RESULT_SUCCESS;
-            }
-        }
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetOutput
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetOutput(TMSAudioOutput& output)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-
-    if (iRouting)
-        {
-        CTelephonyAudioRouting::TAudioOutput taroutput;
-        taroutput = iRouting->Output();
-        status = TMS_RESULT_SUCCESS;
-        output = TOTMSOUTPUT(taroutput);
-        }
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetPreviousOutput
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetPreviousOutput(TMSAudioOutput& output)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-
-    if (iRouting)
-        {
-        CTelephonyAudioRouting::TAudioOutput taroutput;
-        taroutput = iRouting->PreviousOutput();
-        status = TMS_RESULT_SUCCESS;
-        output = TOTMSOUTPUT(taroutput);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::GetAvailableOutputsL
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallCSAdpt::GetAvailableOutputsL(gint& count, CBufFlat*& outputsbuffer)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    TMSAudioOutput tmsoutput;
-
-    if (iRouting)
-        {
-        RBufWriteStream stream;
-        stream.Open(*outputsbuffer);
-        CleanupClosePushL(stream);
-
-        TArray<CTelephonyAudioRouting::TAudioOutput> availableOutputs =
-                iRouting->AvailableOutputs();
-
-        guint numOfItems = availableOutputs.Count();
-        count = numOfItems;
-        for (guint i = 0; i < numOfItems; i++)
-            {
-            tmsoutput = TOTMSOUTPUT(availableOutputs[i]);
-            stream.WriteUint32L(tmsoutput);
-            //TRACE_PRN_N1(_L("TMS->CallIPAdpt: outputs: [%d]"), availableOutputs[i]);
-            }
-
-        CleanupStack::PopAndDestroy(&stream);
-        status = TMS_RESULT_SUCCESS;
-        }
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-
-// From TMSCSPDevSoundObserver
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::DownlinkInitCompleted
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::DownlinkInitCompleted(TInt status)
-    {
-    TRACE_PRN_FN_ENT;
-    NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status, 0);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::UplinkInitCompleted
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::UplinkInitCompleted(TInt status)
-    {
-    TRACE_PRN_FN_ENT;
-    NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status, 0);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::UplinkActivatedSuccessfully
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::UplinkActivatedSuccessfully()
-    {
-    TRACE_PRN_FN_ENT;
-    NotifyClient(iUplinkStreamId, ECmdUplinkStarted, KErrNone, 0);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::DownlinkActivatedSuccessfully
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::DownlinkActivatedSuccessfully()
-    {
-    TRACE_PRN_FN_ENT;
-    NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, KErrNone, 0);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::UplinkActivationFailed
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::UplinkActivationFailed()
-    {
-    TRACE_PRN_FN_ENT;
-    NotifyClient(iUplinkStreamId, ECmdUplinkStarted, TMS_RESULT_FATAL_ERROR, 0);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::DownlinkActivationFailed
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::DownlinkActivationFailed()
-    {
-    TRACE_PRN_FN_ENT;
-    NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted,
-            TMS_RESULT_FATAL_ERROR, 0);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::AvailableOutputsChanged
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::AvailableOutputsChanged(
-        CTelephonyAudioRouting& /*aTelephonyAudioRouting*/)
-    {
-    TRACE_PRN_FN_ENT;
-    TRoutingMsgBufPckg pckg;
-    pckg().iEvent = TMS_EVENT_ROUTING_AVAIL_OUTPUTS_CHANGED;
-    iTarSettings->SetTar(pckg, ETrue);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::OutputChanged
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::OutputChanged(
-        CTelephonyAudioRouting& aTelephonyAudioRouting)
-    {
-    TRACE_PRN_FN_ENT;
-    TRoutingMsgBufPckg pckg;
-    pckg().iEvent = TMS_EVENT_ROUTING_OUTPUT_CHANGED;
-    pckg().iOutput = TOTMSOUTPUT(aTelephonyAudioRouting.Output());
-    iTarSettings->SetTar(pckg, ETrue);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::SetOutputComplete
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::SetOutputComplete(
-        CTelephonyAudioRouting& aTelephonyAudioRouting, gint /*aError*/)
-    {
-    TRACE_PRN_FN_ENT;
-    TRoutingMsgBufPckg pckg;
-    pckg().iEvent = TMS_EVENT_ROUTING_SET_OUTPUT_COMPLETE;
-    pckg().iOutput = TOTMSOUTPUT(aTelephonyAudioRouting.Output());
-    if (iTarSettings)
-        {
-        iTarSettings->SetTar(pckg, ETrue);
-        }
-    //TRACE_PRN_IF_ERR(aError);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallCSAdpt::NotifyClient
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallCSAdpt::NotifyClient(const gint strmId, const gint aCommand,
-        const gint aStatus, const gint64 /*aInt64*/)
-    {
-    iMsgBuffer.iRequest = aCommand;
-    iMsgBuffer.iStatus = aStatus;
-
-    if (strmId == iUplinkStreamId)
-        {
-        iMsgQueueUp.Send(iMsgBuffer);
-        }
-    else if (strmId == iDnlinkStreamId)
-        {
-        iMsgQueueDn.Send(iMsgBuffer);
-        }
-    }
-
-// End of file
--- a/mmserv/tms/tmscallserver/src/callipadpt.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1402 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <AudioPreference.h>
-#include "tmsutility.h"
-#include "tmsclientserver.h"
-#include "tmsshared.h"
-#include "ipcallstream.h"
-#include "callipadpt.h"
-
-using namespace TMS;
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::NewL
-// Symbian constructor.
-// -----------------------------------------------------------------------------
-//
-TMSCallIPAdpt* TMSCallIPAdpt::NewL()
-    {
-    TMSCallIPAdpt* self = new (ELeave) TMSCallIPAdpt();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::ConstructL
-// 2-nd phase constructor.
-// -----------------------------------------------------------------------------
-//
-void TMSCallIPAdpt::ConstructL()
-    {
-    TRACE_PRN_FN_ENT;
-    iIPUplink = NULL;
-    iIPDownlink = NULL;
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::TMSCallIPAdpt
-//
-// -----------------------------------------------------------------------------
-//
-TMSCallIPAdpt::TMSCallIPAdpt()
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::~TMSCallIPAdpt
-//
-// -----------------------------------------------------------------------------
-//
-TMSCallIPAdpt::~TMSCallIPAdpt()
-    {
-    TRACE_PRN_FN_ENT;
-
-    iCodecs.Reset();
-    iCodecs.Close();
-    iArrBitrates.Reset();
-
-    delete iIPUplink;
-    delete iIPDownlink;
-
-    if (iMsgQueueUp.Handle() > 0)
-        {
-        iMsgQueueUp.Close();
-        }
-    if (iMsgQueueDn.Handle() > 0)
-        {
-        iMsgQueueDn.Close();
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::PostConstruct
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::PostConstruct()
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    iNextStreamId = 1;
-    iUplinkInitialized = FALSE;
-    iDnlinkInitialized = FALSE;
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::CreateStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::CreateStream(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint& outStrmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            {
-            status = TMS_RESULT_ALREADY_EXIST;
-            if (!iUplinkInitialized)
-                {
-                iUplinkInitialized = TRUE;
-                iUplinkStreamId = iNextStreamId;
-                outStrmId = iUplinkStreamId;
-                iNextStreamId++;
-                status = TMS_RESULT_SUCCESS;
-                }
-            break;
-            }
-        case TMS_STREAM_DOWNLINK:
-            {
-            status = TMS_RESULT_ALREADY_EXIST;
-            if (!iDnlinkInitialized)
-                {
-                iDnlinkInitialized = TRUE;
-                iDnlinkStreamId = iNextStreamId;
-                outStrmId = iDnlinkStreamId;
-                iNextStreamId++;
-                status = TMS_RESULT_SUCCESS;
-                }
-            break;
-            }
-        default:
-            {
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-            }
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::InitStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::InitStreamL(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId, TMSFormatType frmtType,
-        const RMessage2& aMessage)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-
-    TUint32 fourCC = TOFOURCC(frmtType);
-    if (fourCC == NULL)
-        {
-        return TMS_RESULT_INVALID_ARGUMENT;
-        }
-
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            {
-            status = TMS_RESULT_DOES_NOT_EXIST;
-            if (strmId == iUplinkStreamId)
-                {
-                SetFormat(iUplinkStreamId, fourCC);
-                status = OpenUplinkL(aMessage);
-                NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
-                }
-            break;
-            }
-        case TMS_STREAM_DOWNLINK:
-            {
-            status = TMS_RESULT_DOES_NOT_EXIST;
-            if (strmId == iDnlinkStreamId)
-                {
-                SetFormat(iDnlinkStreamId, fourCC);
-                status = OpenDownlinkL(aMessage);
-                NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
-                }
-            break;
-            }
-        default:
-            {
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-            }
-        }
-
-    TRACE_PRN_IF_ERR(status);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::StartStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::StartStream(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            {
-            if (strmId == iUplinkStreamId && iIPUplink)
-                {
-                iIPUplink->Start();
-                status = TMS_RESULT_SUCCESS;
-                NotifyClient(iUplinkStreamId, ECmdUplinkStarted, status);
-                }
-            break;
-            }
-        case TMS_STREAM_DOWNLINK:
-            {
-            if (strmId == iDnlinkStreamId && iIPDownlink)
-                {
-                iIPDownlink->Start();
-                status = TMS_RESULT_SUCCESS;
-                NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, status);
-                }
-            break;
-            }
-        default:
-            {
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-            }
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::PauseStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::PauseStream(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            {
-            if (strmId == iUplinkStreamId && iIPUplink)
-                {
-                iIPUplink->Stop();
-                status = TMS_RESULT_SUCCESS;
-                NotifyClient(iUplinkStreamId, ECmdUplinkPaused, status);
-                }
-            break;
-            }
-        case TMS_STREAM_DOWNLINK:
-            {
-            if (strmId == iDnlinkStreamId && iIPDownlink)
-                {
-                iIPDownlink->Stop();
-                status = TMS_RESULT_SUCCESS;
-                NotifyClient(iDnlinkStreamId, ECmdDownlinkPaused, status);
-                }
-            break;
-            }
-        default:
-            {
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-            }
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::StopStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::StopStream(TMSCallType /*callType*/, TMSStreamType strmType,
-        gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            {
-            if (strmId == iUplinkStreamId && iIPUplink)
-                {
-                iIPUplink->Stop();
-                status = TMS_RESULT_SUCCESS;
-                NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
-                }
-            break;
-            }
-        case TMS_STREAM_DOWNLINK:
-            {
-            if (strmId == iDnlinkStreamId && iIPDownlink)
-                {
-                iIPDownlink->Stop();
-                status = TMS_RESULT_SUCCESS;
-                NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
-                }
-            break;
-            }
-        default:
-            {
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-            }
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::DeinitStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::DeinitStream(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            {
-            if (strmId == iUplinkStreamId && iIPUplink)
-                {
-                iIPUplink->Stop();
-                //iUplinkStreamId = -1;
-                iUplinkInitialized = FALSE;
-                status = TMS_RESULT_SUCCESS;
-                NotifyClient(iUplinkStreamId, ECmdDownlinkDeInitComplete,
-                        status);
-                }
-            break;
-            }
-        case TMS_STREAM_DOWNLINK:
-            {
-            if (strmId == iDnlinkStreamId && iIPDownlink)
-                {
-                iIPDownlink->Stop();
-                //iDnlinkStreamId = -1;
-                iDnlinkInitialized = FALSE;
-                status = TMS_RESULT_SUCCESS;
-                NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete,
-                        status);
-                }
-            break;
-            }
-        default:
-            {
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-            }
-        }
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::DeleteStream
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::DeleteStream(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            {
-            // This is additional error checking
-            if (strmId == iUplinkStreamId)
-                {
-                iUplinkStreamId = -1;
-                iUplinkInitialized = FALSE;
-                }
-            break;
-            }
-        case TMS_STREAM_DOWNLINK:
-            {
-            // This is additional error checking
-            if (strmId == iDnlinkStreamId)
-                {
-                iDnlinkStreamId = -1;
-                iDnlinkInitialized = FALSE;
-                }
-            break;
-            }
-        default:
-            {
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-            }
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::DataXferBufferEmptied
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::DataXferBufferEmptied(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_UPLINK:
-            {
-            if (strmId == iUplinkStreamId)
-                {
-                TRAP(status, BufferEmptiedL());
-                }
-            break;
-            }
-        case TMS_STREAM_DOWNLINK:
-            status = TMS_RESULT_ILLEGAL_OPERATION;
-            break;
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::DataXferBufferFilled
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::DataXferBufferFilled(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId, guint datasize)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_DOWNLINK:
-            if (strmId == iDnlinkStreamId)
-                {
-                TRAP(status, BufferFilledL(datasize));
-                }
-            break;
-        case TMS_STREAM_UPLINK:
-            status = TMS_RESULT_ILLEGAL_OPERATION;
-            break;
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetDataXferBufferHndl
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetDataXferBufferHndl(const TMSCallType /*callType*/,
-        const TMSStreamType strmType, const gint strmId, const guint32 key,
-        RChunk& chunk)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (strmType)
-        {
-        case TMS_STREAM_DOWNLINK:
-            {
-            if (strmId == iDnlinkStreamId)
-                {
-                TRAP(status, GetDataXferChunkHndl(strmType, key, chunk));
-                }
-            break;
-            }
-        case TMS_STREAM_UPLINK:
-            {
-            if (strmId == iUplinkStreamId)
-                {
-                TRAP(status, GetDataXferChunkHndl(strmType, key, chunk));
-                }
-            break;
-            }
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetMaxVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetMaxVolume(guint& volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-
-    if (iDnlinkInitialized && iIPDownlink)
-        {
-        status = iIPDownlink->GetMaxVolume(volume);
-        iMaxVolume = volume;
-        TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt: GetMaxVolume [%d]"), iMaxVolume);
-        }
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetVolume(const guint volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iDnlinkInitialized && iIPDownlink)
-        {
-        status = iIPDownlink->SetVolume(volume);
-        NotifyClient(iDnlinkStreamId, ECmdSetVolume, status);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetVolume(guint& volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iDnlinkInitialized && iIPDownlink)
-        {
-        status = iIPDownlink->GetVolume(volume);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetMaxGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetMaxGain(guint& gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iUplinkInitialized && iIPUplink)
-        {
-        status = iIPUplink->GetMaxGain(gain);
-        iMaxGain = gain;
-        TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt::GetMaxGain [%d]"), iMaxGain);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetGain(const guint gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iUplinkInitialized && iIPUplink)
-        {
-        status = iIPUplink->SetGain(gain);
-        NotifyClient(iUplinkStreamId, ECmdSetGain, status);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetGain(guint& gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iUplinkInitialized && iIPUplink)
-        {
-        status = iIPUplink->GetGain(gain);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetGlobalMaxVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetGlobalMaxVolume(guint& volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iDnlinkInitialized && iIPDownlink)
-        {
-        status = iIPDownlink->GetMaxVolume(volume);
-        iMaxVolume = volume;
-        TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt: GetMaxVolume [%d]"), iMaxVolume);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetGlobalVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetGlobalVolume(const guint volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iDnlinkInitialized && iIPDownlink)
-        {
-        status = iIPDownlink->SetVolume(volume);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetGlobalVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetGlobalVolume(guint& volume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iDnlinkInitialized && iIPDownlink)
-        {
-        status = iIPDownlink->GetVolume(volume);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetGlobalMaxGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetGlobalMaxGain(guint& gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iUplinkInitialized && iIPUplink)
-        {
-        status = iIPUplink->GetMaxGain(gain);
-        iMaxGain = gain;
-        TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt::GetMaxGain [%d]"), iMaxGain);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetGlobalGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetGlobalGain(const guint gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iUplinkInitialized && iIPUplink)
-        {
-        status = iIPUplink->SetGain(gain);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetGlobalGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetGlobalGain(guint& gain)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iUplinkInitialized && iIPUplink)
-        {
-        status = iIPUplink->GetGain(gain);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetCodecMode(const TMSFormatType fmttype,
-        const TMSStreamType strmtype, gint& mode)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (fmttype)
-        {
-        case TMS_FORMAT_ILBC:
-            status = GetIlbcCodecMode(mode, strmtype);
-            break;
-        case TMS_FORMAT_G711:
-            status = GetG711CodecMode(mode, strmtype);
-            break;
-        default:
-            status = TMS_RESULT_FORMAT_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetCodecMode(const TMSFormatType fmttype,
-        const TMSStreamType strmtype, const gint mode)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-    switch (fmttype)
-        {
-        case TMS_FORMAT_ILBC:
-            status = SetIlbcCodecMode(mode, strmtype);
-            break;
-        case TMS_FORMAT_G711:
-            status = SetG711CodecMode(mode, strmtype);
-            break;
-        default:
-            status = TMS_RESULT_FORMAT_TYPE_NOT_SUPPORTED;
-            break;
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetSupportedBitRatesCount
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetSupportedBitRatesCount(guint& count)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iIPUplink)
-        {
-        status = iIPUplink->GetSupportedBitrates(iArrBitrates);
-        count = iArrBitrates.Count();
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetSupportedBitRates
-//
-// Bitrates are already returned from the codec as a result of call to
-// GetSupportedBitratesCount(). Just pack them into a descriptor and return
-// back to the client.
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetSupportedBitRates(CBufFlat*& brbuffer)
-    {
-    TRAPD(status, GetSupportedBitRatesL(brbuffer));
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetSupportedBitRatesL
-//
-// GetSupportedBitRates implementation which can leave.
-// -----------------------------------------------------------------------------
-//
-void TMSCallIPAdpt::GetSupportedBitRatesL(CBufFlat*& brbuffer)
-    {
-    TRACE_PRN_FN_ENT;
-    RBufWriteStream stream;
-    stream.Open(*brbuffer);
-    CleanupClosePushL(stream);
-    guint numOfItems = iArrBitrates.Count();
-
-    for (guint i = 0; i < numOfItems; i++)
-        {
-        stream.WriteUint32L(iArrBitrates[i]);
-        //TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt: BR: [%d]"), iArrBitrates[i]);
-        }
-
-    CleanupStack::PopAndDestroy(&stream);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetBitRate
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetBitRate(guint& bitrate)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iIPUplink)
-        {
-        status = iIPUplink->GetBitrate(bitrate);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetBitRate
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetBitRate(const guint bitrate)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iIPUplink)
-        {
-        status = iIPUplink->SetBitrate(bitrate);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetVAD
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetVAD(const TMSFormatType fmttype, gboolean& vad)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iIPUplink)
-        {
-        status = iIPUplink->GetVad(fmttype, vad);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetVAD
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetVAD(const TMSFormatType fmttype, const gboolean vad)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iIPUplink)
-        {
-        status = iIPUplink->SetVad(fmttype, vad);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetCNG
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetCNG(const TMSFormatType fmttype, gboolean& cng)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iIPDownlink)
-        {
-        status = iIPDownlink->GetCng(fmttype, cng);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetCNG
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetCNG(const TMSFormatType fmttype, const gboolean cng)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iIPDownlink)
-        {
-        status = iIPDownlink->SetCng(fmttype, cng);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetPlc
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetPlc(const TMSFormatType fmttype, gboolean& plc)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iIPDownlink)
-        {
-        status = iIPDownlink->GetPlc(fmttype, plc);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetPlc
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetPlc(const TMSFormatType fmttype, const gboolean plc)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_INVALID_STATE);
-    if (iIPDownlink)
-        {
-        status = iIPDownlink->SetPlc(fmttype, plc);
-        }
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::OpenDownlinkL
-// Method for player initialization.
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::OpenDownlinkL(const RMessage2& aMessage)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-
-    // Clients must have MultimediaDD capability to use this priority/pref.
-    // TODO: Also, TMS will monitor for emergency call and if detected it
-    //       will deny access to audio resources.
-    iPriority.iPref = KAudioPrefVoipAudioDownlink;
-    iPriority.iPriority = KAudioPriorityVoipAudioDownlink;
-
-    if (!iIPDownlink)
-        {
-        iIPDownlink = TMSIPDownlink::NewL(iDnFourCC, iPriority);
-        }
-
-    if (iIPDownlink)
-        {
-        // Open message queue for handling server notifications to the client
-        if (iMsgQueueDn.Handle() <= 0)
-            {
-            // Second argument in TMSCallProxy::InitStream
-            status = iMsgQueueDn.Open(aMessage, 1);
-            }
-
-        if (status == TMS_RESULT_SUCCESS)
-            {
-            // For transfer data buffer processing
-            iIPDownlink->SetMsgQueue(iMsgQueueDn);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(status);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::OpenUplinkL
-// Method for recorder initialization.
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::OpenUplinkL(const RMessage2& aMessage)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
-
-    // Ensure clients have MultimediaDD capability to use this priority/pref
-    iPriority.iPref = KAudioPrefVoipAudioUplink;
-    iPriority.iPriority = KAudioPriorityVoipAudioUplink;
-
-    if (!iIPUplink)
-        {
-        iIPUplink = TMSIPUplink::NewL(iUpFourCC, iPriority);
-        }
-
-    if (iIPUplink)
-        {
-        // Open message queue for handling server notifications to the client
-        if (iMsgQueueUp.Handle() <= 0)
-            {
-            // Second argument in TMSCallProxy::InitStream
-            status = iMsgQueueUp.Open(aMessage, 1);
-            }
-
-        if (status == TMS_RESULT_SUCCESS)
-            {
-            // For transfer data buffer processing
-            iIPUplink->SetMsgQueue(iMsgQueueUp);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(status);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetFormat
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallIPAdpt::SetFormat(const gint strmId, const TUint32 aFormat)
-    {
-    if (strmId == iUplinkStreamId)
-        {
-        iUpFourCC = aFormat;
-        }
-    else if (strmId == iDnlinkStreamId)
-        {
-        iDnFourCC = aFormat;
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::BufferFilled
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallIPAdpt::BufferFilledL(TUint dataSize)
-    {
-    if (iIPDownlink)
-        {
-        iIPDownlink->BufferFilled(dataSize);
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::BufferEmptied
-//
-// -----------------------------------------------------------------------------
-//
-void TMSCallIPAdpt::BufferEmptiedL()
-    {
-    if (iIPUplink)
-        {
-        iIPUplink->BufferEmptied();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetDataXferChunkHndl
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetDataXferChunkHndl(const TMSStreamType strmType,
-        const TUint32 key, RChunk& chunk)
-    {
-    TRACE_PRN_FN_ENT;
-
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    switch (strmType)
-        {
-        case TMS_STREAM_DOWNLINK:
-            {
-            if (iIPDownlink)
-                {
-                status = iIPDownlink->GetDataXferChunkHndl(key, chunk);
-                }
-            break;
-            }
-        case TMS_STREAM_UPLINK:
-            {
-            if (iIPUplink)
-                {
-                status = iIPUplink->GetDataXferChunkHndl(key, chunk);
-                }
-            break;
-            }
-        default:
-            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
-            break;
-        }
-
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetIlbcCodecMode(const gint mode,
-        const TMSStreamType strmtype)
-    {
-    gint status(TMS_RESULT_INVALID_ARGUMENT);
-
-    if (strmtype == TMS_STREAM_DOWNLINK)
-        {
-        if (iDnlinkInitialized && iIPDownlink)
-            {
-            status = iIPDownlink->SetIlbcCodecMode(mode);
-            }
-        }
-    else if (strmtype == TMS_STREAM_UPLINK)
-        {
-        if (iUplinkInitialized && iIPUplink)
-            {
-            status = iIPUplink->SetIlbcCodecMode(mode);
-            }
-        }
-
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetIlbcCodecMode(gint& mode, const TMSStreamType strmtype)
-    {
-    gint status(TMS_RESULT_INVALID_ARGUMENT);
-
-    if (strmtype == TMS_STREAM_DOWNLINK)
-        {
-        if (iDnlinkInitialized && iIPDownlink)
-            {
-            status = iIPDownlink->GetIlbcCodecMode(mode);
-            }
-        }
-    else if (strmtype == TMS_STREAM_UPLINK)
-        {
-        if (iUplinkInitialized && iIPUplink)
-            {
-            status = iIPUplink->GetIlbcCodecMode(mode);
-            }
-        }
-
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetG711CodecMode(const gint mode,
-        const TMSStreamType strmtype)
-    {
-    gint status(TMS_RESULT_INVALID_ARGUMENT);
-
-    if (strmtype == TMS_STREAM_DOWNLINK)
-        {
-        if (iDnlinkInitialized && iIPDownlink)
-            {
-            status = iIPDownlink->SetG711CodecMode(mode);
-            }
-        }
-    else if (strmtype == TMS_STREAM_UPLINK)
-        {
-        if (iUplinkInitialized && iIPUplink)
-            {
-            status = iIPUplink->SetG711CodecMode(mode);
-            }
-        }
-
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetG711CodecMode(gint& mode, const TMSStreamType strmtype)
-    {
-    gint status(TMS_RESULT_INVALID_ARGUMENT);
-
-    if (strmtype == TMS_STREAM_DOWNLINK)
-        {
-        if (iDnlinkInitialized && iIPDownlink)
-            {
-            status = iIPDownlink->GetG711CodecMode(mode);
-            }
-        }
-    else if (strmtype == TMS_STREAM_UPLINK)
-        {
-        if (iUplinkInitialized && iIPUplink)
-            {
-            status = iIPUplink->GetG711CodecMode(mode);
-            }
-        }
-
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::FrameModeRequiredForEC
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::FrameModeRqrdForEC(gboolean& frmodereq)
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iIPDownlink)
-        {
-        status = iIPDownlink->FrameModeRqrdForEC(frmodereq);
-        }
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetFrameMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetFrameMode(const gboolean frmode)
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iIPDownlink)
-        {
-        status = iIPDownlink->SetFrameMode(frmode);
-        }
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetFrameMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetFrameMode(gboolean& frmode)
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iIPDownlink)
-        {
-        status = iIPDownlink->GetFrameMode(frmode);
-        }
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::ConcealErrorForNextBuffer
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::ConcealErrorForNextBuffer()
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iIPDownlink)
-        {
-        status = iIPDownlink->ConcealErrorForNextBuffer();
-        }
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::BadLsfNextBuffer
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::BadLsfNextBuffer()
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iIPDownlink)
-        {
-        status = iIPDownlink->BadLsfNextBuffer();
-        }
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::SetOutput
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::SetOutput(TMSAudioOutput output)
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iDnlinkInitialized && iIPDownlink)
-        {
-        TRAP(status, iIPDownlink->SetAudioDeviceL(output));
-        }
-    return status;
-    }
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetOutput
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetOutput(TMSAudioOutput& output)
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iDnlinkInitialized && iIPDownlink)
-        {
-        TRAP(status, iIPDownlink->GetAudioDeviceL(output));
-        }
-    return status;
-    }
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetPreviousOutput
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetPreviousOutput(TMSAudioOutput& /*output*/)
-    {
-    return TMS_RESULT_FEATURE_NOT_SUPPORTED;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::GetAvailableOutputsL
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSCallIPAdpt::GetAvailableOutputsL(gint& /*count*/,
-        CBufFlat*& /*outputsbuffer*/)
-    {
-    return TMS_RESULT_FEATURE_NOT_SUPPORTED;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallIPAdpt::NotifyClient
-// -----------------------------------------------------------------------------
-//
-void TMSCallIPAdpt::NotifyClient(const gint strmId, const TInt aCommand,
-        const TInt aStatus, const TInt64 /*aInt64*/)
-    {
-    iMsgBuffer.iRequest = aCommand;
-    iMsgBuffer.iStatus = aStatus;
-
-    if (strmId == iUplinkStreamId)
-        {
-        iMsgQueueUp.Send(iMsgBuffer);
-        }
-    else if (strmId == iDnlinkStreamId)
-        {
-        iMsgQueueDn.Send(iMsgBuffer);
-        }
-    }
-
-// End of file
--- a/mmserv/tms/tmscallserver/src/csdownlink.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <AudioPreference.h>
-#include "csdownlink.h"
-#include "mcspdevsoundobserver.h"
-
-using namespace TMS;
-
-const gint KDefaultVolume = 4;
-const gint KDefaultMaxVolume = 10;
-
-// -----------------------------------------------------------------------------
-// Static constructor
-// -----------------------------------------------------------------------------
-//
-TMSCSDownlink* TMSCSDownlink::NewL(TMSCSPDevSoundObserver& aObserver)
-    {
-    TMSCSDownlink* self = new (ELeave) TMSCSDownlink(aObserver);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-TMSCSDownlink::~TMSCSDownlink()
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// Sets volume
-// -----------------------------------------------------------------------------
-//
-void TMSCSDownlink::SetVolume(gint aVolume)
-    {
-    if (iDevSound)
-        {
-        gint maxVolume(iDevSound->MaxVolume());
-        maxVolume = (maxVolume > 0) ? maxVolume : KDefaultMaxVolume;
-        gint scaledVolume = (aVolume * maxVolume) / KDefaultMaxVolume;
-        iDevSound->SetVolume(scaledVolume);
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// Gives volume
-// -----------------------------------------------------------------------------
-//
-gint TMSCSDownlink::Volume()
-    {
-    gint vol = 0;
-    if (iDevSound)
-        {
-        vol = iDevSound->Volume();
-        }
-    return vol;
-    }
-
-// -----------------------------------------------------------------------------
-// Gives max volume
-// -----------------------------------------------------------------------------
-//
-gint TMSCSDownlink::MaxVolume()
-    {
-    gint vol = 0;
-    if (iDevSound)
-        {
-        vol = iDevSound->MaxVolume();
-        }
-    return vol;
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Downlink stream has been activated successfully.
-// -----------------------------------------------------------------------------
-//
-void TMSCSDownlink::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
-    {
-    //CSPLOGSTRING( CSPINT, "TMSCSDownlink:: activated" );
-    // We dont react to devsound messages unless we are activating.
-    if (IsActivationOngoing())
-        {
-        iActive = ETrue;
-        iActivationOngoing = EFalse;
-        iObserver.DownlinkActivatedSuccessfully();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Downlink stream activation failed
-// -----------------------------------------------------------------------------
-//
-void TMSCSDownlink::PlayError(TInt aError)
-    {
-    //CSPLOGSTRING( CSPINT, "TMSCSDownlink::PlayError" );
-
-    // We dont react to devsound messages unless we are activating.
-    if (IsActivationOngoing())
-        {
-        //CSPLOGSTRING( CSPINT, "TMSCSDownlink::PlayError activation failed" );
-        if (aError == KErrAccessDenied)
-            {
-            iActivationOngoing = EFalse;
-            iObserver.DownlinkActivationFailed();
-            }
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// From class CSPDevsound
-// Tries to activate Downlink stream.
-// -----------------------------------------------------------------------------
-//
-void TMSCSDownlink::DoActivateL()
-    {
-    if (iDevSound)
-        {
-        iDevSound->PlayInitL();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// Constructor
-// -----------------------------------------------------------------------------
-//
-TMSCSDownlink::TMSCSDownlink(TMSCSPDevSoundObserver& aObserver) :
-    TMSCSPDevSound(aObserver)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// Second phase constructor
-// -----------------------------------------------------------------------------
-//
-void TMSCSDownlink::ConstructL()
-    {
-    TMSCSPDevSound::ConstructL(EMMFStatePlaying, KAudioPrefCSCallDownlink,
-            KAudioPriorityCSCallDownlink);
-
-    if (iDevSound)
-        {
-        iDevSound->SetVolume(KDefaultVolume);
-        }
-    }
-
-//  End of File
--- a/mmserv/tms/tmscallserver/src/cspdevsound.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <AudioPreference.h>
-#include <glib.h>
-#include <S60FourCC.h>
-#include "cspdevsound.h"
-#include "mcspdevsoundobserver.h"
-
-using namespace TMS;
-
-// -----------------------------------------------------------------------------
-// TMSCSPDevSound
-// -----------------------------------------------------------------------------
-//
-TMSCSPDevSound::TMSCSPDevSound(TMSCSPDevSoundObserver& aObserver) :
-    iObserver(aObserver)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// ConstructL
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::ConstructL(TMMFState aMode, gint aAudioPreference,
-        gint aAudioPriority)
-    {
-    TMMFPrioritySettings audioPriority;
-    TFourCC modemFourCC;
-    modemFourCC.Set(KS60FourCCCodeModem);
-    iDevSound = CMMFDevSound::NewL();
-    if (iDevSound)
-        {
-#ifndef __WINSCW__
-        iDevSound->InitializeL(*this, modemFourCC, aMode);
-#else //For testing TMS in WINSCW
-        iDevSound->InitializeL(*this, KMMFFourCCCodePCM16, aMode);
-#endif
-        iStreamType = aAudioPreference;
-        audioPriority.iPriority = aAudioPriority;
-        audioPriority.iPref = aAudioPreference;
-        audioPriority.iState = aMode;
-        iDevSound->SetPrioritySettings(audioPriority);
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Not implemented
-// -----------------------------------------------------------------------------
-//
-TMSCSPDevSound::~TMSCSPDevSound()
-    {
-    delete iDevSound;
-    }
-
-// -----------------------------------------------------------------------------
-// Tries to activate the audio stream if not active or activating
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::Activate()
-    {
-    if (!IsActive() && !IsActivationOngoing())
-        {
-        iActivationOngoing = ETrue;
-        TRAP_IGNORE(DoActivateL());
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// Deactivates the audio device.
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::Deactivate()
-    {
-    if (iDevSound && (IsActive() || IsActivationOngoing()))
-        {
-        iDevSound->Stop();
-        iActive = EFalse;
-        iActivationOngoing = EFalse;
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// ActivationOngoing
-// -----------------------------------------------------------------------------
-//
-TBool TMSCSPDevSound::IsActivationOngoing() const
-    {
-    return iActivationOngoing;
-    }
-
-// -----------------------------------------------------------------------------
-// IsActive
-// -----------------------------------------------------------------------------
-//
-TBool TMSCSPDevSound::IsActive() const
-    {
-    return iActive;
-    }
-
-// -----------------------------------------------------------------------------
-// DevSound
-// -----------------------------------------------------------------------------
-//
-CMMFDevSound& TMSCSPDevSound::DevSound()
-    {
-    return *iDevSound;
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Not implemented
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::InitializeComplete(TInt aError)
-    {
-    if (iStreamType == KAudioPrefCSCallDownlink)
-        {
-        iObserver.DownlinkInitCompleted(aError);
-        }
-    else
-        {
-        iObserver.UplinkInitCompleted(aError);
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Not implemented
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Not implemented
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::PlayError(TInt /*aError*/)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Not implemented
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::ToneFinished(TInt /*aError*/)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Not implemented
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Not implemented
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::RecordError(TInt /*aError*/)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Not implemented
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::ConvertError(TInt /*aError*/)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Not implemented
-// -----------------------------------------------------------------------------
-//
-void TMSCSPDevSound::DeviceMessage(TUid /*aMessageType*/,
-        const TDesC8& /*aMsg*/)
-    {
-    }
-
-//  End of File
--- a/mmserv/tms/tmscallserver/src/csuplink.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <AudioPreference.h>
-#include "csuplink.h"
-#include "mcspdevsoundobserver.h"
-
-using namespace TMS;
-
-// Mute value
-const gint KSetMuteToDevSound = 0;
-
-// -----------------------------------------------------------------------------
-// Static constructor.
-// -----------------------------------------------------------------------------
-//
-TMSCSUplink* TMSCSUplink::NewL(TMSCSPDevSoundObserver& aObserver)
-    {
-    TMSCSUplink* self = new (ELeave) TMSCSUplink(aObserver);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-//
-TMSCSUplink::~TMSCSUplink()
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// Gives mic mute state
-// -----------------------------------------------------------------------------
-//
-TBool TMSCSUplink::IsMuted()
-    {
-    TBool isMuted = EFalse;
-    gint gain = 0;
-    if (iDevSound)
-        {
-        gain = iDevSound->Gain();
-        }
-    if (!gain)
-        {
-        // Mute is on
-        isMuted = ETrue;
-        }
-    //   CSPLOGSTRING( CSPINT, "TMSCSUplink::IsMuted" );
-    return isMuted;
-    }
-
-// -----------------------------------------------------------------------------
-// Set mic muted.
-// -----------------------------------------------------------------------------
-//
-void TMSCSUplink::SetMuted()
-    {
-    if (iDevSound)
-        {
-        iDevSound->SetGain(KSetMuteToDevSound);
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// Set mic unmuted
-// -----------------------------------------------------------------------------
-//
-void TMSCSUplink::SetUnmuted()
-    {
-    if (iDevSound)
-        {
-        iDevSound->SetGain(iDevSound->MaxGain());
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// Sets gain
-// -----------------------------------------------------------------------------
-//
-void TMSCSUplink::SetGain(gint aGain)
-    {
-    if (iDevSound)
-        {
-        iDevSound->SetGain(aGain);
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// Gives volume
-// -----------------------------------------------------------------------------
-//
-gint TMSCSUplink::Gain()
-    {
-    gint gain = 0;
-    if (iDevSound)
-        {
-        gain = iDevSound->Gain();
-        }
-    return gain;
-    }
-
-// -----------------------------------------------------------------------------
-// Gives max gain
-// -----------------------------------------------------------------------------
-//
-gint TMSCSUplink::MaxGain()
-    {
-    gint gain = 0;
-    if (iDevSound)
-        {
-        gain = iDevSound->MaxGain();
-        }
-    return gain;
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Activation was successfull.
-// -----------------------------------------------------------------------------
-//
-void TMSCSUplink::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/)
-    {
-    //  CSPLOGSTRING( CSPINT, "TMSCSUplink::BufferToBeEmptied" );
-
-    // We dont react to devsound messages unless we are activating.
-    if (IsActivationOngoing())
-        {
-        iActive = ETrue;
-        iActivationOngoing = EFalse;
-        iObserver.UplinkActivatedSuccessfully();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// From class MDevSoundObserver
-// Activation feiled
-// -----------------------------------------------------------------------------
-//
-void TMSCSUplink::RecordError(TInt aError)
-    {
-    //  CSPLOGSTRING( CSPINT, "TMSCSUplink::RecordError" );
-
-    // We dont react to devsound messages unless we are activating.
-    if (IsActivationOngoing())
-        {
-        if (aError == KErrAccessDenied)
-            {
-            iActivationOngoing = EFalse;
-            iObserver.UplinkActivationFailed();
-            }
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// From class TMSCSPDevSound
-// Tries to activate mic stream. Stream becomes active when BufferToBeFilled
-// gets called.
-// -----------------------------------------------------------------------------
-//
-void TMSCSUplink::DoActivateL()
-    {
-    if (iDevSound)
-        {
-        iDevSound->RecordInitL();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// Constructor
-// -----------------------------------------------------------------------------
-//
-TMSCSUplink::TMSCSUplink(TMSCSPDevSoundObserver& aObserver) :
-    TMSCSPDevSound(aObserver)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// Second phase constructor
-// -----------------------------------------------------------------------------
-//
-void TMSCSUplink::ConstructL()
-    {
-    TMSCSPDevSound::ConstructL(EMMFStateRecording, KAudioPrefCSCallUplink,
-            KAudioPriorityCSCallUplink);
-    }
-
-//  End of File
--- a/mmserv/tms/tmscallserver/src/delaytimer.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-// INCLUDE FILES
-#include "delaytimer.h"
-#include "tmsutility.h"
-
-using namespace TMS;
-
-// -----------------------------------------------------------------------------
-// TMSCallDelayTimer::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-TMSCallDelayTimer* TMSCallDelayTimer::NewL()
-    {
-    TRACE_PRN_FN_ENT;
-    TMSCallDelayTimer* self = new (ELeave) TMSCallDelayTimer;
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_PRN_FN_EXT;
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallDelayTimer::TMSCallDelayTimer()
-// C++ constructor.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TMSCallDelayTimer::TMSCallDelayTimer() :
-    CActive(CActive::EPriorityStandard)
-    {
-    TRACE_PRN_FN_ENT;
-    CActiveScheduler::Add(this);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallDelayTimer::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void TMSCallDelayTimer::ConstructL()
-    {
-    TRACE_PRN_FN_ENT;
-    User::LeaveIfError(iShutDownTimer.CreateLocal());
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallDelayTimer::~TMSCallDelayTimer
-// Destructor
-// -----------------------------------------------------------------------------
-//
-TMSCallDelayTimer::~TMSCallDelayTimer()
-    {
-    TRACE_PRN_FN_ENT;
-    Cancel();
-    iShutDownTimer.Close();
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallDelayTimer::SetDelay
-// Request a timeout after aDelay
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void TMSCallDelayTimer::SetDelay(TTimeIntervalMicroSeconds32 aDelay)
-    {
-    TRACE_PRN_FN_ENT;
-    if (!IsActive())
-        {
-        iStatus = KRequestPending;
-        SetActive();
-        iShutDownTimer.After(iStatus, aDelay);
-        }
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallDelayTimer::RunL
-// Called by Active object framework when timer times out.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void TMSCallDelayTimer::RunL()
-    {
-    TRACE_PRN_FN_ENT;
-    CActiveScheduler::Stop();
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCallDelayTimer::DoCancel
-// Called by the Active object framework when user cancels active object.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void TMSCallDelayTimer::DoCancel()
-    {
-    TRACE_PRN_FN_ENT;
-    iShutDownTimer.Cancel();
-    TRACE_PRN_FN_EXT;
-    }
-
-//  End of File
--- a/mmserv/tms/tmscallserver/src/ipcalldownlink.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,911 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <audiopreference.h>
-#include <audiooutput.h>
-#include <mmcccodecinformation.h>
-#include <gstappsrc.h>
-#include "tmsutility.h"
-#include "gsterrorconcealmentinterface.h"
-#include "gstg711decoderinterface.h"
-#include "gstilbcdecoderinterface.h"
-#include "gstg729decoderinterface.h"
-#include "ipcallstream.h"
-
-using namespace TMS;
-
-static TMSIPDownlink* iSelfDn;
-#ifdef _DEBUG
-static TInt iHeap;
-#endif //_DEBUG
-GstBuffer* gstDnlBuffer;
-GstCaps* caps;
-gint requestBufLen;
-
-#ifdef __PLAY_WAV_FROM_FILE__
-_LIT16(KTestFile1, "c:\\data\\sounds\\digital\\sample1.wav");
-#endif
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::cb_raw_playback_handoff
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::cb_raw_playback_handoff(GstElement* /*appsrc*/,
-        guint size)
-    {
-    TRACE_PRN_N(_L("TMS->DNL: cb_raw_playback_handoff"));
-
-    requestBufLen = size;
-
-#ifdef _DEBUG
-    TInt block;
-    RHeap &heap = User::Heap();
-    TInt avail = heap.Available(block);
-    RDebug::Print(_L("TMS->PRINT-HEAP-DN:Size[%d], Available[%d], delta[%d]"),
-    heap.Size(), avail, (iHeap - avail));
-    iHeap = avail;
-#endif //_DEBUG
-    iSelfDn->BufferToBeFilled();
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::bus_call
-// -----------------------------------------------------------------------------
-//
-gboolean TMSIPDownlink::bus_call(GstBus* /*bus*/, GstMessage* msg,
-        gpointer /*data*/)
-    {
-    switch (GST_MESSAGE_TYPE(msg))
-        {
-        case GST_MESSAGE_EOS:
-            {
-            gst_element_set_state(iSelfDn->iPipelinePlay, GST_STATE_NULL);
-            gst_object_unref(GST_OBJECT(iSelfDn->iPipelinePlay));
-            break;
-            }
-        case GST_MESSAGE_ERROR:
-            {
-            gchar* debug;
-            GError* err;
-            gst_message_parse_error(msg, &err, &debug);
-            g_free(debug);
-            g_print("Error: %s\n", err->message);
-            g_error_free(err);
-            break;
-            }
-        default:
-            {
-            break;
-            }
-        }
-
-    return ETrue;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::gst_initialize_play
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::gst_initialize_play()
-    {
-    TRACE_PRN_FN_ENT;
-
-    gint err = KErrNone;
-
-    // create elements
-    iPipelinePlay = gst_pipeline_new("pipelinePlay");
-    iAppSrc = gst_element_factory_make("appsrc", "source");
-    iSink = gst_element_factory_make("devsoundsink", "sink");
-
-    if (!iAppSrc || !iSink)
-        {
-        err = KErrNotFound;
-        TRACE_PRN_IF_ERR(err);
-        return err;
-        }
-
-    iBusPlay = gst_pipeline_get_bus(GST_PIPELINE(iPipelinePlay));
-    gst_bus_add_watch(iBusPlay, TMSIPDownlink::bus_call, NULL);
-    gst_object_unref(iBusPlay);
-
-    iMaxBufLen = ConfigureMedia(iCodecID);
-
-    g_object_set(iAppSrc, "stream-type", 0, "blocksize", iMaxBufLen, NULL);
-    gst_bin_add_many(GST_BIN(iPipelinePlay), iAppSrc, iSink, NULL);
-    gst_element_link(iAppSrc, iSink);
-
-    caps = gst_caps_new_simple(iMediaType,
-                               "width", G_TYPE_INT, 16,
-                               "depth", G_TYPE_INT, 16,
-                               "signed", G_TYPE_BOOLEAN, TRUE,
-                               "endianness", G_TYPE_INT, G_BYTE_ORDER,
-                               "rate", G_TYPE_INT, 8000,
-                               "channels", G_TYPE_INT, 1,
-                               NULL);
-
-    //NOTE: d/s is not ready at this time to return true maxvolume
-    TInt maxvol = 10;
-#ifdef __WINSCW__
-    maxvol = 10000;
-#endif //__WINSCW__
-    g_object_set(G_OBJECT(iSink),
-                 "volume", maxvol,
-#ifndef __WINSCW__
-                "priority", (gint)iPriority.iPriority,
-                "preference", (gint)iPriority.iPref,
-#endif
-                NULL);
-
-    gst_app_src_set_caps(GST_APP_SRC(iAppSrc), caps);
-    gst_app_src_set_max_bytes(GST_APP_SRC(iAppSrc), iMaxBufLen);
-    err = SetCodecCi();
-    //gst_element_set_state(iPipelinePlay, GST_STATE_READY);
-
-    TRACE_PRN_FN_EXT;
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::gst_play_raw
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::gst_play_raw()
-    {
-    TRACE_PRN_FN_ENT;
-
-    // start playback
-    gst_element_set_state(iPipelinePlay, GST_STATE_PLAYING);
-
-    //configure the appsrc, we will push buffer to appsrc when it needs more data
-    g_signal_connect(iAppSrc, "need-data",
-                     G_CALLBACK (cb_raw_playback_handoff),
-                     NULL);
-    TRACE_PRN_FN_EXT;
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::TMSIPDownlink
-// Standard Constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPDownlink::TMSIPDownlink()
-    {
-    iSelfDn = this;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::~TMSIPDownlink
-// Standard Constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPDownlink::~TMSIPDownlink()
-    {
-    TRACE_PRN_FN_ENT;
-
-    Stop();
-    gst_caps_unref(caps);
-    gst_object_unref(GST_OBJECT(iPipelinePlay));
-    gst_deinit();
-
-    delete iErrConcealmentIntfc;
-    delete iG711DecoderIntfc;
-    delete iG729DecoderIntfc;
-    delete iIlbcDecoderIntfc;
-
-#ifdef __PLAY_WAV_FROM_FILE__
-    iFs.Close();
-    delete fbuf;
-#endif
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::NewL
-// Symbian two-phase constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPDownlink* TMSIPDownlink::NewL(const guint32 codecID,
-        const TMMFPrioritySettings priority)
-    {
-    TMSIPDownlink* self = new (ELeave) TMSIPDownlink();
-    CleanupStack::PushL(self);
-    self->ConstructL(codecID, priority);
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::ConstructL
-// Part two of Symbian two phase construction
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::ConstructL(const guint32 codecID,
-        const TMMFPrioritySettings priority)
-    {
-    TRACE_PRN_FN_ENT;
-
-    iCodecID = codecID;
-    iPriority = priority;
-    //    SetTime();
-    gst_init(NULL, NULL);
-    //    CalcLatency();
-    //    SetTime();
-
-    gint err = gst_initialize_play();
-    if (err != TMS_RESULT_SUCCESS)
-        {
-        User::Leave(err);
-        }
-
-    // Client must set these before querying!
-    iG711DecodeMode = TMS_G711_CODEC_MODE_ALAW;
-    iILBCDecodeMode = TMS_ILBC_CODEC_MODE_20MS_FRAME;
-
-#ifdef __PLAY_WAV_FROM_FILE__
-    iReadSize = KVoIPPCM16FrameLen;
-    err = iFs.Connect();
-    if (err == KErrNone)
-        {
-        err = iFile.Open(iFs, KTestFile1, EFileShareAny | EFileRead);
-        }
-    if (err == KErrNone)
-        {
-        iFile.Size(fsize);
-        }
-    fbuf = HBufC8::NewL(fsize);
-    TPtr8 p = fbuf->Des();
-    iFile.Read(p, fsize);
-    iFile.Close();
-#endif
-    //    CalcLatency();
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::Start
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::Start()
-    {
-    TRACE_PRN_FN_ENT;
-
-    gst_play_raw();
-    iStatus = EStreaming;
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::Stop
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::Stop()
-    {
-    TRACE_PRN_FN_ENT;
-
-    if (iStatus == EStreaming)
-        {
-        if (iPipelinePlay != NULL &&
-            iPipelinePlay->current_state == GST_STATE_PLAYING)
-            {
-            gst_element_set_state(iPipelinePlay, GST_STATE_NULL);
-            }
-
-        iStatus = EReady;
-        }
-
-    if (gstDnlBuffer)
-        {
-        gst_buffer_unref(gstDnlBuffer);
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::BufferToBeFilled
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::BufferToBeFilled()
-    {
-    TRACE_PRN_N1(_L("TMS->DNL->BTBF: requestBufLen[%d]"), requestBufLen);
-
-#ifndef __PLAY_WAV_FROM_FILE__
-    // Create or adjust the chunk
-    TInt err = DoChunk(requestBufLen, iMsgBuffer);
-
-    if (err != TMS_RESULT_SUCCESS)
-        {
-        Stop();
-        iMsgBuffer.iStatus = err;
-        }
-    else
-        {
-        // Notify client there is buffer ready to be filled
-        iMsgBuffer.iStatus = iChunk.Handle();
-        iMsgBuffer.iInt = requestBufLen;
-        iStatus = EStreaming;
-        // If chunk is opened, we will expect a call from the client to
-        // get chunk handle. When we get a call to copy chunk handle,
-        // check these variables and see if they match. This is not
-        // completely secure, but will provide some level of security
-        if (iMsgBuffer.iBool == TRUE)
-            {
-            iWriteDataXferHndlToClient = TRUE;
-            iKey = iMsgBuffer.iUint32;
-            }
-        }
-
-    iMsgBuffer.iRequest = ECmdFillBuffer;
-    iMsgQueue.Send(iMsgBuffer);
-
-#else //__PLAY_WAV_FROM_FILE__
-    TInt err = KErrNone;
-    BufferFilled();
-#endif //__PLAY_WAV_FROM_FILE__
-    TRACE_PRN_IF_ERR(err);
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::BufferFilled
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::BufferFilled(const guint buflen)
-    {
-#ifndef __PLAY_WAV_FROM_FILE__
-    gstDnlBuffer = gst_buffer_new();
-    gst_buffer_set_caps(gstDnlBuffer, caps);
-    GST_BUFFER_SIZE(gstDnlBuffer) = buflen;
-
-    //TODO: what if bufLen > requestBufLen?
-
-    // IMPL#1:
-    // gstDnlBuffer->data pointer is set to use chunk pointer.
-    // Although unlikely in the pull mode, this may potentially result
-    // in data loss if chunk gets overwritten before it is consumed.
-    gst_buffer_set_data(gstDnlBuffer, iChunk.Base(), buflen);
-
-    // IMPL#2
-    // Alternative implementation with new buffer alloc and memcpy.
-    // GStreamer will free this memory when buffer refcount becomes 0.
-    //guint8* ptr = (guint8*)g_malloc(buflen);
-    //GST_BUFFER_MALLOCDATA(gstDnlBuffer) = GST_BUFFER_DATA(gstDnlBuffer) = ptr;
-    //memcpy(ptr, iChunk.Base(), buflen);
-
-#else //__PLAY_WAV_FROM_FILE__
-    User::After(TTimeIntervalMicroSeconds32(150000));
-
-    TPtr8 p = fbuf->Des();
-    TInt buflen = iReadSize;
-    gstDnlBuffer = gst_buffer_new_and_alloc(buflen);
-    gst_buffer_set_caps(gstDnlBuffer, caps);
-    unsigned char* ptr = (unsigned char*)((fbuf->Ptr())+iReadBytes);
-    gst_buffer_set_data(gstDnlBuffer, ptr, buflen);
-
-    if ((iReadBytes + iReadSize> fsize))
-        {
-        // start over from the beginning
-        iReadBytes = 0;
-        }
-    else
-        {
-        iReadBytes += iReadSize;
-        }
-
-#endif //__PLAY_WAV_FROM_FILE__
-    gst_app_src_push_buffer(GST_APP_SRC(iAppSrc), gstDnlBuffer);
-    TRACE_PRN_N1(_L("TMS->DNL->BF: LEN[%d]"), buflen);
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetCodecCi
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetCodecCi()
-    {
-    TRAPD(err, SetCodecCiL());
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetCodecCiL
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::SetCodecCiL()
-    {
-    TRACE_PRN_FN_ENT;
-
-    switch (iCodecID)
-        {
-        case KMccFourCCIdG711:
-            {
-            if (!iG711DecoderIntfc)
-                {
-                iG711DecoderIntfc = GST_G711_DECODER_GET_IFACE(iSink);
-                }
-            break;
-            }
-        case KMccFourCCIdG729:
-            {
-            if (!iG729DecoderIntfc)
-                {
-                iG729DecoderIntfc = GST_G729_DECODER_GET_IFACE(iSink);
-                }
-            break;
-            }
-        case KMccFourCCIdILBC:
-            {
-            if (!iIlbcDecoderIntfc)
-                {
-                iIlbcDecoderIntfc = GST_ILBC_DECODER_GET_IFACE(iSink);
-                }
-            break;
-            }
-        case KMccFourCCIdAMRNB:
-        case KMMFFourCCCodePCM16:
-            {
-            break;
-            }
-        default:
-            {
-            User::Leave(TMS_RESULT_INVALID_ARGUMENT);
-            }
-        }
-
-    if (iCodecID == KMccFourCCIdG711 ||
-        iCodecID == KMccFourCCIdG729 ||
-        iCodecID == KMccFourCCIdILBC ||
-        iCodecID == KMccFourCCIdAMRNB)
-        {
-        if (!iErrConcealmentIntfc)
-            {
-            iErrConcealmentIntfc = GST_ERROR_CONCEALMENT_GET_IFACE(iSink);
-            }
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetVolume(const guint volume)
-    {
-    g_object_set(G_OBJECT(iSink), "volume", volume, NULL);
-    TRACE_PRN_N1(_L("TMS->DNL: SetVolume [%d]"), volume);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetVolume(guint& volume)
-    {
-    g_object_get(G_OBJECT(iSink), "volume", &volume, NULL);
-    TRACE_PRN_N1(_L("TMS->DNL: GetVolume [%d]"), volume);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetMaxVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetMaxVolume(guint& volume)
-    {
-    g_object_get(G_OBJECT(iSink), "maxvolume", &volume, NULL);
-    TRACE_PRN_N1(_L("TMS->DNL: MaxVolume [%d]"), volume);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetDataXferChunkHndl
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetDataXferChunkHndl(const TUint32 key, RChunk& chunk)
-    {
-    gint status = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iChunk.Handle())
-        {
-        if (iWriteDataXferHndlToClient && (iKey == key))
-            {
-            chunk = iChunk;
-            iWriteDataXferHndlToClient = FALSE;
-            iKey = 0;
-            status = TMS_RESULT_SUCCESS;
-            }
-        else
-            {
-            status = TMS_RESULT_ILLEGAL_OPERATION;
-            }
-        }
-
-    TRACE_PRN_IF_ERR(status);
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetIlbcCodecMode(gint mode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iILBCDecodeMode = mode;
-
-        if (iIlbcDecoderIntfc && iCodecID == KMccFourCCIdILBC)
-            {
-            if (mode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
-                {
-                err = iIlbcDecoderIntfc->SetDecoderMode(E20msFrame);
-                TRACE_PRN_N(_L("TMS->DNL: iLBC Mode Set [20ms]"));
-                }
-            else if (mode == TMS_ILBC_CODEC_MODE_30MS_FRAME)
-                {
-                err = iIlbcDecoderIntfc->SetDecoderMode(E30msFrame);
-                TRACE_PRN_N(_L("TMS->DNL: iLBC Mode Set [30ms]"));
-                }
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetIlbcCodecMode(gint& mode)
-    {
-    // not available through CIs -> return cashed value
-    mode = iILBCDecodeMode;
-    TRACE_PRN_N1(_L("TMS->DNL: GetIlbcCodecMode [%d]"), mode);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetG711CodecMode(gint mode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iG711DecodeMode = mode;
-
-        if (iG711DecoderIntfc && iCodecID == KMccFourCCIdG711)
-            {
-            if (mode == TMS_G711_CODEC_MODE_ALAW)
-                {
-                err = iG711DecoderIntfc->SetDecoderMode(EDecALaw);
-                TRACE_PRN_N(_L("TMS->DNL: G711 Mode Set [ALaw]"));
-                }
-            else if (mode == TMS_G711_CODEC_MODE_MULAW)
-                {
-                err = iG711DecoderIntfc->SetDecoderMode(EDecULaw);
-                TRACE_PRN_N(_L("TMS->DNL: G711 Mode Set [uLaw]"));
-                }
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetG711CodecMode(gint& mode)
-    {
-    // not available through CIs -> return cached value
-    mode = iG711DecodeMode;
-    TRACE_PRN_N1(_L("TMS->DNL: GetG711CodecMode [%d]"), mode);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::FrameModeRqrdForEC
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::FrameModeRqrdForEC(gboolean& frmodereq)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        if (iErrConcealmentIntfc)
-            {
-            err = iErrConcealmentIntfc->FrameModeRqrdForEC(&frmodereq);
-            TRACE_PRN_N1(_L("TMS->DNL: FrameModeRqrdForEC [%d]"), frmodereq);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetFrameMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetFrameMode(const gboolean frmode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iFrameMode = frmode;
-
-        if (iErrConcealmentIntfc)
-            {
-            err = iErrConcealmentIntfc->SetFrameMode(frmode);
-            TRACE_PRN_N1(_L("TMS->DNL: SetFrameMode [%d]"), frmode);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetFrameMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetFrameMode(gboolean& frmode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iErrConcealmentIntfc)
-        {
-        // not available through CIs -> return cached value
-        frmode = iFrameMode;
-        TRACE_PRN_N1(_L("TMS->DNL: GetFrameMode [%d]"), frmode);
-        err = TMS_RESULT_SUCCESS;
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::ConcealErrorForNextBuffer
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::ConcealErrorForNextBuffer()
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iErrConcealmentIntfc)
-        {
-        err = iErrConcealmentIntfc->ConcealErrorForNextBuffer();
-        TRACE_PRN_N(_L("TMS->DNL: ConcealErrorForNextBuffer"));
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetCng
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetCng(const TMSFormatType fmttype, const gboolean cng)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
-            {
-            err = iG711DecoderIntfc->SetCng(cng);
-            TRACE_PRN_N1(_L("TMS->DNL: SetCng [%d]"), cng);
-            }
-        else if (fmttype == TMS_FORMAT_ILBC && iIlbcDecoderIntfc)
-            {
-            err = iIlbcDecoderIntfc->SetCng(cng);
-            TRACE_PRN_N1(_L("TMS->DNL: SetCng [%d]"), cng);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetCng
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetCng(const TMSFormatType fmttype, gboolean& cng)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
-            {
-            err = iG711DecoderIntfc->GetCng(&cng);
-            TRACE_PRN_N1(_L("TMS->DNL: GetCng [%d]"), cng);
-            }
-        else if (fmttype == TMS_FORMAT_ILBC && iIlbcDecoderIntfc)
-            {
-            err = iIlbcDecoderIntfc->GetCng(&cng);
-            TRACE_PRN_N1(_L("TMS->DNL: GetCng [%d]"), cng);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetPlc
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetPlc(const TMSFormatType fmttype, const gboolean plc)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
-            {
-            iPlc = plc;
-            err = iG711DecoderIntfc->SetPlc(iPlc);
-            TRACE_PRN_N1(_L("TMS->DNL: SetPlc [%d]"), plc);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetPlc
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetPlc(const TMSFormatType fmttype, gboolean& plc)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
-        {
-        // not available through CIs -> return cached value
-        plc = iPlc;
-        err = TMS_RESULT_SUCCESS;
-        TRACE_PRN_N1(_L("TMS->DNL: GetPlc [%d]"), plc);
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::BadLsfNextBuffer
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::BadLsfNextBuffer()
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EStreaming)
-        {
-        if (iCodecID == KMccFourCCIdG729 && iG729DecoderIntfc)
-            {
-            err = iG729DecoderIntfc->BadLsfNextBuffer();
-            TRACE_PRN_N(_L("TMS->DNL: BadLsfNextBuffer"));
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetAudioDeviceL
-//
-// -----------------------------------------------------------------------------
-void TMSIPDownlink::SetAudioDeviceL(TMSAudioOutput output)
-    {
-    gint outputDev;
-
-    // ENoPreference=0, EAll=1, ENoOutput=2, EPrivate=3, EPublic=4
-    switch (output)
-        {
-        case TMS_AUDIO_OUTPUT_PRIVATE:
-        case TMS_AUDIO_OUTPUT_HANDSET:
-            outputDev = (gint)CAudioOutput::EPrivate;
-            break;
-        case TMS_AUDIO_OUTPUT_PUBLIC:
-        case TMS_AUDIO_OUTPUT_LOUDSPEAKER:
-            outputDev = (gint)CAudioOutput::EPublic;
-            break;
-        default: // Use default device routing
-            outputDev = (gint)CAudioOutput::ENoPreference;
-            break;
-        }
-
-    g_object_set(G_OBJECT(iSink), "outputdevice", outputDev, NULL);
-    TRACE_PRN_N1(_L("TMS->DNL: SetAudioDeviceL [%d]"), outputDev);
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetAudioDeviceL
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::GetAudioDeviceL(TMSAudioOutput& output)
-    {
-    TRACE_PRN_FN_ENT;
-
-    gint outputDev;
-    g_object_get(G_OBJECT(iSink), "outputdevice", &outputDev, NULL);
-    TRACE_PRN_N1(_L("TMS->DNL: GetAudioDevice [%d]"), outputDev);
-
-    switch (outputDev)
-        {
-        case CAudioOutput::ENoPreference:
-        case CAudioOutput::EAll:
-        case CAudioOutput::ENoOutput:
-        case CAudioOutput::EPrivate:
-            output = TMS_AUDIO_OUTPUT_PRIVATE;
-            break;
-        case CAudioOutput::EPublic:
-            output = TMS_AUDIO_OUTPUT_PUBLIC;
-            break;
-        default:
-            output = TMS_AUDIO_OUTPUT_PRIVATE;
-            break;
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// End of file
--- a/mmserv/tms/tmscallserver/src/ipcalldownlinkds.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,815 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <AudioPreference.h>
-#include <AudioOutput.h>
-#include <mmcccodecinformation.h>
-#include <IlbcDecoderIntfc.h>
-#include <G711DecoderIntfc.h>
-#include <G729DecoderIntfc.h>
-#include <ErrorConcealmentIntfc.h>
-#include "tmsutility.h"
-#include "ipcallstream.h"
-
-using namespace TMS;
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::TMSIPDownlink
-// Standard Constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPDownlink::TMSIPDownlink()
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::~TMSIPDownlink
-// Standard Constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPDownlink::~TMSIPDownlink()
-    {
-    TRACE_PRN_FN_ENT;
-
-    Stop();
-
-    delete iAudioOutput;
-    delete iErrConcealmentIntfc;
-    delete iG711DecoderIntfc;
-    delete iG729DecoderIntfc;
-    delete iIlbcDecoderIntfc;
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::NewL
-// Symbian two-phase constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPDownlink* TMSIPDownlink::NewL(const guint32 codecID,
-        const TMMFPrioritySettings priority)
-    {
-    TMSIPDownlink* self = new (ELeave) TMSIPDownlink();
-    CleanupStack::PushL(self);
-    self->ConstructL(codecID, priority);
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::ConstructL
-// Part two of Symbian two phase construction
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::ConstructL(const guint32 codecID,
-        const TMMFPrioritySettings priority)
-    {
-    TRACE_PRN_FN_ENT;
-
-    iCodecID = codecID;
-    iPriority = priority;
-
-    // Client must set these before querying!
-    iG711DecodeMode = TMS_G711_CODEC_MODE_ALAW;
-    iILBCDecodeMode = TMS_ILBC_CODEC_MODE_20MS_FRAME;
-
-    TRAPD(err, InitDevSoundL(EMMFStatePlaying, priority));
-    if (err != TMS_RESULT_SUCCESS)
-        {
-        User::Leave(err);
-        }
-
-    iMaxBufLen = ConfigureMedia(iCodecID);
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::Start
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::Start()
-    {
-    TRACE_PRN_FN_ENT;
-
-    gint err = TMS_RESULT_ILLEGAL_OPERATION;
-
-    if (iStatus == EReady && iDevSound)
-        {
-        TRAP(err, iDevSound->PlayInitL());
-        TRACE_PRN_IF_ERR(err);
-
-#ifdef _DEBUG
-        iSamplesPlayedCount = 0;
-#endif
-        if (err != TMS_RESULT_SUCCESS)
-            {
-            iStatus = EReady;
-            }
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::Stop
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::Stop()
-    {
-    TRACE_PRN_FN_ENT;
-
-    if (iStatus == EStreaming && iDevSound)
-        {
-        iDevSound->Stop();
-        iStatus = EReady;
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::BufferToBeFilled
-// A reference to the buffer delivered from the DevSound is stored locally
-// for later use. It will be filled with the data passed from the client
-// when it calls BufferFilled.
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::BufferToBeFilled(CMMFBuffer* aBuffer)
-    {
-    // Store pointer to the received buffer
-    iDevSoundBufPtr = static_cast<CMMFDataBuffer*>(aBuffer);
-    iBufLen = iDevSoundBufPtr->RequestSize();
-    TRACE_PRN_N1(_L("TMS->DNL->BTBF: LEN[%d]"), iBufLen);
-
-#ifndef __WINSCW__
-    //TODO: revisit this!
-    // The first AMR buffer returns 1 for no data frame.
-    /*if (iCodecID == KMccFourCCIdAMRNB)
-     {
-     iBufLen = iMaxBufLen;
-     }*/
-#endif //__WINSCW__
-    // Create or adjust the chunk
-    gint err = DoChunk(iBufLen, iMsgBuffer);
-
-    if (err != TMS_RESULT_SUCCESS)
-        {
-        Stop();
-        iMsgBuffer.iStatus = err;
-        }
-    else
-        {
-        // Notify client there is buffer ready to be filled
-        iMsgBuffer.iStatus = err;
-        iMsgBuffer.iInt = iBufLen;
-        iStatus = EStreaming;
-        // If chunk is opened, we will expect a call from the client to
-        // get chunk handle. When we get a call to copy chunk handle,
-        // check these variables and see if they match. This is not
-        // completely secure, but will provide some level of security
-        if (iMsgBuffer.iBool == TRUE)
-            {
-            iWriteDataXferHndlToClient = TRUE;
-            iKey = iMsgBuffer.iUint32;
-            }
-        }
-
-    iMsgBuffer.iRequest = ECmdFillBuffer;
-    err = iMsgQueue.Send(iMsgBuffer);
-
-    TRACE_PRN_IF_ERR(err);
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::BufferFilled
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::BufferFilled(const guint buflen)
-    {
-    TRACE_PRN_N1(_L("TMS->DNL->BF: LEN[%d]"), buflen);
-
-    // Copy data over from chunk
-    TPtr8 dataPtr(iChunk.Base(), buflen, iMaxBufLen);
-    //    RDebug::RawPrint(dataPtr);
-
-    if (iStatus == EStreaming && iDevSound && iDevSoundBufPtr)
-        {
-        // Fill D/S buffer and send it for playback
-        iDevSoundBufPtr->Data() = dataPtr;
-        TRAP_IGNORE(iDevSoundBufPtr->SetRequestSizeL(buflen));
-        //try playing anyway
-        iDevSound->PlayData();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetCodecCi
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetCodecCi()
-    {
-    TRAPD(err, SetCodecCiL());
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetCodecCiL
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::SetCodecCiL()
-    {
-    TRACE_PRN_FN_ENT;
-
-    switch (iCodecID)
-        {
-        case KMccFourCCIdG711:
-            {
-            if (!iG711DecoderIntfc)
-                {
-                iG711DecoderIntfc = CG711DecoderIntfc::NewL(*iDevSound);
-                }
-            break;
-            }
-        case KMccFourCCIdG729:
-            {
-            if (!iG729DecoderIntfc)
-                {
-                iG729DecoderIntfc = CG729DecoderIntfc::NewL(*iDevSound);
-                }
-            break;
-            }
-        case KMccFourCCIdILBC:
-            {
-            if (!iIlbcDecoderIntfc)
-                {
-                iIlbcDecoderIntfc = CIlbcDecoderIntfc::NewL(*iDevSound);
-                }
-            break;
-            }
-        case KMccFourCCIdAMRNB:
-        case KMMFFourCCCodePCM16:
-            {
-            break;
-            }
-        default:
-            {
-            User::Leave(TMS_RESULT_INVALID_ARGUMENT);
-            break;
-            }
-        }
-
-    if (!iErrConcealmentIntfc && iCodecID != KMMFFourCCCodePCM16)
-        {
-        iErrConcealmentIntfc = CErrorConcealmentIntfc::NewL(*iDevSound);
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetVolume(const guint volume)
-    {
-    gint ret(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iDevSound)
-        {
-        iDevSound->SetVolume(volume);
-        ret = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_N1(_L("TMS->DNL: SetVolume [%d]"), volume);
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetVolume(guint& volume)
-    {
-    gint ret(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iDevSound)
-        {
-        volume = iDevSound->Volume();
-        ret = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_N1(_L("TMS->DNL: GetVolume [%d]"), volume);
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetMaxVolume
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetMaxVolume(guint& volume)
-    {
-    gint ret(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iDevSound)
-        {
-        volume = iDevSound->MaxVolume();
-        ret = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_N1(_L("TMS->DNL: MaxVolume [%d]"), volume);
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetDataXferChunkHndl
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetDataXferChunkHndl(const TUint32 key, RChunk& chunk)
-    {
-    gint status = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iChunk.Handle())
-        {
-        if (iWriteDataXferHndlToClient && (iKey == key))
-            {
-            chunk = iChunk;
-            iWriteDataXferHndlToClient = FALSE;
-            iKey = 0;
-            status = TMS_RESULT_SUCCESS;
-            }
-        else
-            {
-            status = TMS_RESULT_ILLEGAL_OPERATION;
-            }
-        }
-
-    TRACE_PRN_IF_ERR(status);
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetIlbcCodecMode(gint mode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iILBCDecodeMode = mode;
-
-        if (iIlbcDecoderIntfc && iCodecID == KMccFourCCIdILBC)
-            {
-            if (mode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
-                {
-                err = iIlbcDecoderIntfc->SetDecoderMode(
-                        CIlbcDecoderIntfc::E20msFrame);
-                TRACE_PRN_N(_L("TMS->DNL: iLBC Mode Set [20ms]"));
-                }
-            else if (mode == TMS_ILBC_CODEC_MODE_30MS_FRAME)
-                {
-                err = iIlbcDecoderIntfc->SetDecoderMode(
-                        CIlbcDecoderIntfc::E30msFrame);
-                TRACE_PRN_N(_L("TMS->DNL: iLBC Mode Set [30ms]"));
-                }
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetIlbcCodecMode(gint& mode)
-    {
-    // not available through CIs -> return cashed value
-    mode = iILBCDecodeMode;
-    TRACE_PRN_N1(_L("TMS->DNL: GetIlbcCodecMode [%d]"), mode);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetG711CodecMode(gint mode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iG711DecodeMode = mode;
-
-        if (iG711DecoderIntfc && iCodecID == KMccFourCCIdG711)
-            {
-            if (mode == TMS_G711_CODEC_MODE_ALAW)
-                {
-                err = iG711DecoderIntfc->SetDecoderMode(
-                        CG711DecoderIntfc::EDecALaw);
-                TRACE_PRN_N(_L("TMS->DNL: G711 Mode Set [ALaw]"));
-                }
-            else if (mode == TMS_G711_CODEC_MODE_MULAW)
-                {
-                err = iG711DecoderIntfc->SetDecoderMode(
-                        CG711DecoderIntfc::EDecULaw);
-                TRACE_PRN_N(_L("TMS->DNL: G711 Mode Set [uLaw]"));
-                }
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetG711CodecMode(gint& mode)
-    {
-    // not available through CIs -> return cached value
-    mode = iG711DecodeMode;
-    TRACE_PRN_N1(_L("TMS->DNL: GetG711CodecMode [%d]"), mode);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::FrameModeRqrdForEC
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::FrameModeRqrdForEC(gboolean& frmodereq)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        if (iErrConcealmentIntfc)
-            {
-            err = iErrConcealmentIntfc->FrameModeRqrdForEC(frmodereq);
-            TRACE_PRN_N1(_L("TMS->DNL: FrameModeRqrdForEC [%d]"), frmodereq);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetFrameMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetFrameMode(const gboolean frmode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iFrameMode = frmode;
-
-        if (iErrConcealmentIntfc)
-            {
-            err = iErrConcealmentIntfc->SetFrameMode(frmode);
-            TRACE_PRN_N1(_L("TMS->DNL: SetFrameMode [%d]"), frmode);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetFrameMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetFrameMode(gboolean& frmode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iErrConcealmentIntfc)
-        {
-        // not available through CIs -> return cached value
-        frmode = iFrameMode;
-        TRACE_PRN_N1(_L("TMS->DNL: GetFrameMode [%d]"), frmode);
-        err = TMS_RESULT_SUCCESS;
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::ConcealErrorForNextBuffer
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::ConcealErrorForNextBuffer()
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iErrConcealmentIntfc)
-        {
-        err = iErrConcealmentIntfc->ConcealErrorForNextBuffer();
-        TRACE_PRN_N(_L("TMS->DNL: ConcealErrorForNextBuffer"));
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetCng
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetCng(const TMSFormatType fmttype, const gboolean cng)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
-            {
-            err = iG711DecoderIntfc->SetCng(cng);
-            TRACE_PRN_N1(_L("TMS->DNL: SetCng [%d]"), cng);
-            }
-        else if (fmttype == TMS_FORMAT_ILBC && iIlbcDecoderIntfc)
-            {
-            err = iIlbcDecoderIntfc->SetCng(cng);
-            TRACE_PRN_N1(_L("TMS->DNL: SetCng [%d]"), cng);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetCng
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetCng(const TMSFormatType fmttype, gboolean& cng)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
-            {
-            err = iG711DecoderIntfc->GetCng(cng);
-            TRACE_PRN_N1(_L("TMS->DNL: GetCng [%d]"), cng);
-            }
-        else if (fmttype == TMS_FORMAT_ILBC && iIlbcDecoderIntfc)
-            {
-            err = iIlbcDecoderIntfc->GetCng(cng);
-            TRACE_PRN_N1(_L("TMS->DNL: GetCng [%d]"), cng);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetPlc
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::SetPlc(const TMSFormatType fmttype, const gboolean plc)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
-            {
-            iPlc = plc;
-            err = iG711DecoderIntfc->SetPlc(iPlc);
-            TRACE_PRN_N1(_L("TMS->DNL: SetPlc [%d]"), plc);
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetPlc
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::GetPlc(const TMSFormatType fmttype, gboolean& plc)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
-        {
-        // not available through CIs -> return cached value
-        plc = iPlc;
-        err = TMS_RESULT_SUCCESS;
-        TRACE_PRN_N1(_L("TMS->DNL: GetPlc [%d]"), plc);
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::BadLsfNextBuffer
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPDownlink::BadLsfNextBuffer()
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EStreaming)
-        {
-        if (iCodecID == KMccFourCCIdG729 && iG729DecoderIntfc)
-            {
-            err = iG729DecoderIntfc->BadLsfNextBuffer();
-            TRACE_PRN_N(_L("TMS->DNL: BadLsfNextBuffer"));
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::SetAudioDeviceL
-//
-// -----------------------------------------------------------------------------
-void TMSIPDownlink::SetAudioDeviceL(TMSAudioOutput output)
-    {
-    TRACE_PRN_FN_ENT;
-
-    if (!iAudioOutput)
-        {
-        iAudioOutput = CAudioOutput::NewL(*iDevSound);
-        }
-
-    if (iAudioOutput)
-        {
-        // ENoPreference=0, EAll=1, ENoOutput=2, EPrivate=3, EPublic=4
-        CAudioOutput::TAudioOutputPreference outputDev;
-
-        switch (output)
-            {
-            case TMS_AUDIO_OUTPUT_PRIVATE:
-            case TMS_AUDIO_OUTPUT_HANDSET:
-                outputDev = CAudioOutput::EPrivate;
-                break;
-            case TMS_AUDIO_OUTPUT_PUBLIC:
-            case TMS_AUDIO_OUTPUT_LOUDSPEAKER:
-                outputDev = CAudioOutput::EPublic;
-                break;
-            default: // Use default device routing
-                outputDev = CAudioOutput::ENoPreference;
-                break;
-            }
-
-        iAudioOutput->SetAudioOutputL(outputDev);
-        TRACE_PRN_N1(_L("TMS->DNL: SetAudioDeviceL [%d]"), outputDev);
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::GetAudioDeviceL
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::GetAudioDeviceL(TMSAudioOutput& output)
-    {
-    TRACE_PRN_FN_ENT;
-
-    if (!iAudioOutput)
-        {
-        iAudioOutput = CAudioOutput::NewL(*iDevSound);
-        }
-
-    if (iAudioOutput)
-        {
-        CAudioOutput::TAudioOutputPreference outputDev =
-                iAudioOutput->AudioOutput();
-
-        switch (outputDev)
-            {
-            case CAudioOutput::ENoPreference:
-            case CAudioOutput::EAll:
-            case CAudioOutput::ENoOutput:
-            case CAudioOutput::EPrivate:
-                output = TMS_AUDIO_OUTPUT_PRIVATE;
-                break;
-            case CAudioOutput::EPublic:
-                output = TMS_AUDIO_OUTPUT_PUBLIC;
-                break;
-            default:
-                output = TMS_AUDIO_OUTPUT_PRIVATE;
-                break;
-            }
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// CALLBACKS
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::InitializeComplete
-// A callback from the DevSound indicating completion of the initialization.
-// It will send config data to the D/S and configure the encoder via CI.
-// If everything goes well, the state of the thread is set EReady.
-// The initialization completion message is sent back to the main thread.
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::InitializeComplete(TInt aError)
-    {
-    TRACE_PRN_FN_ENT;
-
-    gint err = aError;
-
-    if (err == TMS_RESULT_SUCCESS && iDevSound)
-        {
-        TMMFCapabilities conf;
-        conf = iDevSound->Config();
-        conf.iRate = EMMFSampleRate8000Hz;
-        conf.iChannels = EMMFMono;
-        TRAP(err, iDevSound->SetConfigL(conf));
-        if (err == TMS_RESULT_SUCCESS)
-            {
-            // We are ready to stream even in case of later CI setting failure
-            iStatus = EReady;
-            iMaxVolume = iDevSound->MaxVolume();
-            }
-
-        // Init Custom Interface API to the decoder
-        err = SetCodecCi();
-        if (err != TMS_RESULT_SUCCESS)
-            {
-            // DEBUG only
-            // Can ignore error - although decoder is not fully configured but
-            // it can still run in the default mode.
-            TRACE_PRN_IF_ERR(err);
-            }
-        }
-
-    // TODO: Notify client
-
-    TRACE_PRN_IF_ERR(err);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPDownlink::PlayError
-// From MDevSoundObserver
-// Record error is send to client over comm channel.
-// The state of recorder is rolled back to EReady.
-// -----------------------------------------------------------------------------
-//
-void TMSIPDownlink::PlayError(TInt /*aError*/)
-    {
-    //TRACE_PRN_IF_ERR(aError);
-
-#ifdef _DEBUG
-    iSamplesPlayedCount = 0;
-#endif
-    iStatus = EReady;
-
-    // TODO: Notify client
-    }
-
-// End of file
--- a/mmserv/tms/tmscallserver/src/ipcallstreambase.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <e32math.h>
-#include <mmcccodecinformation.h>
-#include "tmsutility.h"
-#include "tmsshared.h"
-#include "ipcallstream.h"
-
-using namespace TMS;
-
-// -----------------------------------------------------------------------------
-// TMSIPCallStreamBase::~TMSIPCallStreamBase
-// Destructor
-// -----------------------------------------------------------------------------
-//
-TMSIPCallStreamBase::~TMSIPCallStreamBase()
-    {
-    TRACE_PRN_FN_ENT;
-
-    if (iChunk.Handle() > 0)
-        {
-        iChunk.Close();
-        }
-
-#ifndef __USE_GSTREAMER__
-    delete iDevSound;
-#endif //__USE_GSTREAMER__
-    TRACE_PRN_FN_EXT;
-    }
-
-#ifndef __USE_GSTREAMER__
-// -----------------------------------------------------------------------------
-// TMSIPCallStreamBase::InitDevSoundL
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPCallStreamBase::InitDevSoundL(const TMMFState aDevSoundState,
-        const TMMFPrioritySettings priority)
-    {
-    TRACE_PRN_FN_ENT;
-
-    if (!iDevSound)
-        {
-        // Create D/S recording/playing device
-        iDevSound = CMMFDevSound::NewL();
-        }
-
-    if (iDevSound)
-        {
-        iDevSound->InitializeL(*this, TFourCC(iCodecID), aDevSoundState);
-        iDevSound->SetPrioritySettings(priority);
-        }
-    }
-#endif //__USE_GSTREAMER__
-
-// -----------------------------------------------------------------------------
-// TMSIPCallStreamBase::SetMsgQueue
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPCallStreamBase::SetMsgQueue(const RMsgQueue<TmsMsgBuf> aMsgQueue)
-    {
-    iMsgQueue = aMsgQueue;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPCallStreamBase::ConfigureMedia
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPCallStreamBase::ConfigureMedia(const guint32 aCodecID)
-    {
-    gint framelen = 0;
-
-    switch (aCodecID)
-        {
-        case KMccFourCCIdG711:
-            iMediaType = "audio/x-alaw";
-            // iMediaType = "audio/x-mulaw";
-            framelen = KTMSG711FrameLen10ms; //TODO: may be H/W specific!
-            //framelen = KTMSG711FrameLen20ms;
-            break;
-        case KMccFourCCIdG729:
-            iMediaType = "audio/g729";
-            framelen = KTMSG729FrameLen;
-            break;
-        case KMccFourCCIdILBC:
-            iMediaType = "audio/ilbc";
-            framelen = KTMSILBCFrameLen20ms;
-            //framelen = KTMSILBCFrameLen30ms;
-            break;
-        case KMccFourCCIdAMRNB:
-            iMediaType = "audio/amr";
-            framelen = KTMSAMRNBFrameLen;
-            //framelen = KTMSAMRNBFrameLenFM;
-            break;
-        case KMMFFourCCCodePCM16:
-        default:
-            iMediaType = "audio/x-raw-int";
-            framelen = KTMSPCM16FrameLen;
-#ifdef __WINSCW__
-            framelen *= 4; //16kB
-#endif
-            break;
-        }
-
-    //TODO: DEVLON TEST
-    if (iCodecID != KMMFFourCCCodePCM16)
-        {
-        framelen *= 10;
-        }
-    //TODO: DEVLON TEST
-
-    return framelen;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPCallStreamBase::DoChunk
-// Checks, adjusts and creates global RChunk.
-// -----------------------------------------------------------------------------
-//
-gint TMSIPCallStreamBase::DoChunk(const gint aDataLen, TmsMsgBuf& aMsgBuffer)
-    {
-    gint status(KErrNone);
-
-    // If chunk already created, try to reuse it
-    if (iChunk.Handle())
-        {
-        // committed size is smaller but chunk is large enough to hold data
-        if ((iChunk.Size() < aDataLen) && (aDataLen <= iChunk.MaxSize()))
-            {
-            status = iChunk.Adjust(aDataLen);
-            TRACE_PRN_N1(_L("IP_CALL: DoChunk->Chunk Adjusted [%d]"), aDataLen);
-            }
-        else if (aDataLen > iChunk.MaxSize())
-            {
-            iChunk.Close();
-            TRACE_PRN_N(_L("IP_CALL: DoChunk->Chunk Closed"));
-            }
-        }
-    RET_ERR_IF_ERR(status);
-
-    // Request kernel to create global RChunk if needed
-    aMsgBuffer.iBool = FALSE;
-    if (!iChunk.Handle())
-        {
-        // TODO consider using some max instead
-        status = iChunk.CreateGlobal(KNullDesC, aDataLen, aDataLen);
-        // Mark to re-open chunk handle
-        aMsgBuffer.iBool = TRUE;
-        aMsgBuffer.iUint32 = Math::Random();
-        TRACE_PRN_N2(_L("IP_CALL: DoChunk->Chunk Created [%d]key[%d]"),
-                aDataLen, aMsgBuffer.iUint32);
-        }
-    TRACE_PRN_IF_ERR(status);
-    return status;
-    }
-
-// End of file
--- a/mmserv/tms/tmscallserver/src/ipcalluplink.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,758 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <audiopreference.h>
-#include <mmcccodecinformation.h>
-#include <gstappsink.h>
-#include "tmsutility.h"
-#include "ipcallstream.h"
-
-using namespace TMS;
-
-static TMSIPUplink* iSelfUp;
-GstBuffer* gstUplBuffer;
-#ifdef _DEBUG
-//static TInt iHeapUp;
-#endif //_DEBUG
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::cb_record_raw_handoff
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::cb_record_raw_handoff(GstElement *sink)
-    {
-    TRACE_PRN_N(_L("TMS->UPL: cb_record_raw_handoff Enter"));
-
-#ifdef _DEBUG
-    /*    TInt block;
-     RHeap &heap = User::Heap();
-     TInt avail = heap.Available(block);
-     RDebug::Print(_L("VoIP->PRINT-HEAP-UP:Available:[%d], delta:[%d]"),
-     avail, iHeapUp-avail);
-     iHeapUp = avail;*/
-#endif
-
-    gstUplBuffer = gst_app_sink_pull_buffer(GST_APP_SINK(sink));
-    iSelfUp->BufferToBeEmptied();
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::bus_call
-// -----------------------------------------------------------------------------
-//
-gboolean TMSIPUplink::bus_call(GstBus* /*bus*/, GstMessage* msg,
-        gpointer /*data*/)
-    {
-    switch (GST_MESSAGE_TYPE(msg))
-        {
-        case GST_MESSAGE_EOS:
-            {
-            gst_element_set_state(iSelfUp->iPipelineRec, GST_STATE_NULL);
-            gst_object_unref(GST_OBJECT(iSelfUp->iPipelineRec));
-            break;
-            }
-        case GST_MESSAGE_ERROR:
-            {
-            gchar *debug;
-            GError *err;
-            gst_message_parse_error(msg, &err, &debug);
-            g_free(debug);
-            g_print("Error: %s\n", err->message);
-            g_error_free(err);
-            break;
-            }
-        default:
-            {
-            break;
-            }
-        }
-    return ETrue;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::gst_initialize_record
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::gst_initialize_record()
-    {
-    TRACE_PRN_FN_ENT;
-
-    gint err = KErrNone;
-
-    // create a new bin to hold the elements
-    iPipelineRec = gst_pipeline_new("pipelineRec");
-    iSource = gst_element_factory_make("devsoundsrc", "record_audio");
-    iAppSink = gst_element_factory_make("appsink", "appsink");
-
-    if (!iSource || !iAppSink)
-        {
-        err = KErrNotFound;
-        TRACE_PRN_IF_ERR(err);
-        return err;
-        }
-
-    iMaxBufLen = ConfigureMedia(iCodecID);
-
-    GstCaps* caps = gst_caps_new_simple(iMediaType,
-                                        "width", G_TYPE_INT, 16,
-                                        "depth", G_TYPE_INT, 16,
-                                        "signed", G_TYPE_BOOLEAN, TRUE,
-                                        "endianness", G_TYPE_INT, G_BYTE_ORDER,
-                                        "rate", G_TYPE_INT, 8000,
-                                        "channels", G_TYPE_INT, 1,
-                                        NULL);
-
-    iBusRec = gst_pipeline_get_bus(GST_PIPELINE(iPipelineRec));
-    gst_bus_add_watch(iBusRec, (TMSIPUplink::bus_call), NULL);
-    gst_object_unref(iBusRec);
-
-    // add objects to the main iPipelineRec
-    gst_bin_add_many(GST_BIN(iPipelineRec), iSource, iAppSink, NULL);
-
-    // link the elements
-    gst_element_link_filtered(iSource, iAppSink, caps);
-
-    g_object_set(G_OBJECT(iAppSink),
-                 "max-buffers", 1,
-                 "emit-signals", TRUE,
-                 "sync", FALSE,
-                 NULL);
-
-    g_signal_connect(iAppSink, "new-buffer",
-                     G_CALLBACK(cb_record_raw_handoff),
-                     NULL);
-
-    gst_app_sink_set_caps(GST_APP_SINK(iAppSink), caps);
-    gst_caps_unref(caps);
-
-    //NOTE: d/s is not ready at this time to return true maxgain
-    TInt maxgain = 1;
-#ifdef __WINSCW__
-    maxgain = 64;
-#endif //__WINSCW__
-    g_object_set(G_OBJECT(iSource),
-                 "blocksize", iMaxBufLen,
-                 "gain", maxgain,
-#ifndef __WINSCW__
-                 "priority", (gint)iPriority.iPriority,
-                 "preference", (gint)iPriority.iPref,
-#endif
-                 NULL);
-
-    err = SetCodecCi();
-    //gst_element_set_state(iPipelineRec, GST_STATE_READY);
-
-    TRACE_PRN_FN_EXT;
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::gst_record_raw
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::gst_record_raw()
-    {
-    // start recording
-    gst_element_set_state(iPipelineRec, GST_STATE_PLAYING);
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::TMSIPUplink
-// Standard Constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPUplink::TMSIPUplink()
-    {
-    iSelfUp = this;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::~TMSIPUplink
-// Standard Constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPUplink::~TMSIPUplink()
-    {
-    TRACE_PRN_FN_ENT;
-
-    Stop();
-    gst_object_unref(GST_OBJECT(iPipelineRec));
-    gst_deinit();
-
-    delete iSpeechEncoderConfig;
-    delete iG711EncoderIntfc;
-    delete iG729EncoderIntfc;
-    delete iIlbcEncoderIntfc;
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::NewL
-// Symbian two-phase constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPUplink* TMSIPUplink::NewL(const guint32 codecID,
-        const TMMFPrioritySettings priority)
-    {
-    TMSIPUplink* self = new (ELeave) TMSIPUplink();
-    CleanupStack::PushL(self);
-    self->ConstructL(codecID, priority);
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::ConstructL
-// Part two of Symbian two phase construction
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::ConstructL(const guint32 codecID,
-        const TMMFPrioritySettings priority)
-    {
-    TRACE_PRN_FN_ENT;
-
-    iCodecID = codecID;
-    iPriority = priority;
-    //    SetTime();
-    gst_init(NULL, NULL);
-    //    CalcLatency();
-    //    SetTime();
-    gint err = gst_initialize_record();
-    if (err != TMS_RESULT_SUCCESS)
-        {
-        User::Leave(err);
-        }
-
-    // Client must set these before querying!
-    iG711EncodeMode = TMS_G711_CODEC_MODE_ALAW;
-    iILBCEncodeMode = TMS_ILBC_CODEC_MODE_20MS_FRAME;
-    //    CalcLatency();
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::Start
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::Start()
-    {
-    TRACE_PRN_FN_ENT;
-
-    gst_record_raw();
-    iStatus = EStreaming;
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::Stop
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::Stop()
-    {
-    TRACE_PRN_FN_ENT;
-
-    if (iStatus == EStreaming)
-        {
-        if (iPipelineRec != NULL &&
-            iPipelineRec->current_state == GST_STATE_PLAYING)
-            {
-            GstStateChangeReturn ret;
-            ret = gst_element_set_state(iPipelineRec, GST_STATE_NULL);
-            if (ret == GST_STATE_CHANGE_FAILURE)
-                {
-                ;// retry???
-                //GST_STATE_CHANGE_SUCCESS
-                }
-            }
-        iStatus = EReady;
-        }
-
-    if (gstUplBuffer)
-        {
-        gst_buffer_unref(gstUplBuffer);
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::BufferToBeEmptied
-// From MDevSoundObserver
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::BufferToBeEmptied()
-    {
-    TInt buflen = GST_BUFFER_SIZE(gstUplBuffer);
-    TRACE_PRN_N1(_L("TMS->UPL: BTBE->LEN [%d]"), buflen);
-
-    // Adjust/create RChunk if necessary
-    TInt err = DoChunk(buflen, iMsgBuffer);
-
-    if (err != TMS_RESULT_SUCCESS)
-        {
-        Stop();
-        iMsgBuffer.iStatus = err;
-        }
-    else
-        {
-        // Pass buffer parameters to the client
-        iMsgBuffer.iStatus = err;
-        iMsgBuffer.iInt = buflen;
-
-        // Copy data over to RChunk
-        TPtr8 dataPtr(iChunk.Base(), buflen, iMaxBufLen);
-        dataPtr.Copy(GST_BUFFER_DATA(gstUplBuffer), buflen);
-        gst_buffer_unref(gstUplBuffer);
-
-        //RDebug::RawPrint(dataPtr);
-        iStatus = EStreaming;
-
-        // If chunk is opened, we will expect a call from the client to
-        // get chunk handle. When we get a call to copy chunk handle,
-        // check these variables and see if they match. This is not
-        // completely secure, but will provide some level of security.
-        if (iMsgBuffer.iBool == TRUE)
-            {
-            iWriteDataXferHndlToClient = TRUE;
-            iKey = iMsgBuffer.iUint32;
-            }
-        }
-
-    // Notify client there is buffer ready to be emptied
-    iMsgBuffer.iRequest = ECmdEmptyBuffer;
-    err = iMsgQueue.Send(iMsgBuffer);
-    TRACE_PRN_IF_ERR(err);
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::BufferEmptied
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::BufferEmptied()
-    {
-    //TRACE_PRN_N(_L("TMS->UPL->BE"));
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetCodecCi
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetCodecCi()
-    {
-    TRAPD(err, SetCodecCiL());
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetCodecCiL
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::SetCodecCiL()
-    {
-    TRACE_PRN_FN_ENT;
-
-    switch (iCodecID)
-        {
-        case KMccFourCCIdG711:
-            {
-            if (!iG711EncoderIntfc)
-                {
-                iG711EncoderIntfc = GST_G711_ENCODER_GET_IFACE(iSource);
-                }
-            break;
-            }
-        case KMccFourCCIdG729:
-            {
-            if (!iG729EncoderIntfc)
-                {
-                iG729EncoderIntfc = GST_G729_ENCODER_GET_IFACE(iSource);
-                }
-            break;
-            }
-        case KMccFourCCIdILBC:
-            {
-            if (!iIlbcEncoderIntfc)
-                {
-                iIlbcEncoderIntfc = GST_ILBC_ENCODER_GET_IFACE(iSource);
-                }
-            break;
-            }
-        case KMccFourCCIdAMRNB:
-        case KMMFFourCCCodePCM16:
-            {
-            break;
-            }
-        default:
-            {
-            User::Leave(TMS_RESULT_INVALID_ARGUMENT);
-            }
-        }
-
-    if (!iSpeechEncoderConfig && iCodecID != KMMFFourCCCodePCM16)
-        {
-        iSpeechEncoderConfig = GST_SPEECH_ENCODER_CONFIG_GET_IFACE(iSource);
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetGain(const guint gain)
-    {
-    g_object_set(G_OBJECT(iSource), "gain", gain, NULL);
-    TRACE_PRN_N1(_L("TMS->UPL: SetGain [%d]"), gain);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetGain(guint& gain)
-    {
-    g_object_get(G_OBJECT(iSource), "gain", &gain, NULL);
-    TRACE_PRN_N1(_L("TMS->UPL: GetGain [%d]"), gain);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetMaxGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetMaxGain(guint& gain)
-    {
-    g_object_get(G_OBJECT(iSource), "maxgain", &gain, NULL);
-    TRACE_PRN_N1(_L("TMS->UPL: MaxGain [%d]"), gain);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetDataXferChunkHndl
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetDataXferChunkHndl(const TUint32 key, RChunk& chunk)
-    {
-    gint status = TMS_RESULT_SUCCESS;
-
-    if (iChunk.Handle())
-        {
-        if (iWriteDataXferHndlToClient && (iKey == key))
-            {
-            chunk = iChunk;
-            iWriteDataXferHndlToClient = FALSE;
-            iKey = 0;
-            }
-        else
-            {
-            status = TMS_RESULT_ILLEGAL_OPERATION;
-            }
-        }
-
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetIlbcCodecMode(const gint mode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iILBCEncodeMode = mode;
-
-        if (iIlbcEncoderIntfc && iCodecID == KMccFourCCIdILBC)
-            {
-            if (mode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
-                {
-                err = iIlbcEncoderIntfc->SetEncoderMode(EIlbc20msFrame);
-                TRACE_PRN_N(_L("TMS->UPL: SetIlbcCodecMode [20ms Frame]"));
-                }
-            else if (mode == TMS_ILBC_CODEC_MODE_30MS_FRAME)
-                {
-                err = iIlbcEncoderIntfc->SetEncoderMode(EIlbc30msFrame);
-                TRACE_PRN_N(_L("TMS->UPL: SetIlbcCodecMode [30ms Frame]"));
-                }
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetIlbcCodecMode(gint& mode)
-    {
-    // not available through CIs -> return cached value
-    mode = iILBCEncodeMode;
-    TRACE_PRN_N1(_L("TMS->UPL: GetIlbcCodecMode [%d]"), mode);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetG711CodecMode(const gint mode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iG711EncodeMode = mode;
-
-        if (iG711EncoderIntfc && iCodecID == KMccFourCCIdG711)
-            {
-            if (mode == TMS_G711_CODEC_MODE_ALAW)
-                {
-                err = iG711EncoderIntfc->SetEncoderMode(EEncALaw);
-                TRACE_PRN_N(_L("TMS->UPL: SetG711CodecMode [ALaw]"));
-                }
-            else if (mode == TMS_G711_CODEC_MODE_MULAW)
-                {
-                err = iG711EncoderIntfc->SetEncoderMode(EEncULaw);
-                TRACE_PRN_N(_L("TMS->UPL: SetG711CodecMode [uLaw]"));
-                }
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetG711CodecMode(gint& mode)
-    {
-    // not available through CIs -> return cached value
-    mode = iG711EncodeMode;
-    TRACE_PRN_N1(_L("TMS->UPL: GetG711CodecMode [%d]"), mode);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetSupportedBitrates
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetSupportedBitrates(RArray<guint>& bitrates)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-    bitrates.Reset();
-
-    if (iSpeechEncoderConfig)
-        {
-        gint i = 0;
-        GList* gbitrates = NULL;
-        //        GList* walk;
-        err = iSpeechEncoderConfig->GetSupportedBitrates(&gbitrates);
-
-        //TODO: try returning GList and do not convert to RArray
-        for (; gbitrates; gbitrates = g_list_next (gbitrates))
-            {
-            //            guint br = GPOINTER_TO_INT(gbitrates->data);
-            guint br = GPOINTER_TO_UINT(gbitrates->data);
-            bitrates.Append(br);
-            TRACE_PRN_N2(_L("TMS->UPL: GetSupportedBitrates %d:[%d]"), i+1, br);
-            i++;
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetBitrate
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetBitrate(guint bitrate)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iSpeechEncoderConfig)
-        {
-        err = iSpeechEncoderConfig->SetBitrate(bitrate);
-        TRACE_PRN_N1(_L("TMS->UPL: SetBitrate [%d]"), bitrate);
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetBitrate
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetBitrate(guint& bitrate)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iSpeechEncoderConfig)
-        {
-        err = iSpeechEncoderConfig->GetBitrate(&bitrate);
-        TRACE_PRN_N1(_L("TMS->UPL: GetBitrate [%d]"), bitrate);
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetVad
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetVad(const TMSFormatType fmttype, const gboolean vad)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    switch (fmttype)
-        {
-        case TMS_FORMAT_G711:
-            {
-            if (iG711EncoderIntfc)
-                {
-                err = iG711EncoderIntfc->SetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_G729:
-            {
-            if (iG729EncoderIntfc)
-                {
-                err = iG729EncoderIntfc->SetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_ILBC:
-            {
-            if (iIlbcEncoderIntfc)
-                {
-                err = iIlbcEncoderIntfc->SetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_AMR:
-            {
-            if (iSpeechEncoderConfig)
-                {
-                err = iSpeechEncoderConfig->SetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
-                }
-            break;
-            }
-        default:
-            {
-            break; //TMS_RESULT_DOES_NOT_EXIST
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetVad
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetVad(const TMSFormatType fmttype, gboolean& vad)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    switch (fmttype)
-        {
-        case TMS_FORMAT_G711:
-            {
-            if (iG711EncoderIntfc)
-                {
-                err = iG711EncoderIntfc->GetVadMode(&vad);
-                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_G729:
-            {
-            if (iG729EncoderIntfc)
-                {
-                err = iG729EncoderIntfc->GetVadMode(&vad);
-                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_ILBC:
-            {
-            if (iIlbcEncoderIntfc)
-                {
-                err = iIlbcEncoderIntfc->GetVadMode(&vad);
-                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_AMR:
-            {
-            if (iSpeechEncoderConfig)
-                {
-                err = iSpeechEncoderConfig->GetVadMode(&vad);
-                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
-                }
-            break;
-            }
-        default:
-            {
-            break; //TMS_RESULT_DOES_NOT_EXIST
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// End of file
--- a/mmserv/tms/tmscallserver/src/ipcalluplinkds.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,690 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-#include <AudioPreference.h>
-#include <mmcccodecinformation.h>
-#include <IlbcEncoderIntfc.h>
-#include <G711EncoderIntfc.h>
-#include <G729EncoderIntfc.h>
-#include <SpeechEncoderConfig.h>
-#include "tmsutility.h"
-#include "ipcallstream.h"
-
-using namespace TMS;
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::TMSIPUplink
-// Standard Constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPUplink::TMSIPUplink()
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::~TMSIPUplink
-// Standard Constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPUplink::~TMSIPUplink()
-    {
-    TRACE_PRN_FN_ENT;
-
-    Stop();
-
-    delete iSpeechEncoderConfig;
-    delete iG711EncoderIntfc;
-    delete iG729EncoderIntfc;
-    delete iIlbcEncoderIntfc;
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::NewL
-// Symbian two-phase constructor
-// -----------------------------------------------------------------------------
-//
-TMSIPUplink* TMSIPUplink::NewL(const guint32 codecID,
-        const TMMFPrioritySettings priority)
-    {
-    TMSIPUplink* self = new (ELeave) TMSIPUplink();
-    CleanupStack::PushL(self);
-    self->ConstructL(codecID, priority);
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::ConstructL
-// Part two of Symbian two phase construction
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::ConstructL(const guint32 codecID,
-        const TMMFPrioritySettings priority)
-    {
-    TRACE_PRN_FN_ENT;
-
-    iCodecID = codecID;
-    iPriority = priority;
-
-    // Client must set these before querying!
-    iG711EncodeMode = TMS_G711_CODEC_MODE_ALAW;
-    iILBCEncodeMode = TMS_ILBC_CODEC_MODE_20MS_FRAME;
-
-    TRAPD(err, InitDevSoundL(EMMFStateRecording, priority));
-    if (err != TMS_RESULT_SUCCESS)
-        {
-        User::Leave(err);
-        }
-
-    iMaxBufLen = ConfigureMedia(iCodecID);
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::Start
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::Start()
-    {
-    TRACE_PRN_FN_ENT;
-
-    gint err = TMS_RESULT_ILLEGAL_OPERATION;
-    iWriteDataXferHndlToClient = FALSE;
-
-    if (iStatus == EReady && iDevSound)
-        {
-        TRAP(err, iDevSound->RecordInitL());
-        TRACE_PRN_IF_ERR(err);
-
-        if (err != TMS_RESULT_SUCCESS)
-            {
-            //TODO: Notify main thread
-            iStatus = EReady;
-            }
-#ifdef _DEBUG
-        else
-            {
-            iSamplesRecCount = 0;
-            }
-#endif
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::Stop
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::Stop()
-    {
-    TRACE_PRN_FN_ENT;
-
-    if (iStatus == EStreaming && iDevSound)
-        {
-        iDevSound->Stop();
-        iStatus = EReady;
-        }
-    else
-        {
-        //TODO: Notify main thread
-        }
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::BufferToBeEmptied
-// From MDevSoundObserver
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::BufferToBeEmptied(CMMFBuffer* aBuffer)
-    {
-    iDevSoundBufPtr = static_cast<CMMFDataBuffer*>(aBuffer);
-    TDes8& data = iDevSoundBufPtr->Data();
-
-    iBufLen = iDevSoundBufPtr->BufferSize();
-    TRACE_PRN_N1(_L("TMS->UPL: BTBE->LEN [%d]"), iBufLen);
-
-    // Adjust/create RChunk if necessary
-    gint err = DoChunk(iBufLen, iMsgBuffer);
-
-    if (err != TMS_RESULT_SUCCESS)
-        {
-        Stop();
-        iMsgBuffer.iStatus = err;
-        }
-    else
-        {
-        // Pass buffer parameters to the client
-        iMsgBuffer.iStatus = err;
-        iMsgBuffer.iInt = iBufLen;
-
-        // Copy data over to RChunk
-        TPtr8 dataPtr(iChunk.Base(), iBufLen, iBufLen);
-        dataPtr = data;
-        iStatus = EStreaming;
-
-        // If chunk is opened, we will expect a call from the client to
-        // get chunk handle. When we get a call to copy chunk handle,
-        // check these variables and see if they match. This is not
-        // completely secure, but will provide some level of security.
-        if (iMsgBuffer.iBool == TRUE)
-            {
-            iWriteDataXferHndlToClient = TRUE;
-            iKey = iMsgBuffer.iUint32;
-            }
-        }
-
-    // Notify client there is buffer ready to be emptied
-    iMsgBuffer.iRequest = ECmdEmptyBuffer;
-    err = iMsgQueue.Send(iMsgBuffer);
-    TRACE_PRN_IF_ERR(err);
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::BufferEmptied
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::BufferEmptied()
-    {
-    //TRACE_PRN_N(_L("TMS->UPL->BE"));
-    if (iDevSound)
-        {
-        iDevSound->RecordData();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetCodecCi
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetCodecCi()
-    {
-    TRAPD(err, SetCodecCiL());
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetCodecCiL
-//
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::SetCodecCiL()
-    {
-    TRACE_PRN_FN_ENT;
-
-    switch (iCodecID)
-        {
-        case KMccFourCCIdG711:
-            {
-            if (!iG711EncoderIntfc)
-                {
-                iG711EncoderIntfc = CG711EncoderIntfc::NewL(*iDevSound);
-                }
-            break;
-            }
-        case KMccFourCCIdG729:
-            {
-            if (!iG729EncoderIntfc)
-                {
-                iG729EncoderIntfc = CG729EncoderIntfc::NewL(*iDevSound);
-                }
-            break;
-            }
-        case KMccFourCCIdILBC:
-            {
-            if (!iIlbcEncoderIntfc)
-                {
-                iIlbcEncoderIntfc = CIlbcEncoderIntfc::NewL(*iDevSound);
-                }
-            break;
-            }
-        case KMccFourCCIdAMRNB:
-        case KMMFFourCCCodePCM16:
-            {
-            break;
-            }
-        default:
-            {
-            User::Leave(TMS_RESULT_INVALID_ARGUMENT);
-            break;
-            }
-        }
-
-    if (!iSpeechEncoderConfig && iCodecID != KMMFFourCCCodePCM16)
-        {
-        iSpeechEncoderConfig = CSpeechEncoderConfig::NewL(*iDevSound);
-        }
-
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetGain(const guint gain)
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iDevSound)
-        {
-        iDevSound->SetGain(gain);
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_N1(_L("TMS->UPL: SetGain [%d]"), gain);
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetGain(guint& gain)
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iDevSound)
-        {
-        gain = iDevSound->Gain();
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_N1(_L("TMS->UPL: GetGain [%d]"), gain);
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetMaxGain
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetMaxGain(guint& gain)
-    {
-    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
-    if (iDevSound)
-        {
-        gain = iDevSound->MaxGain();
-        status = TMS_RESULT_SUCCESS;
-        }
-    TRACE_PRN_N1(_L("TMS->UPL: MaxGain [%d]"), gain);
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetDataXferChunkHndl
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetDataXferChunkHndl(const TUint32 key, RChunk& chunk)
-    {
-    gint status = TMS_RESULT_SUCCESS;
-
-    if (iChunk.Handle())
-        {
-        if (iWriteDataXferHndlToClient && (iKey == key))
-            {
-            chunk = iChunk;
-            iWriteDataXferHndlToClient = FALSE;
-            iKey = 0;
-            }
-        else
-            {
-            status = TMS_RESULT_ILLEGAL_OPERATION;
-            }
-        }
-
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetIlbcCodecMode(const gint mode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iILBCEncodeMode = mode;
-
-        if (iIlbcEncoderIntfc && iCodecID == KMccFourCCIdILBC)
-            {
-            if (mode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
-                {
-                err = iIlbcEncoderIntfc->SetEncoderMode(
-                        CIlbcEncoderIntfc::E20msFrame);
-                TRACE_PRN_N(_L("TMS->UPL: SetIlbcCodecMode [20ms Frame]"));
-                }
-            else if (mode == TMS_ILBC_CODEC_MODE_30MS_FRAME)
-                {
-                err = iIlbcEncoderIntfc->SetEncoderMode(
-                        CIlbcEncoderIntfc::E30msFrame);
-                TRACE_PRN_N(_L("TMS->UPL: SetIlbcCodecMode [30ms Frame]"));
-                }
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetIlbcCodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetIlbcCodecMode(gint& mode)
-    {
-    // not available through CIs -> return cached value
-    mode = iILBCEncodeMode;
-    TRACE_PRN_N1(_L("TMS->UPL: GetIlbcCodecMode [%d]"), mode);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetG711CodecMode(const gint mode)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iStatus == EReady)
-        {
-        iG711EncodeMode = mode;
-
-        if (iG711EncoderIntfc && iCodecID == KMccFourCCIdG711)
-            {
-            if (mode == TMS_G711_CODEC_MODE_ALAW)
-                {
-                err = iG711EncoderIntfc->SetEncoderMode(
-                        CG711EncoderIntfc::EEncALaw);
-                TRACE_PRN_N(_L("TMS->UPL: SetG711CodecMode [ALaw]"));
-                }
-            else if (mode == TMS_G711_CODEC_MODE_MULAW)
-                {
-                err = iG711EncoderIntfc->SetEncoderMode(
-                        CG711EncoderIntfc::EEncULaw);
-                TRACE_PRN_N(_L("TMS->UPL: SetG711CodecMode [uLaw]"));
-                }
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetG711CodecMode
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetG711CodecMode(gint& mode)
-    {
-    // not available through CIs -> return cached value
-    mode = iG711EncodeMode;
-    TRACE_PRN_N1(_L("TMS->UPL: GetG711CodecMode [%d]"), mode);
-    return TMS_RESULT_SUCCESS;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetSupportedBitrates
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetSupportedBitrates(RArray<guint>& bitrates)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-    bitrates.Reset();
-
-    if (iSpeechEncoderConfig)
-        {
-        err = iSpeechEncoderConfig->GetSupportedBitrates(bitrates);
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetBitrate
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetBitrate(guint bitrate)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iSpeechEncoderConfig)
-        {
-        err = iSpeechEncoderConfig->SetBitrate(bitrate);
-        TRACE_PRN_N1(_L("TMS->UPL: SetBitrate [%d]"), bitrate);
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetBitrate
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetBitrate(guint& bitrate)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    if (iSpeechEncoderConfig)
-        {
-        err = iSpeechEncoderConfig->GetBitrate(bitrate);
-        TRACE_PRN_N1(_L("TMS->UPL: GetBitrate [%d]"), bitrate);
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::SetVad
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::SetVad(const TMSFormatType fmttype, const gboolean vad)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    switch (fmttype)
-        {
-        case TMS_FORMAT_G711:
-            {
-            if (iG711EncoderIntfc)
-                {
-                err = iG711EncoderIntfc->SetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_G729:
-            {
-            if (iG729EncoderIntfc)
-                {
-                err = iG729EncoderIntfc->SetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_ILBC:
-            {
-            if (iIlbcEncoderIntfc)
-                {
-                err = iIlbcEncoderIntfc->SetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_AMR:
-            {
-            if (iSpeechEncoderConfig)
-                {
-                err = iSpeechEncoderConfig->SetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
-                }
-            break;
-            }
-        default:
-            {
-            break; //TMS_RESULT_DOES_NOT_EXIST
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::GetVad
-//
-// -----------------------------------------------------------------------------
-//
-gint TMSIPUplink::GetVad(const TMSFormatType fmttype, gboolean& vad)
-    {
-    gint err = TMS_RESULT_DOES_NOT_EXIST;
-
-    switch (fmttype)
-        {
-        case TMS_FORMAT_G711:
-            {
-            if (iG711EncoderIntfc)
-                {
-                err = iG711EncoderIntfc->GetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_G729:
-            {
-            if (iG729EncoderIntfc)
-                {
-                err = iG729EncoderIntfc->GetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_ILBC:
-            {
-            if (iIlbcEncoderIntfc)
-                {
-                err = iIlbcEncoderIntfc->GetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
-                }
-            break;
-            }
-        case TMS_FORMAT_AMR:
-            {
-            if (iSpeechEncoderConfig)
-                {
-                err = iSpeechEncoderConfig->GetVadMode(vad);
-                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
-                }
-            break;
-            }
-        default:
-            {
-            break; //TMS_RESULT_DOES_NOT_EXIST
-            }
-        }
-
-    TRACE_PRN_IF_ERR(err);
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::InitializeComplete
-// A callback from the DevSound indicating completion of the initialization.
-// It will send config data to the D/S and configure the encoder via CI.
-// If everything goes well, the state of the thread is set EReady.
-// The initialization completion message is sent back to the main thread.
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::InitializeComplete(TInt aError)
-    {
-    TRACE_PRN_FN_ENT;
-
-    gint err = aError;
-
-    if (err == TMS_RESULT_SUCCESS && iDevSound)
-        {
-        TMMFCapabilities conf;
-        conf = iDevSound->Config();
-        conf.iRate = EMMFSampleRate8000Hz;
-        conf.iChannels = EMMFMono;
-        TRAP(err, iDevSound->SetConfigL(conf));
-        if (err == TMS_RESULT_SUCCESS)
-            {
-            // We are ready to stream even in case of CI setting failure
-            iStatus = EReady;
-            iMaxGain = iDevSound->MaxGain();
-            }
-
-        // Init Custom Interface API to the Encoder
-        err = SetCodecCi();
-        if (err != TMS_RESULT_SUCCESS)
-            {
-            // DEBUG only
-            // Can ignore error - although encoder is not fully configured but
-            // it can still run in the default mode.
-            TRACE_PRN_IF_ERR(err);
-            }
-        }
-
-    // TODO: Notify client
-
-    TRACE_PRN_IF_ERR(err);
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSIPUplink::RecordError
-// From MDevSoundObserver
-// Recording error is send to the main thread.
-// The state of recorder is rolled back to EReady.
-// -----------------------------------------------------------------------------
-//
-void TMSIPUplink::RecordError(TInt /*aError*/)
-    {
-    //TRACE_PRN_IF_ERR(aError);
-
-#ifdef _DEBUG
-    iSamplesRecCount = 0;
-#endif
-    iStatus = EReady;
-
-    // TODO: Notify client
-    }
-
-// End of file
-
--- a/mmserv/tms/tmscallserver/src/tarsettings.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * 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: Telephony Multimedia Service
- *
- */
-
-// INCLUDE FILES
-#include "tarsettings.h"
-#include "tmsclientserver.h"
-#include "tmsutility.h"
-
-using namespace TMS;
-
-// CONSTANTS
-_LIT_SECURITY_POLICY_PASS(KTMSServerReadPolicy);
-_LIT_SECURITY_POLICY_C1(KTMSServerWritePolicy, ECapabilityWriteUserData);
-
-// -----------------------------------------------------------------------------
-// TMSTarSettings::TMSTarSettings
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-TMSTarSettings::TMSTarSettings()
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// TMSTarSettings::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void TMSTarSettings::ConstructL()
-    {
-    TRACE_PRN_FN_ENT;
-    TInt err = RProperty::Define(ERoutingPs, RProperty::EByteArray,
-            KTMSServerReadPolicy, KTMSServerWritePolicy);
-    TRACE_PRN_N1(_L("TarSetting::ConstructL err:%d"),err);
-
-    if (err != KErrAlreadyExists)
-        {
-        User::LeaveIfError(err);
-        }
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSTarSettings::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-TMSTarSettings* TMSTarSettings::NewL()
-    {
-    TMSTarSettings* self = new (ELeave) TMSTarSettings();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// Destructor
-TMSTarSettings::~TMSTarSettings()
-    {
-    TRACE_PRN_FN_ENT;
-    TInt err = RProperty::Delete(KTMSPropertyCategory, ERoutingPs);
-    TRACE_PRN_N1(_L("TarSetting::~TMSTarSettings err:%d"),err);
-    TRACE_PRN_FN_ENT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSTarSettings::SetVolume
-// -----------------------------------------------------------------------------
-//
-void TMSTarSettings::SetTar(TRoutingMsgBufPckg rountingpckg, TBool aPublish)
-    {
-    TRACE_PRN_FN_ENT;
-    //    TInt err(KErrNone);
-    if (aPublish)
-        {
-        /*err =*/RProperty::Set(KTMSPropertyCategory, ERoutingPs, rountingpckg);
-        }
-
-    //TRACE_PRN_N1(_L("TarSetting::SetTar err:%d"),err);
-    TRACE_PRN_FN_EXT;
-    }
-
-//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmscalladpt.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,106 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <tms.h>
+#include "tmscallipadpt.h"
+#include "tmscallcsadpt.h"
+#include "tmscalladpt.h"
+#include "tmsutility.h"
+
+using namespace TMS;
+
+// -----------------------------------------------------------------------------
+// TMSCallAdpt::TMSCallAdpt
+//
+// -----------------------------------------------------------------------------
+//
+TMSCallAdpt::TMSCallAdpt()
+    {
+    TRACE_PRN_FN_ENT;
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallAdpt::~TMSCallAdpt
+//
+// -----------------------------------------------------------------------------
+//
+TMSCallAdpt::~TMSCallAdpt()
+    {
+    TRACE_PRN_FN_ENT;
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallAdpt::CreateCallL
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallAdpt::CreateCallL(gint callType, TMSCallAdpt*& callAdpt)
+    {
+    TRACE_PRN_FN_ENT;
+    TMSCallAdpt* self(NULL);
+    gint retVal(TMS_RESULT_SUCCESS);
+    switch (callType)
+        {
+        case TMS_CALL_IP:
+            retVal = TMS_RESULT_INSUFFICIENT_MEMORY;
+            self = TMSCallIPAdpt::NewL();
+            if (self)
+                {
+                retVal = self->PostConstruct();
+                if (retVal != TMS_RESULT_SUCCESS)
+                    {
+                    delete self;
+                    self = NULL;
+                    }
+                }
+            break;
+
+        case TMS_CALL_CS:
+            retVal = TMS_RESULT_INSUFFICIENT_MEMORY;
+            self = new TMSCallCSAdpt();
+            if (self)
+                {
+                retVal = self->PostConstruct();
+                if (retVal != TMS_RESULT_SUCCESS)
+                    {
+                    delete self;
+                    self = NULL;
+                    }
+                }
+            break;
+        default:
+            retVal = TMS_RESULT_CALL_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    callAdpt = self;
+    TRACE_PRN_FN_EXT;
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallAdpt::PostConstruct
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallAdpt::PostConstruct()
+    {
+    return TMS_RESULT_SUCCESS;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,1057 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <tms.h>
+#include <S60FourCC.h>
+#include <AudioPreference.h>
+#include <TelephonyAudioRouting.h>
+#include "tmscsuplink.h"
+#include "tmscsdownlink.h"
+#include "tmscallcsadpt.h"
+#include "tmsutility.h"
+#include "tmsshared.h"
+#include "tmsclientserver.h"
+#include "tmstarsettings.h"
+
+using namespace TMS;
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::TMSCallCSAdpt
+//
+// -----------------------------------------------------------------------------
+//
+TMSCallCSAdpt::TMSCallCSAdpt()
+    {
+    TRACE_PRN_FN_ENT;
+
+    iCSDownlink = NULL;
+    iCSUplink = NULL;
+    iRouting = NULL;
+    iTarSettings = NULL;
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::~TMSCallCSAdpt
+//
+// -----------------------------------------------------------------------------
+//
+TMSCallCSAdpt::~TMSCallCSAdpt()
+    {
+    TRACE_PRN_FN_ENT;
+    delete iCSDownlink;
+    delete iCSUplink;
+    delete iRouting;
+    delete iTarSettings;
+
+    if (iMsgQueueUp.Handle() > 0)
+        {
+        iMsgQueueUp.Close();
+        }
+
+    if (iMsgQueueDn.Handle() > 0)
+        {
+        iMsgQueueDn.Close();
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::PostConstruct
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::PostConstruct()
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    iNextStreamId = 1;
+    iUplinkInitialized = FALSE;
+    iDnlinkInitialized = FALSE;
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::CreateStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::CreateStream(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint& outStrmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            status = TMS_RESULT_ALREADY_EXIST;
+            if (!iUplinkInitialized)
+                {
+                iUplinkInitialized = TRUE;
+                iUplinkStreamId = iNextStreamId;
+                outStrmId = iUplinkStreamId;
+                iNextStreamId++;
+                iUplinkInitialized = TRUE;
+                status = TMS_RESULT_SUCCESS;
+                }
+            break;
+        case TMS_STREAM_DOWNLINK:
+            status = TMS_RESULT_ALREADY_EXIST;
+            if (!iDnlinkInitialized)
+                {
+                iDnlinkInitialized = TRUE;
+                iDnlinkStreamId = iNextStreamId;
+                outStrmId = iDnlinkStreamId;
+                iNextStreamId++;
+                iDnlinkInitialized = TRUE;
+                status = TMS_RESULT_SUCCESS;
+                }
+            break;
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::InitStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::InitStreamL(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId, TMSFormatType /*frmtType*/,
+        const RMessage2& aMessage)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            if (strmId == iUplinkStreamId)
+                {
+                // Open message queue handling client-server communication
+                if (iMsgQueueUp.Handle() <= 0)
+                    {
+                    // Third argument in TMSCallProxy::InitStream
+                    status = iMsgQueueUp.Open(aMessage, 1);
+                    }
+                if (status == TMS_RESULT_SUCCESS)
+                    {
+                    TRAP(status, iCSUplink = TMSCSUplink::NewL(*this));
+                    }
+                iStrmtype = TMS_STREAM_UPLINK;
+                }
+            else
+                {
+                status = TMS_RESULT_DOES_NOT_EXIST;
+                }
+            break;
+        case TMS_STREAM_DOWNLINK:
+            if (strmId == iDnlinkStreamId)
+                {
+                // Open message queue handling client-server communication
+                if (iMsgQueueDn.Handle() <= 0)
+                    {
+                    // Third argument in TMSCallProxy::InitStream
+                    status = iMsgQueueDn.Open(aMessage, 1);
+                    }
+                if (status == TMS_RESULT_SUCCESS)
+                    {
+                    TRAP(status, iCSDownlink = TMSCSDownlink::NewL(*this));
+                    if (status == TMS_RESULT_SUCCESS)
+                        {
+                        TRAP(status, iRouting =
+                             CTelephonyAudioRouting::NewL(*this));
+                        if (status == TMS_RESULT_SUCCESS)
+                            {
+                            iTarSettings = TMSTarSettings::NewL();
+                            }
+                        }
+                    }
+                iStrmtype = TMS_STREAM_DOWNLINK;
+                }
+            else
+                {
+                status = TMS_RESULT_DOES_NOT_EXIST;
+                }
+            break;
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+
+    TRACE_PRN_IF_ERR(status);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::StartStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::StartStream(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            if (iCSUplink && strmId == iUplinkStreamId)
+                {
+                iCSUplink->Activate();
+                }
+            break;
+        case TMS_STREAM_DOWNLINK:
+            if (iCSDownlink && strmId == iDnlinkStreamId)
+                {
+                iCSDownlink->Activate();
+                }
+            break;
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::PauseStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::PauseStream(TMSCallType /*callType*/,
+        TMSStreamType /*strmType*/, gint /*strmId*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::StopStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::StopStream(TMSCallType /*callType*/, TMSStreamType strmType,
+        gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            if (iCSUplink && strmId == iUplinkStreamId)
+                {
+                iCSUplink->Deactivate();
+                NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete,
+                        status, 0);
+                }
+            break;
+        case TMS_STREAM_DOWNLINK:
+            if (iCSDownlink && strmId == iDnlinkStreamId)
+                {
+                iCSDownlink->Deactivate();
+                NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete,
+                        status, 0);
+                }
+            break;
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::DeinitStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::DeinitStream(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            if (iCSUplink && strmId == iUplinkStreamId)
+                {
+                iCSUplink->Deactivate();
+                iUplinkInitialized = FALSE;
+                NotifyClient(iUplinkStreamId, ECmdUplinkDeInitComplete,
+                        status, 0);
+                }
+            break;
+        case TMS_STREAM_DOWNLINK:
+            if (iCSDownlink && strmId == iDnlinkStreamId)
+                {
+                iCSDownlink->Deactivate();
+                iDnlinkInitialized = FALSE;
+                NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete,
+                        status, 0);
+                }
+            break;
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::DeleteStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::DeleteStream(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            if (strmId == iUplinkStreamId)
+                {
+                iUplinkStreamId = -1;
+                iUplinkInitialized = FALSE;
+                }
+            break;
+        case TMS_STREAM_DOWNLINK:
+            if (strmId == iDnlinkStreamId)
+                {
+                iDnlinkStreamId = -1;
+                iDnlinkInitialized = FALSE;
+                }
+            break;
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::DataXferBufferEmptied
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::DataXferBufferEmptied(TMSCallType /*callType*/,
+        TMSStreamType /*strmType*/, gint /*strmId*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::DataXferBufferFilled
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::DataXferBufferFilled(TMSCallType /*callType*/,
+        TMSStreamType /*strmType*/, gint /*strmId*/, guint /*datasize*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetDataXferBufferHndl
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetDataXferBufferHndl(const TMSCallType /*callType*/,
+        const TMSStreamType /*strmType*/, const gint /*strmId*/,
+        const guint32 /*key*/, RChunk& /*chunk*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetMaxVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetMaxVolume(guint& volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iCSDownlink && iDnlinkInitialized)
+        {
+        volume = iCSDownlink->MaxVolume();
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetVolume(const guint volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iCSDownlink && iDnlinkInitialized)
+        {
+        iCSDownlink->SetVolume(volume);
+        status = TMS_RESULT_SUCCESS;
+        NotifyClient(iDnlinkStreamId, ECmdSetVolume, status, 0);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetVolume(guint& volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iCSDownlink && iDnlinkInitialized)
+        {
+        volume = iCSDownlink->Volume();
+        status = TMS_RESULT_SUCCESS;
+        }
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetMaxGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetMaxGain(guint& gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iCSUplink && iUplinkInitialized)
+        {
+        gain = iCSUplink->MaxGain();
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetGain(const guint gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iUplinkInitialized)
+        {
+        iCSUplink->SetGain(gain);
+        status = TMS_RESULT_SUCCESS;
+        NotifyClient(iUplinkInitialized, ECmdSetGain, status, 0);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetGain(guint& gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iCSUplink && iUplinkInitialized)
+        {
+        gain = iCSUplink->Gain();
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetGlobalMaxVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetGlobalMaxVolume(guint& volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iCSDownlink && iDnlinkInitialized)
+        {
+        volume = iCSDownlink->MaxVolume();
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetGlobalVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetGlobalVolume(const guint volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+
+    iGlobalVol = volume;
+    if (iCSDownlink && iDnlinkInitialized)
+        {
+        iCSDownlink->SetVolume(volume);
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetGlobalVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetGlobalVolume(guint& volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iCSDownlink && iDnlinkInitialized)
+        {
+        volume = iCSDownlink->Volume();
+        status = TMS_RESULT_SUCCESS;
+        }
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetMaxGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetGlobalMaxGain(guint& gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iCSUplink && iUplinkInitialized)
+        {
+        gain = iCSUplink->MaxGain();
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetGlobalGain(const guint gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+
+    iGlobalGain = gain;
+    if (iCSUplink && iUplinkInitialized)
+        {
+        iCSUplink->SetGain(gain);
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetGlobalGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetGlobalGain(guint& gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_ILLEGAL_OPERATION);
+    if (iCSUplink && iUplinkInitialized)
+        {
+        gain = iCSUplink->Gain();
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetCodecMode(const TMSFormatType /*fmttype*/,
+        const TMSStreamType /*strmtype*/, gint& /*mode*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetCodecMode(const TMSFormatType /*fmttype*/,
+        const TMSStreamType /*strmtype*/, const gint /*mode*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetSupportedBitRatesCount
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetSupportedBitRatesCount(guint& /*count*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetSupportedBitRates
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetSupportedBitRates(CBufFlat*& brbuffer)
+    {
+    TRACE_PRN_FN_ENT;
+    TRAPD(status, GetSupportedBitRatesL(brbuffer));
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetSupportedBitRatesL
+//
+// GetSupportedBitRates implementation which can leave.
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::GetSupportedBitRatesL(CBufFlat*& /*brbuffer*/)
+    {
+    User::Leave(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetBitRate
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetBitRate(guint& /*bitrate*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetBitRate
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetBitRate(const guint /*bitrate*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetVAD
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetVAD(const TMSFormatType /*fmttype*/, gboolean& /*vad*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetVAD
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetVAD(const TMSFormatType /*fmttype*/, const gboolean /*vad*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetCNG
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetCNG(const TMSFormatType /*fmttype*/, gboolean& /*cng*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetCNG
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetCNG(const TMSFormatType /*fmttype*/,
+        const gboolean /*cng*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetPlc
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetPlc(const TMSFormatType /*fmttype*/, gboolean& /*plc*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetPlc
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetPlc(const TMSFormatType /*fmttype*/,
+        const gboolean /*plc*/)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_FEATURE_NOT_SUPPORTED);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetOutput
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::SetOutput(TMSAudioOutput output)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+
+    if (iRouting)
+        {
+        CTelephonyAudioRouting::TAudioOutput taroutput = TOTAROUTPUT(output);
+        TRAP(status, iRouting->SetOutputL(taroutput));
+        if (status == KErrArgument)
+            {
+            status = TMS_RESULT_INVALID_ARGUMENT;
+            }
+        else
+            {
+            status = TMS_RESULT_SUCCESS;
+            }
+        }
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetOutput
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetOutput(TMSAudioOutput& output)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+
+    if (iRouting)
+        {
+        CTelephonyAudioRouting::TAudioOutput taroutput;
+        taroutput = iRouting->Output();
+        status = TMS_RESULT_SUCCESS;
+        output = TOTMSOUTPUT(taroutput);
+        }
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetPreviousOutput
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetPreviousOutput(TMSAudioOutput& output)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+
+    if (iRouting)
+        {
+        CTelephonyAudioRouting::TAudioOutput taroutput;
+        taroutput = iRouting->PreviousOutput();
+        status = TMS_RESULT_SUCCESS;
+        output = TOTMSOUTPUT(taroutput);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::GetAvailableOutputsL
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallCSAdpt::GetAvailableOutputsL(gint& count, CBufFlat*& outputsbuffer)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    TMSAudioOutput tmsoutput;
+
+    if (iRouting)
+        {
+        RBufWriteStream stream;
+        stream.Open(*outputsbuffer);
+        CleanupClosePushL(stream);
+
+        TArray<CTelephonyAudioRouting::TAudioOutput> availableOutputs =
+                iRouting->AvailableOutputs();
+
+        guint numOfItems = availableOutputs.Count();
+        count = numOfItems;
+        for (guint i = 0; i < numOfItems; i++)
+            {
+            tmsoutput = TOTMSOUTPUT(availableOutputs[i]);
+            stream.WriteUint32L(tmsoutput);
+            //TRACE_PRN_N1(_L("TMS->CallIPAdpt: outputs: [%d]"), availableOutputs[i]);
+            }
+
+        CleanupStack::PopAndDestroy(&stream);
+        status = TMS_RESULT_SUCCESS;
+        }
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+
+// From TMSCSPDevSoundObserver
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::DownlinkInitCompleted
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::DownlinkInitCompleted(TInt status)
+    {
+    TRACE_PRN_FN_ENT;
+    NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status, 0);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::UplinkInitCompleted
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::UplinkInitCompleted(TInt status)
+    {
+    TRACE_PRN_FN_ENT;
+    NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status, 0);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::UplinkActivatedSuccessfully
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::UplinkActivatedSuccessfully()
+    {
+    TRACE_PRN_FN_ENT;
+    NotifyClient(iUplinkStreamId, ECmdUplinkStarted, KErrNone, 0);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::DownlinkActivatedSuccessfully
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::DownlinkActivatedSuccessfully()
+    {
+    TRACE_PRN_FN_ENT;
+    NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, KErrNone, 0);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::UplinkActivationFailed
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::UplinkActivationFailed()
+    {
+    TRACE_PRN_FN_ENT;
+    NotifyClient(iUplinkStreamId, ECmdUplinkStarted, TMS_RESULT_FATAL_ERROR, 0);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::DownlinkActivationFailed
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::DownlinkActivationFailed()
+    {
+    TRACE_PRN_FN_ENT;
+    NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted,
+            TMS_RESULT_FATAL_ERROR, 0);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::AvailableOutputsChanged
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::AvailableOutputsChanged(
+        CTelephonyAudioRouting& /*aTelephonyAudioRouting*/)
+    {
+    TRACE_PRN_FN_ENT;
+    TRoutingMsgBufPckg pckg;
+    pckg().iEvent = TMS_EVENT_ROUTING_AVAIL_OUTPUTS_CHANGED;
+    iTarSettings->SetTar(pckg, ETrue);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::OutputChanged
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::OutputChanged(
+        CTelephonyAudioRouting& aTelephonyAudioRouting)
+    {
+    TRACE_PRN_FN_ENT;
+    TRoutingMsgBufPckg pckg;
+    pckg().iEvent = TMS_EVENT_ROUTING_OUTPUT_CHANGED;
+    pckg().iOutput = TOTMSOUTPUT(aTelephonyAudioRouting.Output());
+    iTarSettings->SetTar(pckg, ETrue);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::SetOutputComplete
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::SetOutputComplete(
+        CTelephonyAudioRouting& aTelephonyAudioRouting, gint /*aError*/)
+    {
+    TRACE_PRN_FN_ENT;
+    TRoutingMsgBufPckg pckg;
+    pckg().iEvent = TMS_EVENT_ROUTING_SET_OUTPUT_COMPLETE;
+    pckg().iOutput = TOTMSOUTPUT(aTelephonyAudioRouting.Output());
+    if (iTarSettings)
+        {
+        iTarSettings->SetTar(pckg, ETrue);
+        }
+    //TRACE_PRN_IF_ERR(aError);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallCSAdpt::NotifyClient
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallCSAdpt::NotifyClient(const gint strmId, const gint aCommand,
+        const gint aStatus, const gint64 /*aInt64*/)
+    {
+    iMsgBuffer.iRequest = aCommand;
+    iMsgBuffer.iStatus = aStatus;
+
+    if (strmId == iUplinkStreamId)
+        {
+        iMsgQueueUp.Send(iMsgBuffer);
+        }
+    else if (strmId == iDnlinkStreamId)
+        {
+        iMsgQueueDn.Send(iMsgBuffer);
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmscallipadpt.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,1402 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <AudioPreference.h>
+#include "tmsutility.h"
+#include "tmsclientserver.h"
+#include "tmsshared.h"
+#include "tmsipcallstream.h"
+#include "tmscallipadpt.h"
+
+using namespace TMS;
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::NewL
+// Symbian constructor.
+// -----------------------------------------------------------------------------
+//
+TMSCallIPAdpt* TMSCallIPAdpt::NewL()
+    {
+    TMSCallIPAdpt* self = new (ELeave) TMSCallIPAdpt();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::ConstructL
+// 2-nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void TMSCallIPAdpt::ConstructL()
+    {
+    TRACE_PRN_FN_ENT;
+    iIPUplink = NULL;
+    iIPDownlink = NULL;
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::TMSCallIPAdpt
+//
+// -----------------------------------------------------------------------------
+//
+TMSCallIPAdpt::TMSCallIPAdpt()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::~TMSCallIPAdpt
+//
+// -----------------------------------------------------------------------------
+//
+TMSCallIPAdpt::~TMSCallIPAdpt()
+    {
+    TRACE_PRN_FN_ENT;
+
+    iCodecs.Reset();
+    iCodecs.Close();
+    iArrBitrates.Reset();
+
+    delete iIPUplink;
+    delete iIPDownlink;
+
+    if (iMsgQueueUp.Handle() > 0)
+        {
+        iMsgQueueUp.Close();
+        }
+    if (iMsgQueueDn.Handle() > 0)
+        {
+        iMsgQueueDn.Close();
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::PostConstruct
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::PostConstruct()
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    iNextStreamId = 1;
+    iUplinkInitialized = FALSE;
+    iDnlinkInitialized = FALSE;
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::CreateStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::CreateStream(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint& outStrmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            {
+            status = TMS_RESULT_ALREADY_EXIST;
+            if (!iUplinkInitialized)
+                {
+                iUplinkInitialized = TRUE;
+                iUplinkStreamId = iNextStreamId;
+                outStrmId = iUplinkStreamId;
+                iNextStreamId++;
+                status = TMS_RESULT_SUCCESS;
+                }
+            break;
+            }
+        case TMS_STREAM_DOWNLINK:
+            {
+            status = TMS_RESULT_ALREADY_EXIST;
+            if (!iDnlinkInitialized)
+                {
+                iDnlinkInitialized = TRUE;
+                iDnlinkStreamId = iNextStreamId;
+                outStrmId = iDnlinkStreamId;
+                iNextStreamId++;
+                status = TMS_RESULT_SUCCESS;
+                }
+            break;
+            }
+        default:
+            {
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+            }
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::InitStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::InitStreamL(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId, TMSFormatType frmtType,
+        const RMessage2& aMessage)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+
+    TUint32 fourCC = TOFOURCC(frmtType);
+    if (fourCC == NULL)
+        {
+        return TMS_RESULT_INVALID_ARGUMENT;
+        }
+
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            {
+            status = TMS_RESULT_DOES_NOT_EXIST;
+            if (strmId == iUplinkStreamId)
+                {
+                SetFormat(iUplinkStreamId, fourCC);
+                status = OpenUplinkL(aMessage);
+                NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
+                }
+            break;
+            }
+        case TMS_STREAM_DOWNLINK:
+            {
+            status = TMS_RESULT_DOES_NOT_EXIST;
+            if (strmId == iDnlinkStreamId)
+                {
+                SetFormat(iDnlinkStreamId, fourCC);
+                status = OpenDownlinkL(aMessage);
+                NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
+                }
+            break;
+            }
+        default:
+            {
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+            }
+        }
+
+    TRACE_PRN_IF_ERR(status);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::StartStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::StartStream(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            {
+            if (strmId == iUplinkStreamId && iIPUplink)
+                {
+                iIPUplink->Start();
+                status = TMS_RESULT_SUCCESS;
+                NotifyClient(iUplinkStreamId, ECmdUplinkStarted, status);
+                }
+            break;
+            }
+        case TMS_STREAM_DOWNLINK:
+            {
+            if (strmId == iDnlinkStreamId && iIPDownlink)
+                {
+                iIPDownlink->Start();
+                status = TMS_RESULT_SUCCESS;
+                NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, status);
+                }
+            break;
+            }
+        default:
+            {
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+            }
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::PauseStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::PauseStream(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            {
+            if (strmId == iUplinkStreamId && iIPUplink)
+                {
+                iIPUplink->Stop();
+                status = TMS_RESULT_SUCCESS;
+                NotifyClient(iUplinkStreamId, ECmdUplinkPaused, status);
+                }
+            break;
+            }
+        case TMS_STREAM_DOWNLINK:
+            {
+            if (strmId == iDnlinkStreamId && iIPDownlink)
+                {
+                iIPDownlink->Stop();
+                status = TMS_RESULT_SUCCESS;
+                NotifyClient(iDnlinkStreamId, ECmdDownlinkPaused, status);
+                }
+            break;
+            }
+        default:
+            {
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+            }
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::StopStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::StopStream(TMSCallType /*callType*/, TMSStreamType strmType,
+        gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            {
+            if (strmId == iUplinkStreamId && iIPUplink)
+                {
+                iIPUplink->Stop();
+                status = TMS_RESULT_SUCCESS;
+                NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
+                }
+            break;
+            }
+        case TMS_STREAM_DOWNLINK:
+            {
+            if (strmId == iDnlinkStreamId && iIPDownlink)
+                {
+                iIPDownlink->Stop();
+                status = TMS_RESULT_SUCCESS;
+                NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
+                }
+            break;
+            }
+        default:
+            {
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+            }
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::DeinitStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::DeinitStream(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            {
+            if (strmId == iUplinkStreamId && iIPUplink)
+                {
+                iIPUplink->Stop();
+                //iUplinkStreamId = -1;
+                iUplinkInitialized = FALSE;
+                status = TMS_RESULT_SUCCESS;
+                NotifyClient(iUplinkStreamId, ECmdDownlinkDeInitComplete,
+                        status);
+                }
+            break;
+            }
+        case TMS_STREAM_DOWNLINK:
+            {
+            if (strmId == iDnlinkStreamId && iIPDownlink)
+                {
+                iIPDownlink->Stop();
+                //iDnlinkStreamId = -1;
+                iDnlinkInitialized = FALSE;
+                status = TMS_RESULT_SUCCESS;
+                NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete,
+                        status);
+                }
+            break;
+            }
+        default:
+            {
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+            }
+        }
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::DeleteStream
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::DeleteStream(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            {
+            // This is additional error checking
+            if (strmId == iUplinkStreamId)
+                {
+                iUplinkStreamId = -1;
+                iUplinkInitialized = FALSE;
+                }
+            break;
+            }
+        case TMS_STREAM_DOWNLINK:
+            {
+            // This is additional error checking
+            if (strmId == iDnlinkStreamId)
+                {
+                iDnlinkStreamId = -1;
+                iDnlinkInitialized = FALSE;
+                }
+            break;
+            }
+        default:
+            {
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+            }
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::DataXferBufferEmptied
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::DataXferBufferEmptied(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_UPLINK:
+            {
+            if (strmId == iUplinkStreamId)
+                {
+                TRAP(status, BufferEmptiedL());
+                }
+            break;
+            }
+        case TMS_STREAM_DOWNLINK:
+            status = TMS_RESULT_ILLEGAL_OPERATION;
+            break;
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::DataXferBufferFilled
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::DataXferBufferFilled(TMSCallType /*callType*/,
+        TMSStreamType strmType, gint strmId, guint datasize)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_DOWNLINK:
+            if (strmId == iDnlinkStreamId)
+                {
+                TRAP(status, BufferFilledL(datasize));
+                }
+            break;
+        case TMS_STREAM_UPLINK:
+            status = TMS_RESULT_ILLEGAL_OPERATION;
+            break;
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetDataXferBufferHndl
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetDataXferBufferHndl(const TMSCallType /*callType*/,
+        const TMSStreamType strmType, const gint strmId, const guint32 key,
+        RChunk& chunk)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (strmType)
+        {
+        case TMS_STREAM_DOWNLINK:
+            {
+            if (strmId == iDnlinkStreamId)
+                {
+                TRAP(status, GetDataXferChunkHndl(strmType, key, chunk));
+                }
+            break;
+            }
+        case TMS_STREAM_UPLINK:
+            {
+            if (strmId == iUplinkStreamId)
+                {
+                TRAP(status, GetDataXferChunkHndl(strmType, key, chunk));
+                }
+            break;
+            }
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetMaxVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetMaxVolume(guint& volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+
+    if (iDnlinkInitialized && iIPDownlink)
+        {
+        status = iIPDownlink->GetMaxVolume(volume);
+        iMaxVolume = volume;
+        TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt: GetMaxVolume [%d]"), iMaxVolume);
+        }
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetVolume(const guint volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iDnlinkInitialized && iIPDownlink)
+        {
+        status = iIPDownlink->SetVolume(volume);
+        NotifyClient(iDnlinkStreamId, ECmdSetVolume, status);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetVolume(guint& volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iDnlinkInitialized && iIPDownlink)
+        {
+        status = iIPDownlink->GetVolume(volume);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetMaxGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetMaxGain(guint& gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iUplinkInitialized && iIPUplink)
+        {
+        status = iIPUplink->GetMaxGain(gain);
+        iMaxGain = gain;
+        TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt::GetMaxGain [%d]"), iMaxGain);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetGain(const guint gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iUplinkInitialized && iIPUplink)
+        {
+        status = iIPUplink->SetGain(gain);
+        NotifyClient(iUplinkStreamId, ECmdSetGain, status);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetGain(guint& gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iUplinkInitialized && iIPUplink)
+        {
+        status = iIPUplink->GetGain(gain);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetGlobalMaxVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetGlobalMaxVolume(guint& volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iDnlinkInitialized && iIPDownlink)
+        {
+        status = iIPDownlink->GetMaxVolume(volume);
+        iMaxVolume = volume;
+        TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt: GetMaxVolume [%d]"), iMaxVolume);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetGlobalVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetGlobalVolume(const guint volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iDnlinkInitialized && iIPDownlink)
+        {
+        status = iIPDownlink->SetVolume(volume);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetGlobalVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetGlobalVolume(guint& volume)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iDnlinkInitialized && iIPDownlink)
+        {
+        status = iIPDownlink->GetVolume(volume);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetGlobalMaxGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetGlobalMaxGain(guint& gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iUplinkInitialized && iIPUplink)
+        {
+        status = iIPUplink->GetMaxGain(gain);
+        iMaxGain = gain;
+        TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt::GetMaxGain [%d]"), iMaxGain);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetGlobalGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetGlobalGain(const guint gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iUplinkInitialized && iIPUplink)
+        {
+        status = iIPUplink->SetGain(gain);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetGlobalGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetGlobalGain(guint& gain)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iUplinkInitialized && iIPUplink)
+        {
+        status = iIPUplink->GetGain(gain);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetCodecMode(const TMSFormatType fmttype,
+        const TMSStreamType strmtype, gint& mode)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (fmttype)
+        {
+        case TMS_FORMAT_ILBC:
+            status = GetIlbcCodecMode(mode, strmtype);
+            break;
+        case TMS_FORMAT_G711:
+            status = GetG711CodecMode(mode, strmtype);
+            break;
+        default:
+            status = TMS_RESULT_FORMAT_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetCodecMode(const TMSFormatType fmttype,
+        const TMSStreamType strmtype, const gint mode)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+    switch (fmttype)
+        {
+        case TMS_FORMAT_ILBC:
+            status = SetIlbcCodecMode(mode, strmtype);
+            break;
+        case TMS_FORMAT_G711:
+            status = SetG711CodecMode(mode, strmtype);
+            break;
+        default:
+            status = TMS_RESULT_FORMAT_TYPE_NOT_SUPPORTED;
+            break;
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetSupportedBitRatesCount
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetSupportedBitRatesCount(guint& count)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iIPUplink)
+        {
+        status = iIPUplink->GetSupportedBitrates(iArrBitrates);
+        count = iArrBitrates.Count();
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetSupportedBitRates
+//
+// Bitrates are already returned from the codec as a result of call to
+// GetSupportedBitratesCount(). Just pack them into a descriptor and return
+// back to the client.
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetSupportedBitRates(CBufFlat*& brbuffer)
+    {
+    TRAPD(status, GetSupportedBitRatesL(brbuffer));
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetSupportedBitRatesL
+//
+// GetSupportedBitRates implementation which can leave.
+// -----------------------------------------------------------------------------
+//
+void TMSCallIPAdpt::GetSupportedBitRatesL(CBufFlat*& brbuffer)
+    {
+    TRACE_PRN_FN_ENT;
+    RBufWriteStream stream;
+    stream.Open(*brbuffer);
+    CleanupClosePushL(stream);
+    guint numOfItems = iArrBitrates.Count();
+
+    for (guint i = 0; i < numOfItems; i++)
+        {
+        stream.WriteUint32L(iArrBitrates[i]);
+        //TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt: BR: [%d]"), iArrBitrates[i]);
+        }
+
+    CleanupStack::PopAndDestroy(&stream);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetBitRate
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetBitRate(guint& bitrate)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iIPUplink)
+        {
+        status = iIPUplink->GetBitrate(bitrate);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetBitRate
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetBitRate(const guint bitrate)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iIPUplink)
+        {
+        status = iIPUplink->SetBitrate(bitrate);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetVAD
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetVAD(const TMSFormatType fmttype, gboolean& vad)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iIPUplink)
+        {
+        status = iIPUplink->GetVad(fmttype, vad);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetVAD
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetVAD(const TMSFormatType fmttype, const gboolean vad)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iIPUplink)
+        {
+        status = iIPUplink->SetVad(fmttype, vad);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetCNG
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetCNG(const TMSFormatType fmttype, gboolean& cng)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iIPDownlink)
+        {
+        status = iIPDownlink->GetCng(fmttype, cng);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetCNG
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetCNG(const TMSFormatType fmttype, const gboolean cng)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iIPDownlink)
+        {
+        status = iIPDownlink->SetCng(fmttype, cng);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetPlc
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetPlc(const TMSFormatType fmttype, gboolean& plc)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iIPDownlink)
+        {
+        status = iIPDownlink->GetPlc(fmttype, plc);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetPlc
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetPlc(const TMSFormatType fmttype, const gboolean plc)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_INVALID_STATE);
+    if (iIPDownlink)
+        {
+        status = iIPDownlink->SetPlc(fmttype, plc);
+        }
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::OpenDownlinkL
+// Method for player initialization.
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::OpenDownlinkL(const RMessage2& aMessage)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+
+    // Clients must have MultimediaDD capability to use this priority/pref.
+    // TODO: Also, TMS will monitor for emergency call and if detected it
+    //       will deny access to audio resources.
+    iPriority.iPref = KAudioPrefVoipAudioDownlink;
+    iPriority.iPriority = KAudioPriorityVoipAudioDownlink;
+
+    if (!iIPDownlink)
+        {
+        iIPDownlink = TMSIPDownlink::NewL(iDnFourCC, iPriority);
+        }
+
+    if (iIPDownlink)
+        {
+        // Open message queue for handling server notifications to the client
+        if (iMsgQueueDn.Handle() <= 0)
+            {
+            // Second argument in TMSCallProxy::InitStream
+            status = iMsgQueueDn.Open(aMessage, 1);
+            }
+
+        if (status == TMS_RESULT_SUCCESS)
+            {
+            // For transfer data buffer processing
+            iIPDownlink->SetMsgQueue(iMsgQueueDn);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(status);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::OpenUplinkL
+// Method for recorder initialization.
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::OpenUplinkL(const RMessage2& aMessage)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_SUCCESS);
+
+    // Ensure clients have MultimediaDD capability to use this priority/pref
+    iPriority.iPref = KAudioPrefVoipAudioUplink;
+    iPriority.iPriority = KAudioPriorityVoipAudioUplink;
+
+    if (!iIPUplink)
+        {
+        iIPUplink = TMSIPUplink::NewL(iUpFourCC, iPriority);
+        }
+
+    if (iIPUplink)
+        {
+        // Open message queue for handling server notifications to the client
+        if (iMsgQueueUp.Handle() <= 0)
+            {
+            // Second argument in TMSCallProxy::InitStream
+            status = iMsgQueueUp.Open(aMessage, 1);
+            }
+
+        if (status == TMS_RESULT_SUCCESS)
+            {
+            // For transfer data buffer processing
+            iIPUplink->SetMsgQueue(iMsgQueueUp);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(status);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetFormat
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallIPAdpt::SetFormat(const gint strmId, const TUint32 aFormat)
+    {
+    if (strmId == iUplinkStreamId)
+        {
+        iUpFourCC = aFormat;
+        }
+    else if (strmId == iDnlinkStreamId)
+        {
+        iDnFourCC = aFormat;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::BufferFilled
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallIPAdpt::BufferFilledL(TUint dataSize)
+    {
+    if (iIPDownlink)
+        {
+        iIPDownlink->BufferFilled(dataSize);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::BufferEmptied
+//
+// -----------------------------------------------------------------------------
+//
+void TMSCallIPAdpt::BufferEmptiedL()
+    {
+    if (iIPUplink)
+        {
+        iIPUplink->BufferEmptied();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetDataXferChunkHndl
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetDataXferChunkHndl(const TMSStreamType strmType,
+        const TUint32 key, RChunk& chunk)
+    {
+    TRACE_PRN_FN_ENT;
+
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    switch (strmType)
+        {
+        case TMS_STREAM_DOWNLINK:
+            {
+            if (iIPDownlink)
+                {
+                status = iIPDownlink->GetDataXferChunkHndl(key, chunk);
+                }
+            break;
+            }
+        case TMS_STREAM_UPLINK:
+            {
+            if (iIPUplink)
+                {
+                status = iIPUplink->GetDataXferChunkHndl(key, chunk);
+                }
+            break;
+            }
+        default:
+            status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+            break;
+        }
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetIlbcCodecMode(const gint mode,
+        const TMSStreamType strmtype)
+    {
+    gint status(TMS_RESULT_INVALID_ARGUMENT);
+
+    if (strmtype == TMS_STREAM_DOWNLINK)
+        {
+        if (iDnlinkInitialized && iIPDownlink)
+            {
+            status = iIPDownlink->SetIlbcCodecMode(mode);
+            }
+        }
+    else if (strmtype == TMS_STREAM_UPLINK)
+        {
+        if (iUplinkInitialized && iIPUplink)
+            {
+            status = iIPUplink->SetIlbcCodecMode(mode);
+            }
+        }
+
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetIlbcCodecMode(gint& mode, const TMSStreamType strmtype)
+    {
+    gint status(TMS_RESULT_INVALID_ARGUMENT);
+
+    if (strmtype == TMS_STREAM_DOWNLINK)
+        {
+        if (iDnlinkInitialized && iIPDownlink)
+            {
+            status = iIPDownlink->GetIlbcCodecMode(mode);
+            }
+        }
+    else if (strmtype == TMS_STREAM_UPLINK)
+        {
+        if (iUplinkInitialized && iIPUplink)
+            {
+            status = iIPUplink->GetIlbcCodecMode(mode);
+            }
+        }
+
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetG711CodecMode(const gint mode,
+        const TMSStreamType strmtype)
+    {
+    gint status(TMS_RESULT_INVALID_ARGUMENT);
+
+    if (strmtype == TMS_STREAM_DOWNLINK)
+        {
+        if (iDnlinkInitialized && iIPDownlink)
+            {
+            status = iIPDownlink->SetG711CodecMode(mode);
+            }
+        }
+    else if (strmtype == TMS_STREAM_UPLINK)
+        {
+        if (iUplinkInitialized && iIPUplink)
+            {
+            status = iIPUplink->SetG711CodecMode(mode);
+            }
+        }
+
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetG711CodecMode(gint& mode, const TMSStreamType strmtype)
+    {
+    gint status(TMS_RESULT_INVALID_ARGUMENT);
+
+    if (strmtype == TMS_STREAM_DOWNLINK)
+        {
+        if (iDnlinkInitialized && iIPDownlink)
+            {
+            status = iIPDownlink->GetG711CodecMode(mode);
+            }
+        }
+    else if (strmtype == TMS_STREAM_UPLINK)
+        {
+        if (iUplinkInitialized && iIPUplink)
+            {
+            status = iIPUplink->GetG711CodecMode(mode);
+            }
+        }
+
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::FrameModeRequiredForEC
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::FrameModeRqrdForEC(gboolean& frmodereq)
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iIPDownlink)
+        {
+        status = iIPDownlink->FrameModeRqrdForEC(frmodereq);
+        }
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetFrameMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetFrameMode(const gboolean frmode)
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iIPDownlink)
+        {
+        status = iIPDownlink->SetFrameMode(frmode);
+        }
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetFrameMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetFrameMode(gboolean& frmode)
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iIPDownlink)
+        {
+        status = iIPDownlink->GetFrameMode(frmode);
+        }
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::ConcealErrorForNextBuffer
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::ConcealErrorForNextBuffer()
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iIPDownlink)
+        {
+        status = iIPDownlink->ConcealErrorForNextBuffer();
+        }
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::BadLsfNextBuffer
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::BadLsfNextBuffer()
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iIPDownlink)
+        {
+        status = iIPDownlink->BadLsfNextBuffer();
+        }
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::SetOutput
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::SetOutput(TMSAudioOutput output)
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iDnlinkInitialized && iIPDownlink)
+        {
+        TRAP(status, iIPDownlink->SetAudioDeviceL(output));
+        }
+    return status;
+    }
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetOutput
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetOutput(TMSAudioOutput& output)
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iDnlinkInitialized && iIPDownlink)
+        {
+        TRAP(status, iIPDownlink->GetAudioDeviceL(output));
+        }
+    return status;
+    }
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetPreviousOutput
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetPreviousOutput(TMSAudioOutput& /*output*/)
+    {
+    return TMS_RESULT_FEATURE_NOT_SUPPORTED;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::GetAvailableOutputsL
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::GetAvailableOutputsL(gint& /*count*/,
+        CBufFlat*& /*outputsbuffer*/)
+    {
+    return TMS_RESULT_FEATURE_NOT_SUPPORTED;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallIPAdpt::NotifyClient
+// -----------------------------------------------------------------------------
+//
+void TMSCallIPAdpt::NotifyClient(const gint strmId, const TInt aCommand,
+        const TInt aStatus, const TInt64 /*aInt64*/)
+    {
+    iMsgBuffer.iRequest = aCommand;
+    iMsgBuffer.iStatus = aStatus;
+
+    if (strmId == iUplinkStreamId)
+        {
+        iMsgQueueUp.Send(iMsgBuffer);
+        }
+    else if (strmId == iDnlinkStreamId)
+        {
+        iMsgQueueDn.Send(iMsgBuffer);
+        }
+    }
+
+// End of file
--- a/mmserv/tms/tmscallserver/src/tmscallserver.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmscallserver.cpp	Tue May 11 16:42:02 2010 +0300
@@ -16,7 +16,7 @@
  */
 
 #include "tmscallserver.h"
-#include "delaytimer.h"
+#include "tmsdelaytimer.h"
 #include "tmsutility.h"
 #include "tmscallsession.h"
 
--- a/mmserv/tms/tmscallserver/src/tmscallsession.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmscallsession.cpp	Tue May 11 16:42:02 2010 +0300
@@ -17,7 +17,7 @@
 
 #include "tmsutility.h"
 #include "tmsutility.h"
-#include "calladpt.h"
+#include "tmscalladpt.h"
 #include "tmscallserver.h"
 #include "tmscallclisrv.h"
 #include "tmscallsession.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmscsdevsound.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,206 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <AudioPreference.h>
+#include <glib.h>
+#include <S60FourCC.h>
+#include "tmscsdevsound.h"
+#include "tmscsdevsoundobserver.h"
+
+using namespace TMS;
+
+// -----------------------------------------------------------------------------
+// TMSCSPDevSound
+// -----------------------------------------------------------------------------
+//
+TMSCSPDevSound::TMSCSPDevSound(TMSCSPDevSoundObserver& aObserver) :
+    iObserver(aObserver)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// ConstructL
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::ConstructL(TMMFState aMode, gint aAudioPreference,
+        gint aAudioPriority)
+    {
+    TMMFPrioritySettings audioPriority;
+    TFourCC modemFourCC;
+    modemFourCC.Set(KS60FourCCCodeModem);
+    iDevSound = CMMFDevSound::NewL();
+    if (iDevSound)
+        {
+#ifndef __WINSCW__
+        iDevSound->InitializeL(*this, modemFourCC, aMode);
+#else //For testing TMS in WINSCW
+        iDevSound->InitializeL(*this, KMMFFourCCCodePCM16, aMode);
+#endif
+        iStreamType = aAudioPreference;
+        audioPriority.iPriority = aAudioPriority;
+        audioPriority.iPref = aAudioPreference;
+        audioPriority.iState = aMode;
+        iDevSound->SetPrioritySettings(audioPriority);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Not implemented
+// -----------------------------------------------------------------------------
+//
+TMSCSPDevSound::~TMSCSPDevSound()
+    {
+    delete iDevSound;
+    }
+
+// -----------------------------------------------------------------------------
+// Tries to activate the audio stream if not active or activating
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::Activate()
+    {
+    if (!IsActive() && !IsActivationOngoing())
+        {
+        iActivationOngoing = ETrue;
+        TRAP_IGNORE(DoActivateL());
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Deactivates the audio device.
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::Deactivate()
+    {
+    if (iDevSound && (IsActive() || IsActivationOngoing()))
+        {
+        iDevSound->Stop();
+        iActive = EFalse;
+        iActivationOngoing = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// ActivationOngoing
+// -----------------------------------------------------------------------------
+//
+TBool TMSCSPDevSound::IsActivationOngoing() const
+    {
+    return iActivationOngoing;
+    }
+
+// -----------------------------------------------------------------------------
+// IsActive
+// -----------------------------------------------------------------------------
+//
+TBool TMSCSPDevSound::IsActive() const
+    {
+    return iActive;
+    }
+
+// -----------------------------------------------------------------------------
+// DevSound
+// -----------------------------------------------------------------------------
+//
+CMMFDevSound& TMSCSPDevSound::DevSound()
+    {
+    return *iDevSound;
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Not implemented
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::InitializeComplete(TInt aError)
+    {
+    if (iStreamType == KAudioPrefCSCallDownlink)
+        {
+        iObserver.DownlinkInitCompleted(aError);
+        }
+    else
+        {
+        iObserver.UplinkInitCompleted(aError);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Not implemented
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Not implemented
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::PlayError(TInt /*aError*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Not implemented
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::ToneFinished(TInt /*aError*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Not implemented
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Not implemented
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::RecordError(TInt /*aError*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Not implemented
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::ConvertError(TInt /*aError*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Not implemented
+// -----------------------------------------------------------------------------
+//
+void TMSCSPDevSound::DeviceMessage(TUid /*aMessageType*/,
+        const TDesC8& /*aMsg*/)
+    {
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmscsdownlink.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,166 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <AudioPreference.h>
+#include "tmscsdownlink.h"
+#include "tmscsdevsoundobserver.h"
+
+using namespace TMS;
+
+const gint KDefaultVolume = 4;
+const gint KDefaultMaxVolume = 10;
+
+// -----------------------------------------------------------------------------
+// Static constructor
+// -----------------------------------------------------------------------------
+//
+TMSCSDownlink* TMSCSDownlink::NewL(TMSCSPDevSoundObserver& aObserver)
+    {
+    TMSCSDownlink* self = new (ELeave) TMSCSDownlink(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+TMSCSDownlink::~TMSCSDownlink()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Sets volume
+// -----------------------------------------------------------------------------
+//
+void TMSCSDownlink::SetVolume(gint aVolume)
+    {
+    if (iDevSound)
+        {
+        gint maxVolume(iDevSound->MaxVolume());
+        maxVolume = (maxVolume > 0) ? maxVolume : KDefaultMaxVolume;
+        gint scaledVolume = (aVolume * maxVolume) / KDefaultMaxVolume;
+        iDevSound->SetVolume(scaledVolume);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Gives volume
+// -----------------------------------------------------------------------------
+//
+gint TMSCSDownlink::Volume()
+    {
+    gint vol = 0;
+    if (iDevSound)
+        {
+        vol = iDevSound->Volume();
+        }
+    return vol;
+    }
+
+// -----------------------------------------------------------------------------
+// Gives max volume
+// -----------------------------------------------------------------------------
+//
+gint TMSCSDownlink::MaxVolume()
+    {
+    gint vol = 0;
+    if (iDevSound)
+        {
+        vol = iDevSound->MaxVolume();
+        }
+    return vol;
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Downlink stream has been activated successfully.
+// -----------------------------------------------------------------------------
+//
+void TMSCSDownlink::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
+    {
+    //CSPLOGSTRING( CSPINT, "TMSCSDownlink:: activated" );
+    // We dont react to devsound messages unless we are activating.
+    if (IsActivationOngoing())
+        {
+        iActive = ETrue;
+        iActivationOngoing = EFalse;
+        iObserver.DownlinkActivatedSuccessfully();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Downlink stream activation failed
+// -----------------------------------------------------------------------------
+//
+void TMSCSDownlink::PlayError(TInt aError)
+    {
+    //CSPLOGSTRING( CSPINT, "TMSCSDownlink::PlayError" );
+
+    // We dont react to devsound messages unless we are activating.
+    if (IsActivationOngoing())
+        {
+        //CSPLOGSTRING( CSPINT, "TMSCSDownlink::PlayError activation failed" );
+        if (aError == KErrAccessDenied)
+            {
+            iActivationOngoing = EFalse;
+            iObserver.DownlinkActivationFailed();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSPDevsound
+// Tries to activate Downlink stream.
+// -----------------------------------------------------------------------------
+//
+void TMSCSDownlink::DoActivateL()
+    {
+    if (iDevSound)
+        {
+        iDevSound->PlayInitL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Constructor
+// -----------------------------------------------------------------------------
+//
+TMSCSDownlink::TMSCSDownlink(TMSCSPDevSoundObserver& aObserver) :
+    TMSCSPDevSound(aObserver)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Second phase constructor
+// -----------------------------------------------------------------------------
+//
+void TMSCSDownlink::ConstructL()
+    {
+    TMSCSPDevSound::ConstructL(EMMFStatePlaying, KAudioPrefCSCallDownlink,
+            KAudioPriorityCSCallDownlink);
+
+    if (iDevSound)
+        {
+        iDevSound->SetVolume(KDefaultVolume);
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmscsuplink.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,204 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <AudioPreference.h>
+#include "tmscsuplink.h"
+#include "tmscsdevsoundobserver.h"
+
+using namespace TMS;
+
+// Mute value
+const gint KSetMuteToDevSound = 0;
+
+// -----------------------------------------------------------------------------
+// Static constructor.
+// -----------------------------------------------------------------------------
+//
+TMSCSUplink* TMSCSUplink::NewL(TMSCSPDevSoundObserver& aObserver)
+    {
+    TMSCSUplink* self = new (ELeave) TMSCSUplink(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+TMSCSUplink::~TMSCSUplink()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Gives mic mute state
+// -----------------------------------------------------------------------------
+//
+TBool TMSCSUplink::IsMuted()
+    {
+    TBool isMuted = EFalse;
+    gint gain = 0;
+    if (iDevSound)
+        {
+        gain = iDevSound->Gain();
+        }
+    if (!gain)
+        {
+        // Mute is on
+        isMuted = ETrue;
+        }
+    //   CSPLOGSTRING( CSPINT, "TMSCSUplink::IsMuted" );
+    return isMuted;
+    }
+
+// -----------------------------------------------------------------------------
+// Set mic muted.
+// -----------------------------------------------------------------------------
+//
+void TMSCSUplink::SetMuted()
+    {
+    if (iDevSound)
+        {
+        iDevSound->SetGain(KSetMuteToDevSound);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Set mic unmuted
+// -----------------------------------------------------------------------------
+//
+void TMSCSUplink::SetUnmuted()
+    {
+    if (iDevSound)
+        {
+        iDevSound->SetGain(iDevSound->MaxGain());
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Sets gain
+// -----------------------------------------------------------------------------
+//
+void TMSCSUplink::SetGain(gint aGain)
+    {
+    if (iDevSound)
+        {
+        iDevSound->SetGain(aGain);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Gives volume
+// -----------------------------------------------------------------------------
+//
+gint TMSCSUplink::Gain()
+    {
+    gint gain = 0;
+    if (iDevSound)
+        {
+        gain = iDevSound->Gain();
+        }
+    return gain;
+    }
+
+// -----------------------------------------------------------------------------
+// Gives max gain
+// -----------------------------------------------------------------------------
+//
+gint TMSCSUplink::MaxGain()
+    {
+    gint gain = 0;
+    if (iDevSound)
+        {
+        gain = iDevSound->MaxGain();
+        }
+    return gain;
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Activation was successfull.
+// -----------------------------------------------------------------------------
+//
+void TMSCSUplink::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/)
+    {
+    //  CSPLOGSTRING( CSPINT, "TMSCSUplink::BufferToBeEmptied" );
+
+    // We dont react to devsound messages unless we are activating.
+    if (IsActivationOngoing())
+        {
+        iActive = ETrue;
+        iActivationOngoing = EFalse;
+        iObserver.UplinkActivatedSuccessfully();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From class MDevSoundObserver
+// Activation feiled
+// -----------------------------------------------------------------------------
+//
+void TMSCSUplink::RecordError(TInt aError)
+    {
+    //  CSPLOGSTRING( CSPINT, "TMSCSUplink::RecordError" );
+
+    // We dont react to devsound messages unless we are activating.
+    if (IsActivationOngoing())
+        {
+        if (aError == KErrAccessDenied)
+            {
+            iActivationOngoing = EFalse;
+            iObserver.UplinkActivationFailed();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From class TMSCSPDevSound
+// Tries to activate mic stream. Stream becomes active when BufferToBeFilled
+// gets called.
+// -----------------------------------------------------------------------------
+//
+void TMSCSUplink::DoActivateL()
+    {
+    if (iDevSound)
+        {
+        iDevSound->RecordInitL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Constructor
+// -----------------------------------------------------------------------------
+//
+TMSCSUplink::TMSCSUplink(TMSCSPDevSoundObserver& aObserver) :
+    TMSCSPDevSound(aObserver)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Second phase constructor
+// -----------------------------------------------------------------------------
+//
+void TMSCSUplink::ConstructL()
+    {
+    TMSCSPDevSound::ConstructL(EMMFStateRecording, KAudioPrefCSCallUplink,
+            KAudioPriorityCSCallUplink);
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmsdelaytimer.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,123 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+// INCLUDE FILES
+#include "tmsdelaytimer.h"
+#include "tmsutility.h"
+
+using namespace TMS;
+
+// -----------------------------------------------------------------------------
+// TMSCallDelayTimer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+TMSCallDelayTimer* TMSCallDelayTimer::NewL()
+    {
+    TRACE_PRN_FN_ENT;
+    TMSCallDelayTimer* self = new (ELeave) TMSCallDelayTimer;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    TRACE_PRN_FN_EXT;
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallDelayTimer::TMSCallDelayTimer()
+// C++ constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TMSCallDelayTimer::TMSCallDelayTimer() :
+    CActive(CActive::EPriorityStandard)
+    {
+    TRACE_PRN_FN_ENT;
+    CActiveScheduler::Add(this);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallDelayTimer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void TMSCallDelayTimer::ConstructL()
+    {
+    TRACE_PRN_FN_ENT;
+    User::LeaveIfError(iShutDownTimer.CreateLocal());
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallDelayTimer::~TMSCallDelayTimer
+// Destructor
+// -----------------------------------------------------------------------------
+//
+TMSCallDelayTimer::~TMSCallDelayTimer()
+    {
+    TRACE_PRN_FN_ENT;
+    Cancel();
+    iShutDownTimer.Close();
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallDelayTimer::SetDelay
+// Request a timeout after aDelay
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TMSCallDelayTimer::SetDelay(TTimeIntervalMicroSeconds32 aDelay)
+    {
+    TRACE_PRN_FN_ENT;
+    if (!IsActive())
+        {
+        iStatus = KRequestPending;
+        SetActive();
+        iShutDownTimer.After(iStatus, aDelay);
+        }
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallDelayTimer::RunL
+// Called by Active object framework when timer times out.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TMSCallDelayTimer::RunL()
+    {
+    TRACE_PRN_FN_ENT;
+    CActiveScheduler::Stop();
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSCallDelayTimer::DoCancel
+// Called by the Active object framework when user cancels active object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TMSCallDelayTimer::DoCancel()
+    {
+    TRACE_PRN_FN_ENT;
+    iShutDownTimer.Cancel();
+    TRACE_PRN_FN_EXT;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmsipcalldownlink.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,911 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <audiopreference.h>
+#include <audiooutput.h>
+#include <mmcccodecinformation.h>
+#include <gstappsrc.h>
+#include "tmsutility.h"
+#include "gsterrorconcealmentinterface.h"
+#include "gstg711decoderinterface.h"
+#include "gstilbcdecoderinterface.h"
+#include "gstg729decoderinterface.h"
+#include "ipcallstream.h"
+
+using namespace TMS;
+
+static TMSIPDownlink* iSelfDn;
+#ifdef _DEBUG
+static TInt iHeap;
+#endif //_DEBUG
+GstBuffer* gstDnlBuffer;
+GstCaps* caps;
+gint requestBufLen;
+
+#ifdef __PLAY_WAV_FROM_FILE__
+_LIT16(KTestFile1, "c:\\data\\sounds\\digital\\sample1.wav");
+#endif
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::cb_raw_playback_handoff
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::cb_raw_playback_handoff(GstElement* /*appsrc*/,
+        guint size)
+    {
+    TRACE_PRN_N(_L("TMS->DNL: cb_raw_playback_handoff"));
+
+    requestBufLen = size;
+
+#ifdef _DEBUG
+    TInt block;
+    RHeap &heap = User::Heap();
+    TInt avail = heap.Available(block);
+    RDebug::Print(_L("TMS->PRINT-HEAP-DN:Size[%d], Available[%d], delta[%d]"),
+    heap.Size(), avail, (iHeap - avail));
+    iHeap = avail;
+#endif //_DEBUG
+    iSelfDn->BufferToBeFilled();
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::bus_call
+// -----------------------------------------------------------------------------
+//
+gboolean TMSIPDownlink::bus_call(GstBus* /*bus*/, GstMessage* msg,
+        gpointer /*data*/)
+    {
+    switch (GST_MESSAGE_TYPE(msg))
+        {
+        case GST_MESSAGE_EOS:
+            {
+            gst_element_set_state(iSelfDn->iPipelinePlay, GST_STATE_NULL);
+            gst_object_unref(GST_OBJECT(iSelfDn->iPipelinePlay));
+            break;
+            }
+        case GST_MESSAGE_ERROR:
+            {
+            gchar* debug;
+            GError* err;
+            gst_message_parse_error(msg, &err, &debug);
+            g_free(debug);
+            g_print("Error: %s\n", err->message);
+            g_error_free(err);
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::gst_initialize_play
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::gst_initialize_play()
+    {
+    TRACE_PRN_FN_ENT;
+
+    gint err = KErrNone;
+
+    // create elements
+    iPipelinePlay = gst_pipeline_new("pipelinePlay");
+    iAppSrc = gst_element_factory_make("appsrc", "source");
+    iSink = gst_element_factory_make("devsoundsink", "sink");
+
+    if (!iAppSrc || !iSink)
+        {
+        err = KErrNotFound;
+        TRACE_PRN_IF_ERR(err);
+        return err;
+        }
+
+    iBusPlay = gst_pipeline_get_bus(GST_PIPELINE(iPipelinePlay));
+    gst_bus_add_watch(iBusPlay, TMSIPDownlink::bus_call, NULL);
+    gst_object_unref(iBusPlay);
+
+    iMaxBufLen = ConfigureMedia(iCodecID);
+
+    g_object_set(iAppSrc, "stream-type", 0, "blocksize", iMaxBufLen, NULL);
+    gst_bin_add_many(GST_BIN(iPipelinePlay), iAppSrc, iSink, NULL);
+    gst_element_link(iAppSrc, iSink);
+
+    caps = gst_caps_new_simple(iMediaType,
+                               "width", G_TYPE_INT, 16,
+                               "depth", G_TYPE_INT, 16,
+                               "signed", G_TYPE_BOOLEAN, TRUE,
+                               "endianness", G_TYPE_INT, G_BYTE_ORDER,
+                               "rate", G_TYPE_INT, 8000,
+                               "channels", G_TYPE_INT, 1,
+                               NULL);
+
+    //NOTE: d/s is not ready at this time to return true maxvolume
+    TInt maxvol = 10;
+#ifdef __WINSCW__
+    maxvol = 10000;
+#endif //__WINSCW__
+    g_object_set(G_OBJECT(iSink),
+                 "volume", maxvol,
+#ifndef __WINSCW__
+                "priority", (gint)iPriority.iPriority,
+                "preference", (gint)iPriority.iPref,
+#endif
+                NULL);
+
+    gst_app_src_set_caps(GST_APP_SRC(iAppSrc), caps);
+    gst_app_src_set_max_bytes(GST_APP_SRC(iAppSrc), iMaxBufLen);
+    err = SetCodecCi();
+    //gst_element_set_state(iPipelinePlay, GST_STATE_READY);
+
+    TRACE_PRN_FN_EXT;
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::gst_play_raw
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::gst_play_raw()
+    {
+    TRACE_PRN_FN_ENT;
+
+    // start playback
+    gst_element_set_state(iPipelinePlay, GST_STATE_PLAYING);
+
+    //configure the appsrc, we will push buffer to appsrc when it needs more data
+    g_signal_connect(iAppSrc, "need-data",
+                     G_CALLBACK (cb_raw_playback_handoff),
+                     NULL);
+    TRACE_PRN_FN_EXT;
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::TMSIPDownlink
+// Standard Constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPDownlink::TMSIPDownlink()
+    {
+    iSelfDn = this;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::~TMSIPDownlink
+// Standard Constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPDownlink::~TMSIPDownlink()
+    {
+    TRACE_PRN_FN_ENT;
+
+    Stop();
+    gst_caps_unref(caps);
+    gst_object_unref(GST_OBJECT(iPipelinePlay));
+    gst_deinit();
+
+    delete iErrConcealmentIntfc;
+    delete iG711DecoderIntfc;
+    delete iG729DecoderIntfc;
+    delete iIlbcDecoderIntfc;
+
+#ifdef __PLAY_WAV_FROM_FILE__
+    iFs.Close();
+    delete fbuf;
+#endif
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::NewL
+// Symbian two-phase constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPDownlink* TMSIPDownlink::NewL(const guint32 codecID,
+        const TMMFPrioritySettings priority)
+    {
+    TMSIPDownlink* self = new (ELeave) TMSIPDownlink();
+    CleanupStack::PushL(self);
+    self->ConstructL(codecID, priority);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::ConstructL
+// Part two of Symbian two phase construction
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::ConstructL(const guint32 codecID,
+        const TMMFPrioritySettings priority)
+    {
+    TRACE_PRN_FN_ENT;
+
+    iCodecID = codecID;
+    iPriority = priority;
+    //    SetTime();
+    gst_init(NULL, NULL);
+    //    CalcLatency();
+    //    SetTime();
+
+    gint err = gst_initialize_play();
+    if (err != TMS_RESULT_SUCCESS)
+        {
+        User::Leave(err);
+        }
+
+    // Client must set these before querying!
+    iG711DecodeMode = TMS_G711_CODEC_MODE_ALAW;
+    iILBCDecodeMode = TMS_ILBC_CODEC_MODE_20MS_FRAME;
+
+#ifdef __PLAY_WAV_FROM_FILE__
+    iReadSize = KVoIPPCM16FrameLen;
+    err = iFs.Connect();
+    if (err == KErrNone)
+        {
+        err = iFile.Open(iFs, KTestFile1, EFileShareAny | EFileRead);
+        }
+    if (err == KErrNone)
+        {
+        iFile.Size(fsize);
+        }
+    fbuf = HBufC8::NewL(fsize);
+    TPtr8 p = fbuf->Des();
+    iFile.Read(p, fsize);
+    iFile.Close();
+#endif
+    //    CalcLatency();
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::Start
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::Start()
+    {
+    TRACE_PRN_FN_ENT;
+
+    gst_play_raw();
+    iStatus = EStreaming;
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::Stop
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::Stop()
+    {
+    TRACE_PRN_FN_ENT;
+
+    if (iStatus == EStreaming)
+        {
+        if (iPipelinePlay != NULL &&
+            iPipelinePlay->current_state == GST_STATE_PLAYING)
+            {
+            gst_element_set_state(iPipelinePlay, GST_STATE_NULL);
+            }
+
+        iStatus = EReady;
+        }
+
+    if (gstDnlBuffer)
+        {
+        gst_buffer_unref(gstDnlBuffer);
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::BufferToBeFilled
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::BufferToBeFilled()
+    {
+    TRACE_PRN_N1(_L("TMS->DNL->BTBF: requestBufLen[%d]"), requestBufLen);
+
+#ifndef __PLAY_WAV_FROM_FILE__
+    // Create or adjust the chunk
+    TInt err = DoChunk(requestBufLen, iMsgBuffer);
+
+    if (err != TMS_RESULT_SUCCESS)
+        {
+        Stop();
+        iMsgBuffer.iStatus = err;
+        }
+    else
+        {
+        // Notify client there is buffer ready to be filled
+        iMsgBuffer.iStatus = iChunk.Handle();
+        iMsgBuffer.iInt = requestBufLen;
+        iStatus = EStreaming;
+        // If chunk is opened, we will expect a call from the client to
+        // get chunk handle. When we get a call to copy chunk handle,
+        // check these variables and see if they match. This is not
+        // completely secure, but will provide some level of security
+        if (iMsgBuffer.iBool == TRUE)
+            {
+            iWriteDataXferHndlToClient = TRUE;
+            iKey = iMsgBuffer.iUint32;
+            }
+        }
+
+    iMsgBuffer.iRequest = ECmdFillBuffer;
+    iMsgQueue.Send(iMsgBuffer);
+
+#else //__PLAY_WAV_FROM_FILE__
+    TInt err = KErrNone;
+    BufferFilled();
+#endif //__PLAY_WAV_FROM_FILE__
+    TRACE_PRN_IF_ERR(err);
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::BufferFilled
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::BufferFilled(const guint buflen)
+    {
+#ifndef __PLAY_WAV_FROM_FILE__
+    gstDnlBuffer = gst_buffer_new();
+    gst_buffer_set_caps(gstDnlBuffer, caps);
+    GST_BUFFER_SIZE(gstDnlBuffer) = buflen;
+
+    //TODO: what if bufLen > requestBufLen?
+
+    // IMPL#1:
+    // gstDnlBuffer->data pointer is set to use chunk pointer.
+    // Although unlikely in the pull mode, this may potentially result
+    // in data loss if chunk gets overwritten before it is consumed.
+    gst_buffer_set_data(gstDnlBuffer, iChunk.Base(), buflen);
+
+    // IMPL#2
+    // Alternative implementation with new buffer alloc and memcpy.
+    // GStreamer will free this memory when buffer refcount becomes 0.
+    //guint8* ptr = (guint8*)g_malloc(buflen);
+    //GST_BUFFER_MALLOCDATA(gstDnlBuffer) = GST_BUFFER_DATA(gstDnlBuffer) = ptr;
+    //memcpy(ptr, iChunk.Base(), buflen);
+
+#else //__PLAY_WAV_FROM_FILE__
+    User::After(TTimeIntervalMicroSeconds32(150000));
+
+    TPtr8 p = fbuf->Des();
+    TInt buflen = iReadSize;
+    gstDnlBuffer = gst_buffer_new_and_alloc(buflen);
+    gst_buffer_set_caps(gstDnlBuffer, caps);
+    unsigned char* ptr = (unsigned char*)((fbuf->Ptr())+iReadBytes);
+    gst_buffer_set_data(gstDnlBuffer, ptr, buflen);
+
+    if ((iReadBytes + iReadSize> fsize))
+        {
+        // start over from the beginning
+        iReadBytes = 0;
+        }
+    else
+        {
+        iReadBytes += iReadSize;
+        }
+
+#endif //__PLAY_WAV_FROM_FILE__
+    gst_app_src_push_buffer(GST_APP_SRC(iAppSrc), gstDnlBuffer);
+    TRACE_PRN_N1(_L("TMS->DNL->BF: LEN[%d]"), buflen);
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetCodecCi
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetCodecCi()
+    {
+    TRAPD(err, SetCodecCiL());
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetCodecCiL
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::SetCodecCiL()
+    {
+    TRACE_PRN_FN_ENT;
+
+    switch (iCodecID)
+        {
+        case KMccFourCCIdG711:
+            {
+            if (!iG711DecoderIntfc)
+                {
+                iG711DecoderIntfc = GST_G711_DECODER_GET_IFACE(iSink);
+                }
+            break;
+            }
+        case KMccFourCCIdG729:
+            {
+            if (!iG729DecoderIntfc)
+                {
+                iG729DecoderIntfc = GST_G729_DECODER_GET_IFACE(iSink);
+                }
+            break;
+            }
+        case KMccFourCCIdILBC:
+            {
+            if (!iIlbcDecoderIntfc)
+                {
+                iIlbcDecoderIntfc = GST_ILBC_DECODER_GET_IFACE(iSink);
+                }
+            break;
+            }
+        case KMccFourCCIdAMRNB:
+        case KMMFFourCCCodePCM16:
+            {
+            break;
+            }
+        default:
+            {
+            User::Leave(TMS_RESULT_INVALID_ARGUMENT);
+            }
+        }
+
+    if (iCodecID == KMccFourCCIdG711 ||
+        iCodecID == KMccFourCCIdG729 ||
+        iCodecID == KMccFourCCIdILBC ||
+        iCodecID == KMccFourCCIdAMRNB)
+        {
+        if (!iErrConcealmentIntfc)
+            {
+            iErrConcealmentIntfc = GST_ERROR_CONCEALMENT_GET_IFACE(iSink);
+            }
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetVolume(const guint volume)
+    {
+    g_object_set(G_OBJECT(iSink), "volume", volume, NULL);
+    TRACE_PRN_N1(_L("TMS->DNL: SetVolume [%d]"), volume);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetVolume(guint& volume)
+    {
+    g_object_get(G_OBJECT(iSink), "volume", &volume, NULL);
+    TRACE_PRN_N1(_L("TMS->DNL: GetVolume [%d]"), volume);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetMaxVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetMaxVolume(guint& volume)
+    {
+    g_object_get(G_OBJECT(iSink), "maxvolume", &volume, NULL);
+    TRACE_PRN_N1(_L("TMS->DNL: MaxVolume [%d]"), volume);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetDataXferChunkHndl
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetDataXferChunkHndl(const TUint32 key, RChunk& chunk)
+    {
+    gint status = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iChunk.Handle())
+        {
+        if (iWriteDataXferHndlToClient && (iKey == key))
+            {
+            chunk = iChunk;
+            iWriteDataXferHndlToClient = FALSE;
+            iKey = 0;
+            status = TMS_RESULT_SUCCESS;
+            }
+        else
+            {
+            status = TMS_RESULT_ILLEGAL_OPERATION;
+            }
+        }
+
+    TRACE_PRN_IF_ERR(status);
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetIlbcCodecMode(gint mode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iILBCDecodeMode = mode;
+
+        if (iIlbcDecoderIntfc && iCodecID == KMccFourCCIdILBC)
+            {
+            if (mode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
+                {
+                err = iIlbcDecoderIntfc->SetDecoderMode(E20msFrame);
+                TRACE_PRN_N(_L("TMS->DNL: iLBC Mode Set [20ms]"));
+                }
+            else if (mode == TMS_ILBC_CODEC_MODE_30MS_FRAME)
+                {
+                err = iIlbcDecoderIntfc->SetDecoderMode(E30msFrame);
+                TRACE_PRN_N(_L("TMS->DNL: iLBC Mode Set [30ms]"));
+                }
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetIlbcCodecMode(gint& mode)
+    {
+    // not available through CIs -> return cashed value
+    mode = iILBCDecodeMode;
+    TRACE_PRN_N1(_L("TMS->DNL: GetIlbcCodecMode [%d]"), mode);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetG711CodecMode(gint mode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iG711DecodeMode = mode;
+
+        if (iG711DecoderIntfc && iCodecID == KMccFourCCIdG711)
+            {
+            if (mode == TMS_G711_CODEC_MODE_ALAW)
+                {
+                err = iG711DecoderIntfc->SetDecoderMode(EDecALaw);
+                TRACE_PRN_N(_L("TMS->DNL: G711 Mode Set [ALaw]"));
+                }
+            else if (mode == TMS_G711_CODEC_MODE_MULAW)
+                {
+                err = iG711DecoderIntfc->SetDecoderMode(EDecULaw);
+                TRACE_PRN_N(_L("TMS->DNL: G711 Mode Set [uLaw]"));
+                }
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetG711CodecMode(gint& mode)
+    {
+    // not available through CIs -> return cached value
+    mode = iG711DecodeMode;
+    TRACE_PRN_N1(_L("TMS->DNL: GetG711CodecMode [%d]"), mode);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::FrameModeRqrdForEC
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::FrameModeRqrdForEC(gboolean& frmodereq)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        if (iErrConcealmentIntfc)
+            {
+            err = iErrConcealmentIntfc->FrameModeRqrdForEC(&frmodereq);
+            TRACE_PRN_N1(_L("TMS->DNL: FrameModeRqrdForEC [%d]"), frmodereq);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetFrameMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetFrameMode(const gboolean frmode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iFrameMode = frmode;
+
+        if (iErrConcealmentIntfc)
+            {
+            err = iErrConcealmentIntfc->SetFrameMode(frmode);
+            TRACE_PRN_N1(_L("TMS->DNL: SetFrameMode [%d]"), frmode);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetFrameMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetFrameMode(gboolean& frmode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iErrConcealmentIntfc)
+        {
+        // not available through CIs -> return cached value
+        frmode = iFrameMode;
+        TRACE_PRN_N1(_L("TMS->DNL: GetFrameMode [%d]"), frmode);
+        err = TMS_RESULT_SUCCESS;
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::ConcealErrorForNextBuffer
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::ConcealErrorForNextBuffer()
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iErrConcealmentIntfc)
+        {
+        err = iErrConcealmentIntfc->ConcealErrorForNextBuffer();
+        TRACE_PRN_N(_L("TMS->DNL: ConcealErrorForNextBuffer"));
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetCng
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetCng(const TMSFormatType fmttype, const gboolean cng)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
+            {
+            err = iG711DecoderIntfc->SetCng(cng);
+            TRACE_PRN_N1(_L("TMS->DNL: SetCng [%d]"), cng);
+            }
+        else if (fmttype == TMS_FORMAT_ILBC && iIlbcDecoderIntfc)
+            {
+            err = iIlbcDecoderIntfc->SetCng(cng);
+            TRACE_PRN_N1(_L("TMS->DNL: SetCng [%d]"), cng);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetCng
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetCng(const TMSFormatType fmttype, gboolean& cng)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
+            {
+            err = iG711DecoderIntfc->GetCng(&cng);
+            TRACE_PRN_N1(_L("TMS->DNL: GetCng [%d]"), cng);
+            }
+        else if (fmttype == TMS_FORMAT_ILBC && iIlbcDecoderIntfc)
+            {
+            err = iIlbcDecoderIntfc->GetCng(&cng);
+            TRACE_PRN_N1(_L("TMS->DNL: GetCng [%d]"), cng);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetPlc
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetPlc(const TMSFormatType fmttype, const gboolean plc)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
+            {
+            iPlc = plc;
+            err = iG711DecoderIntfc->SetPlc(iPlc);
+            TRACE_PRN_N1(_L("TMS->DNL: SetPlc [%d]"), plc);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetPlc
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetPlc(const TMSFormatType fmttype, gboolean& plc)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
+        {
+        // not available through CIs -> return cached value
+        plc = iPlc;
+        err = TMS_RESULT_SUCCESS;
+        TRACE_PRN_N1(_L("TMS->DNL: GetPlc [%d]"), plc);
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::BadLsfNextBuffer
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::BadLsfNextBuffer()
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EStreaming)
+        {
+        if (iCodecID == KMccFourCCIdG729 && iG729DecoderIntfc)
+            {
+            err = iG729DecoderIntfc->BadLsfNextBuffer();
+            TRACE_PRN_N(_L("TMS->DNL: BadLsfNextBuffer"));
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetAudioDeviceL
+//
+// -----------------------------------------------------------------------------
+void TMSIPDownlink::SetAudioDeviceL(TMSAudioOutput output)
+    {
+    gint outputDev;
+
+    // ENoPreference=0, EAll=1, ENoOutput=2, EPrivate=3, EPublic=4
+    switch (output)
+        {
+        case TMS_AUDIO_OUTPUT_PRIVATE:
+        case TMS_AUDIO_OUTPUT_HANDSET:
+            outputDev = (gint)CAudioOutput::EPrivate;
+            break;
+        case TMS_AUDIO_OUTPUT_PUBLIC:
+        case TMS_AUDIO_OUTPUT_LOUDSPEAKER:
+            outputDev = (gint)CAudioOutput::EPublic;
+            break;
+        default: // Use default device routing
+            outputDev = (gint)CAudioOutput::ENoPreference;
+            break;
+        }
+
+    g_object_set(G_OBJECT(iSink), "outputdevice", outputDev, NULL);
+    TRACE_PRN_N1(_L("TMS->DNL: SetAudioDeviceL [%d]"), outputDev);
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetAudioDeviceL
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::GetAudioDeviceL(TMSAudioOutput& output)
+    {
+    TRACE_PRN_FN_ENT;
+
+    gint outputDev;
+    g_object_get(G_OBJECT(iSink), "outputdevice", &outputDev, NULL);
+    TRACE_PRN_N1(_L("TMS->DNL: GetAudioDevice [%d]"), outputDev);
+
+    switch (outputDev)
+        {
+        case CAudioOutput::ENoPreference:
+        case CAudioOutput::EAll:
+        case CAudioOutput::ENoOutput:
+        case CAudioOutput::EPrivate:
+            output = TMS_AUDIO_OUTPUT_PRIVATE;
+            break;
+        case CAudioOutput::EPublic:
+            output = TMS_AUDIO_OUTPUT_PUBLIC;
+            break;
+        default:
+            output = TMS_AUDIO_OUTPUT_PRIVATE;
+            break;
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmsipcalldownlinkds.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,815 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <AudioPreference.h>
+#include <AudioOutput.h>
+#include <mmcccodecinformation.h>
+#include <IlbcDecoderIntfc.h>
+#include <G711DecoderIntfc.h>
+#include <G729DecoderIntfc.h>
+#include <ErrorConcealmentIntfc.h>
+#include "tmsutility.h"
+#include "tmsipcallstream.h"
+
+using namespace TMS;
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::TMSIPDownlink
+// Standard Constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPDownlink::TMSIPDownlink()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::~TMSIPDownlink
+// Standard Constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPDownlink::~TMSIPDownlink()
+    {
+    TRACE_PRN_FN_ENT;
+
+    Stop();
+
+    delete iAudioOutput;
+    delete iErrConcealmentIntfc;
+    delete iG711DecoderIntfc;
+    delete iG729DecoderIntfc;
+    delete iIlbcDecoderIntfc;
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::NewL
+// Symbian two-phase constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPDownlink* TMSIPDownlink::NewL(const guint32 codecID,
+        const TMMFPrioritySettings priority)
+    {
+    TMSIPDownlink* self = new (ELeave) TMSIPDownlink();
+    CleanupStack::PushL(self);
+    self->ConstructL(codecID, priority);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::ConstructL
+// Part two of Symbian two phase construction
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::ConstructL(const guint32 codecID,
+        const TMMFPrioritySettings priority)
+    {
+    TRACE_PRN_FN_ENT;
+
+    iCodecID = codecID;
+    iPriority = priority;
+
+    // Client must set these before querying!
+    iG711DecodeMode = TMS_G711_CODEC_MODE_ALAW;
+    iILBCDecodeMode = TMS_ILBC_CODEC_MODE_20MS_FRAME;
+
+    TRAPD(err, InitDevSoundL(EMMFStatePlaying, priority));
+    if (err != TMS_RESULT_SUCCESS)
+        {
+        User::Leave(err);
+        }
+
+    iMaxBufLen = ConfigureMedia(iCodecID);
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::Start
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::Start()
+    {
+    TRACE_PRN_FN_ENT;
+
+    gint err = TMS_RESULT_ILLEGAL_OPERATION;
+
+    if (iStatus == EReady && iDevSound)
+        {
+        TRAP(err, iDevSound->PlayInitL());
+        TRACE_PRN_IF_ERR(err);
+
+#ifdef _DEBUG
+        iSamplesPlayedCount = 0;
+#endif
+        if (err != TMS_RESULT_SUCCESS)
+            {
+            iStatus = EReady;
+            }
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::Stop
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::Stop()
+    {
+    TRACE_PRN_FN_ENT;
+
+    if (iStatus == EStreaming && iDevSound)
+        {
+        iDevSound->Stop();
+        iStatus = EReady;
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::BufferToBeFilled
+// A reference to the buffer delivered from the DevSound is stored locally
+// for later use. It will be filled with the data passed from the client
+// when it calls BufferFilled.
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::BufferToBeFilled(CMMFBuffer* aBuffer)
+    {
+    // Store pointer to the received buffer
+    iDevSoundBufPtr = static_cast<CMMFDataBuffer*>(aBuffer);
+    iBufLen = iDevSoundBufPtr->RequestSize();
+    TRACE_PRN_N1(_L("TMS->DNL->BTBF: LEN[%d]"), iBufLen);
+
+#ifndef __WINSCW__
+    //TODO: revisit this!
+    // The first AMR buffer returns 1 for no data frame.
+    /*if (iCodecID == KMccFourCCIdAMRNB)
+     {
+     iBufLen = iMaxBufLen;
+     }*/
+#endif //__WINSCW__
+    // Create or adjust the chunk
+    gint err = DoChunk(iBufLen, iMsgBuffer);
+
+    if (err != TMS_RESULT_SUCCESS)
+        {
+        Stop();
+        iMsgBuffer.iStatus = err;
+        }
+    else
+        {
+        // Notify client there is buffer ready to be filled
+        iMsgBuffer.iStatus = err;
+        iMsgBuffer.iInt = iBufLen;
+        iStatus = EStreaming;
+        // If chunk is opened, we will expect a call from the client to
+        // get chunk handle. When we get a call to copy chunk handle,
+        // check these variables and see if they match. This is not
+        // completely secure, but will provide some level of security
+        if (iMsgBuffer.iBool == TRUE)
+            {
+            iWriteDataXferHndlToClient = TRUE;
+            iKey = iMsgBuffer.iUint32;
+            }
+        }
+
+    iMsgBuffer.iRequest = ECmdFillBuffer;
+    err = iMsgQueue.Send(iMsgBuffer);
+
+    TRACE_PRN_IF_ERR(err);
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::BufferFilled
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::BufferFilled(const guint buflen)
+    {
+    TRACE_PRN_N1(_L("TMS->DNL->BF: LEN[%d]"), buflen);
+
+    // Copy data over from chunk
+    TPtr8 dataPtr(iChunk.Base(), buflen, iMaxBufLen);
+    //    RDebug::RawPrint(dataPtr);
+
+    if (iStatus == EStreaming && iDevSound && iDevSoundBufPtr)
+        {
+        // Fill D/S buffer and send it for playback
+        iDevSoundBufPtr->Data() = dataPtr;
+        TRAP_IGNORE(iDevSoundBufPtr->SetRequestSizeL(buflen));
+        //try playing anyway
+        iDevSound->PlayData();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetCodecCi
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetCodecCi()
+    {
+    TRAPD(err, SetCodecCiL());
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetCodecCiL
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::SetCodecCiL()
+    {
+    TRACE_PRN_FN_ENT;
+
+    switch (iCodecID)
+        {
+        case KMccFourCCIdG711:
+            {
+            if (!iG711DecoderIntfc)
+                {
+                iG711DecoderIntfc = CG711DecoderIntfc::NewL(*iDevSound);
+                }
+            break;
+            }
+        case KMccFourCCIdG729:
+            {
+            if (!iG729DecoderIntfc)
+                {
+                iG729DecoderIntfc = CG729DecoderIntfc::NewL(*iDevSound);
+                }
+            break;
+            }
+        case KMccFourCCIdILBC:
+            {
+            if (!iIlbcDecoderIntfc)
+                {
+                iIlbcDecoderIntfc = CIlbcDecoderIntfc::NewL(*iDevSound);
+                }
+            break;
+            }
+        case KMccFourCCIdAMRNB:
+        case KMMFFourCCCodePCM16:
+            {
+            break;
+            }
+        default:
+            {
+            User::Leave(TMS_RESULT_INVALID_ARGUMENT);
+            break;
+            }
+        }
+
+    if (!iErrConcealmentIntfc && iCodecID != KMMFFourCCCodePCM16)
+        {
+        iErrConcealmentIntfc = CErrorConcealmentIntfc::NewL(*iDevSound);
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetVolume(const guint volume)
+    {
+    gint ret(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iDevSound)
+        {
+        iDevSound->SetVolume(volume);
+        ret = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_N1(_L("TMS->DNL: SetVolume [%d]"), volume);
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetVolume(guint& volume)
+    {
+    gint ret(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iDevSound)
+        {
+        volume = iDevSound->Volume();
+        ret = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_N1(_L("TMS->DNL: GetVolume [%d]"), volume);
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetMaxVolume
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetMaxVolume(guint& volume)
+    {
+    gint ret(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iDevSound)
+        {
+        volume = iDevSound->MaxVolume();
+        ret = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_N1(_L("TMS->DNL: MaxVolume [%d]"), volume);
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetDataXferChunkHndl
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetDataXferChunkHndl(const TUint32 key, RChunk& chunk)
+    {
+    gint status = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iChunk.Handle())
+        {
+        if (iWriteDataXferHndlToClient && (iKey == key))
+            {
+            chunk = iChunk;
+            iWriteDataXferHndlToClient = FALSE;
+            iKey = 0;
+            status = TMS_RESULT_SUCCESS;
+            }
+        else
+            {
+            status = TMS_RESULT_ILLEGAL_OPERATION;
+            }
+        }
+
+    TRACE_PRN_IF_ERR(status);
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetIlbcCodecMode(gint mode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iILBCDecodeMode = mode;
+
+        if (iIlbcDecoderIntfc && iCodecID == KMccFourCCIdILBC)
+            {
+            if (mode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
+                {
+                err = iIlbcDecoderIntfc->SetDecoderMode(
+                        CIlbcDecoderIntfc::E20msFrame);
+                TRACE_PRN_N(_L("TMS->DNL: iLBC Mode Set [20ms]"));
+                }
+            else if (mode == TMS_ILBC_CODEC_MODE_30MS_FRAME)
+                {
+                err = iIlbcDecoderIntfc->SetDecoderMode(
+                        CIlbcDecoderIntfc::E30msFrame);
+                TRACE_PRN_N(_L("TMS->DNL: iLBC Mode Set [30ms]"));
+                }
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetIlbcCodecMode(gint& mode)
+    {
+    // not available through CIs -> return cashed value
+    mode = iILBCDecodeMode;
+    TRACE_PRN_N1(_L("TMS->DNL: GetIlbcCodecMode [%d]"), mode);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetG711CodecMode(gint mode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iG711DecodeMode = mode;
+
+        if (iG711DecoderIntfc && iCodecID == KMccFourCCIdG711)
+            {
+            if (mode == TMS_G711_CODEC_MODE_ALAW)
+                {
+                err = iG711DecoderIntfc->SetDecoderMode(
+                        CG711DecoderIntfc::EDecALaw);
+                TRACE_PRN_N(_L("TMS->DNL: G711 Mode Set [ALaw]"));
+                }
+            else if (mode == TMS_G711_CODEC_MODE_MULAW)
+                {
+                err = iG711DecoderIntfc->SetDecoderMode(
+                        CG711DecoderIntfc::EDecULaw);
+                TRACE_PRN_N(_L("TMS->DNL: G711 Mode Set [uLaw]"));
+                }
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetG711CodecMode(gint& mode)
+    {
+    // not available through CIs -> return cached value
+    mode = iG711DecodeMode;
+    TRACE_PRN_N1(_L("TMS->DNL: GetG711CodecMode [%d]"), mode);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::FrameModeRqrdForEC
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::FrameModeRqrdForEC(gboolean& frmodereq)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        if (iErrConcealmentIntfc)
+            {
+            err = iErrConcealmentIntfc->FrameModeRqrdForEC(frmodereq);
+            TRACE_PRN_N1(_L("TMS->DNL: FrameModeRqrdForEC [%d]"), frmodereq);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetFrameMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetFrameMode(const gboolean frmode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iFrameMode = frmode;
+
+        if (iErrConcealmentIntfc)
+            {
+            err = iErrConcealmentIntfc->SetFrameMode(frmode);
+            TRACE_PRN_N1(_L("TMS->DNL: SetFrameMode [%d]"), frmode);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetFrameMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetFrameMode(gboolean& frmode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iErrConcealmentIntfc)
+        {
+        // not available through CIs -> return cached value
+        frmode = iFrameMode;
+        TRACE_PRN_N1(_L("TMS->DNL: GetFrameMode [%d]"), frmode);
+        err = TMS_RESULT_SUCCESS;
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::ConcealErrorForNextBuffer
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::ConcealErrorForNextBuffer()
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iErrConcealmentIntfc)
+        {
+        err = iErrConcealmentIntfc->ConcealErrorForNextBuffer();
+        TRACE_PRN_N(_L("TMS->DNL: ConcealErrorForNextBuffer"));
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetCng
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetCng(const TMSFormatType fmttype, const gboolean cng)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
+            {
+            err = iG711DecoderIntfc->SetCng(cng);
+            TRACE_PRN_N1(_L("TMS->DNL: SetCng [%d]"), cng);
+            }
+        else if (fmttype == TMS_FORMAT_ILBC && iIlbcDecoderIntfc)
+            {
+            err = iIlbcDecoderIntfc->SetCng(cng);
+            TRACE_PRN_N1(_L("TMS->DNL: SetCng [%d]"), cng);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetCng
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetCng(const TMSFormatType fmttype, gboolean& cng)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
+            {
+            err = iG711DecoderIntfc->GetCng(cng);
+            TRACE_PRN_N1(_L("TMS->DNL: GetCng [%d]"), cng);
+            }
+        else if (fmttype == TMS_FORMAT_ILBC && iIlbcDecoderIntfc)
+            {
+            err = iIlbcDecoderIntfc->GetCng(cng);
+            TRACE_PRN_N1(_L("TMS->DNL: GetCng [%d]"), cng);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetPlc
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::SetPlc(const TMSFormatType fmttype, const gboolean plc)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
+            {
+            iPlc = plc;
+            err = iG711DecoderIntfc->SetPlc(iPlc);
+            TRACE_PRN_N1(_L("TMS->DNL: SetPlc [%d]"), plc);
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetPlc
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::GetPlc(const TMSFormatType fmttype, gboolean& plc)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (fmttype == TMS_FORMAT_G711 && iG711DecoderIntfc)
+        {
+        // not available through CIs -> return cached value
+        plc = iPlc;
+        err = TMS_RESULT_SUCCESS;
+        TRACE_PRN_N1(_L("TMS->DNL: GetPlc [%d]"), plc);
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::BadLsfNextBuffer
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPDownlink::BadLsfNextBuffer()
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EStreaming)
+        {
+        if (iCodecID == KMccFourCCIdG729 && iG729DecoderIntfc)
+            {
+            err = iG729DecoderIntfc->BadLsfNextBuffer();
+            TRACE_PRN_N(_L("TMS->DNL: BadLsfNextBuffer"));
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::SetAudioDeviceL
+//
+// -----------------------------------------------------------------------------
+void TMSIPDownlink::SetAudioDeviceL(TMSAudioOutput output)
+    {
+    TRACE_PRN_FN_ENT;
+
+    if (!iAudioOutput)
+        {
+        iAudioOutput = CAudioOutput::NewL(*iDevSound);
+        }
+
+    if (iAudioOutput)
+        {
+        // ENoPreference=0, EAll=1, ENoOutput=2, EPrivate=3, EPublic=4
+        CAudioOutput::TAudioOutputPreference outputDev;
+
+        switch (output)
+            {
+            case TMS_AUDIO_OUTPUT_PRIVATE:
+            case TMS_AUDIO_OUTPUT_HANDSET:
+                outputDev = CAudioOutput::EPrivate;
+                break;
+            case TMS_AUDIO_OUTPUT_PUBLIC:
+            case TMS_AUDIO_OUTPUT_LOUDSPEAKER:
+                outputDev = CAudioOutput::EPublic;
+                break;
+            default: // Use default device routing
+                outputDev = CAudioOutput::ENoPreference;
+                break;
+            }
+
+        iAudioOutput->SetAudioOutputL(outputDev);
+        TRACE_PRN_N1(_L("TMS->DNL: SetAudioDeviceL [%d]"), outputDev);
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::GetAudioDeviceL
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::GetAudioDeviceL(TMSAudioOutput& output)
+    {
+    TRACE_PRN_FN_ENT;
+
+    if (!iAudioOutput)
+        {
+        iAudioOutput = CAudioOutput::NewL(*iDevSound);
+        }
+
+    if (iAudioOutput)
+        {
+        CAudioOutput::TAudioOutputPreference outputDev =
+                iAudioOutput->AudioOutput();
+
+        switch (outputDev)
+            {
+            case CAudioOutput::ENoPreference:
+            case CAudioOutput::EAll:
+            case CAudioOutput::ENoOutput:
+            case CAudioOutput::EPrivate:
+                output = TMS_AUDIO_OUTPUT_PRIVATE;
+                break;
+            case CAudioOutput::EPublic:
+                output = TMS_AUDIO_OUTPUT_PUBLIC;
+                break;
+            default:
+                output = TMS_AUDIO_OUTPUT_PRIVATE;
+                break;
+            }
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// CALLBACKS
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::InitializeComplete
+// A callback from the DevSound indicating completion of the initialization.
+// It will send config data to the D/S and configure the encoder via CI.
+// If everything goes well, the state of the thread is set EReady.
+// The initialization completion message is sent back to the main thread.
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::InitializeComplete(TInt aError)
+    {
+    TRACE_PRN_FN_ENT;
+
+    gint err = aError;
+
+    if (err == TMS_RESULT_SUCCESS && iDevSound)
+        {
+        TMMFCapabilities conf;
+        conf = iDevSound->Config();
+        conf.iRate = EMMFSampleRate8000Hz;
+        conf.iChannels = EMMFMono;
+        TRAP(err, iDevSound->SetConfigL(conf));
+        if (err == TMS_RESULT_SUCCESS)
+            {
+            // We are ready to stream even in case of later CI setting failure
+            iStatus = EReady;
+            iMaxVolume = iDevSound->MaxVolume();
+            }
+
+        // Init Custom Interface API to the decoder
+        err = SetCodecCi();
+        if (err != TMS_RESULT_SUCCESS)
+            {
+            // DEBUG only
+            // Can ignore error - although decoder is not fully configured but
+            // it can still run in the default mode.
+            TRACE_PRN_IF_ERR(err);
+            }
+        }
+
+    // TODO: Notify client
+
+    TRACE_PRN_IF_ERR(err);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPDownlink::PlayError
+// From MDevSoundObserver
+// Record error is send to client over comm channel.
+// The state of recorder is rolled back to EReady.
+// -----------------------------------------------------------------------------
+//
+void TMSIPDownlink::PlayError(TInt /*aError*/)
+    {
+    //TRACE_PRN_IF_ERR(aError);
+
+#ifdef _DEBUG
+    iSamplesPlayedCount = 0;
+#endif
+    iStatus = EReady;
+
+    // TODO: Notify client
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmsipcallstreambase.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,174 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <e32math.h>
+#include <mmcccodecinformation.h>
+#include "tmsutility.h"
+#include "tmsshared.h"
+#include "tmsipcallstream.h"
+
+using namespace TMS;
+
+// -----------------------------------------------------------------------------
+// TMSIPCallStreamBase::~TMSIPCallStreamBase
+// Destructor
+// -----------------------------------------------------------------------------
+//
+TMSIPCallStreamBase::~TMSIPCallStreamBase()
+    {
+    TRACE_PRN_FN_ENT;
+
+    if (iChunk.Handle() > 0)
+        {
+        iChunk.Close();
+        }
+
+#ifndef __USE_GSTREAMER__
+    delete iDevSound;
+#endif //__USE_GSTREAMER__
+    TRACE_PRN_FN_EXT;
+    }
+
+#ifndef __USE_GSTREAMER__
+// -----------------------------------------------------------------------------
+// TMSIPCallStreamBase::InitDevSoundL
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPCallStreamBase::InitDevSoundL(const TMMFState aDevSoundState,
+        const TMMFPrioritySettings priority)
+    {
+    TRACE_PRN_FN_ENT;
+
+    if (!iDevSound)
+        {
+        // Create D/S recording/playing device
+        iDevSound = CMMFDevSound::NewL();
+        }
+
+    if (iDevSound)
+        {
+        iDevSound->InitializeL(*this, TFourCC(iCodecID), aDevSoundState);
+        iDevSound->SetPrioritySettings(priority);
+        }
+    }
+#endif //__USE_GSTREAMER__
+
+// -----------------------------------------------------------------------------
+// TMSIPCallStreamBase::SetMsgQueue
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPCallStreamBase::SetMsgQueue(const RMsgQueue<TmsMsgBuf> aMsgQueue)
+    {
+    iMsgQueue = aMsgQueue;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPCallStreamBase::ConfigureMedia
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPCallStreamBase::ConfigureMedia(const guint32 aCodecID)
+    {
+    gint framelen = 0;
+
+    switch (aCodecID)
+        {
+        case KMccFourCCIdG711:
+            iMediaType = "audio/x-alaw";
+            // iMediaType = "audio/x-mulaw";
+            framelen = KTMSG711FrameLen10ms; //TODO: may be H/W specific!
+            //framelen = KTMSG711FrameLen20ms;
+            break;
+        case KMccFourCCIdG729:
+            iMediaType = "audio/g729";
+            framelen = KTMSG729FrameLen;
+            break;
+        case KMccFourCCIdILBC:
+            iMediaType = "audio/ilbc";
+            framelen = KTMSILBCFrameLen20ms;
+            //framelen = KTMSILBCFrameLen30ms;
+            break;
+        case KMccFourCCIdAMRNB:
+            iMediaType = "audio/amr";
+            framelen = KTMSAMRNBFrameLen;
+            //framelen = KTMSAMRNBFrameLenFM;
+            break;
+        case KMMFFourCCCodePCM16:
+        default:
+            iMediaType = "audio/x-raw-int";
+            framelen = KTMSPCM16FrameLen;
+#ifdef __WINSCW__
+            framelen *= 4; //16kB
+#endif
+            break;
+        }
+
+    //TODO: DEVLON TEST
+    if (iCodecID != KMMFFourCCCodePCM16)
+        {
+        framelen *= 10;
+        }
+    //TODO: DEVLON TEST
+
+    return framelen;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPCallStreamBase::DoChunk
+// Checks, adjusts and creates global RChunk.
+// -----------------------------------------------------------------------------
+//
+gint TMSIPCallStreamBase::DoChunk(const gint aDataLen, TmsMsgBuf& aMsgBuffer)
+    {
+    gint status(KErrNone);
+
+    // If chunk already created, try to reuse it
+    if (iChunk.Handle())
+        {
+        // committed size is smaller but chunk is large enough to hold data
+        if ((iChunk.Size() < aDataLen) && (aDataLen <= iChunk.MaxSize()))
+            {
+            status = iChunk.Adjust(aDataLen);
+            TRACE_PRN_N1(_L("IP_CALL: DoChunk->Chunk Adjusted [%d]"), aDataLen);
+            }
+        else if (aDataLen > iChunk.MaxSize())
+            {
+            iChunk.Close();
+            TRACE_PRN_N(_L("IP_CALL: DoChunk->Chunk Closed"));
+            }
+        }
+    RET_ERR_IF_ERR(status);
+
+    // Request kernel to create global RChunk if needed
+    aMsgBuffer.iBool = FALSE;
+    if (!iChunk.Handle())
+        {
+        // TODO consider using some max instead
+        status = iChunk.CreateGlobal(KNullDesC, aDataLen, aDataLen);
+        // Mark to re-open chunk handle
+        aMsgBuffer.iBool = TRUE;
+        aMsgBuffer.iUint32 = Math::Random();
+        TRACE_PRN_N2(_L("IP_CALL: DoChunk->Chunk Created [%d]key[%d]"),
+                aDataLen, aMsgBuffer.iUint32);
+        }
+    TRACE_PRN_IF_ERR(status);
+    return status;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmsipcalluplink.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,758 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <audiopreference.h>
+#include <mmcccodecinformation.h>
+#include <gstappsink.h>
+#include "tmsutility.h"
+#include "ipcallstream.h"
+
+using namespace TMS;
+
+static TMSIPUplink* iSelfUp;
+GstBuffer* gstUplBuffer;
+#ifdef _DEBUG
+//static TInt iHeapUp;
+#endif //_DEBUG
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::cb_record_raw_handoff
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::cb_record_raw_handoff(GstElement *sink)
+    {
+    TRACE_PRN_N(_L("TMS->UPL: cb_record_raw_handoff Enter"));
+
+#ifdef _DEBUG
+    /*    TInt block;
+     RHeap &heap = User::Heap();
+     TInt avail = heap.Available(block);
+     RDebug::Print(_L("VoIP->PRINT-HEAP-UP:Available:[%d], delta:[%d]"),
+     avail, iHeapUp-avail);
+     iHeapUp = avail;*/
+#endif
+
+    gstUplBuffer = gst_app_sink_pull_buffer(GST_APP_SINK(sink));
+    iSelfUp->BufferToBeEmptied();
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::bus_call
+// -----------------------------------------------------------------------------
+//
+gboolean TMSIPUplink::bus_call(GstBus* /*bus*/, GstMessage* msg,
+        gpointer /*data*/)
+    {
+    switch (GST_MESSAGE_TYPE(msg))
+        {
+        case GST_MESSAGE_EOS:
+            {
+            gst_element_set_state(iSelfUp->iPipelineRec, GST_STATE_NULL);
+            gst_object_unref(GST_OBJECT(iSelfUp->iPipelineRec));
+            break;
+            }
+        case GST_MESSAGE_ERROR:
+            {
+            gchar *debug;
+            GError *err;
+            gst_message_parse_error(msg, &err, &debug);
+            g_free(debug);
+            g_print("Error: %s\n", err->message);
+            g_error_free(err);
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::gst_initialize_record
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::gst_initialize_record()
+    {
+    TRACE_PRN_FN_ENT;
+
+    gint err = KErrNone;
+
+    // create a new bin to hold the elements
+    iPipelineRec = gst_pipeline_new("pipelineRec");
+    iSource = gst_element_factory_make("devsoundsrc", "record_audio");
+    iAppSink = gst_element_factory_make("appsink", "appsink");
+
+    if (!iSource || !iAppSink)
+        {
+        err = KErrNotFound;
+        TRACE_PRN_IF_ERR(err);
+        return err;
+        }
+
+    iMaxBufLen = ConfigureMedia(iCodecID);
+
+    GstCaps* caps = gst_caps_new_simple(iMediaType,
+                                        "width", G_TYPE_INT, 16,
+                                        "depth", G_TYPE_INT, 16,
+                                        "signed", G_TYPE_BOOLEAN, TRUE,
+                                        "endianness", G_TYPE_INT, G_BYTE_ORDER,
+                                        "rate", G_TYPE_INT, 8000,
+                                        "channels", G_TYPE_INT, 1,
+                                        NULL);
+
+    iBusRec = gst_pipeline_get_bus(GST_PIPELINE(iPipelineRec));
+    gst_bus_add_watch(iBusRec, (TMSIPUplink::bus_call), NULL);
+    gst_object_unref(iBusRec);
+
+    // add objects to the main iPipelineRec
+    gst_bin_add_many(GST_BIN(iPipelineRec), iSource, iAppSink, NULL);
+
+    // link the elements
+    gst_element_link_filtered(iSource, iAppSink, caps);
+
+    g_object_set(G_OBJECT(iAppSink),
+                 "max-buffers", 1,
+                 "emit-signals", TRUE,
+                 "sync", FALSE,
+                 NULL);
+
+    g_signal_connect(iAppSink, "new-buffer",
+                     G_CALLBACK(cb_record_raw_handoff),
+                     NULL);
+
+    gst_app_sink_set_caps(GST_APP_SINK(iAppSink), caps);
+    gst_caps_unref(caps);
+
+    //NOTE: d/s is not ready at this time to return true maxgain
+    TInt maxgain = 1;
+#ifdef __WINSCW__
+    maxgain = 64;
+#endif //__WINSCW__
+    g_object_set(G_OBJECT(iSource),
+                 "blocksize", iMaxBufLen,
+                 "gain", maxgain,
+#ifndef __WINSCW__
+                 "priority", (gint)iPriority.iPriority,
+                 "preference", (gint)iPriority.iPref,
+#endif
+                 NULL);
+
+    err = SetCodecCi();
+    //gst_element_set_state(iPipelineRec, GST_STATE_READY);
+
+    TRACE_PRN_FN_EXT;
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::gst_record_raw
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::gst_record_raw()
+    {
+    // start recording
+    gst_element_set_state(iPipelineRec, GST_STATE_PLAYING);
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::TMSIPUplink
+// Standard Constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPUplink::TMSIPUplink()
+    {
+    iSelfUp = this;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::~TMSIPUplink
+// Standard Constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPUplink::~TMSIPUplink()
+    {
+    TRACE_PRN_FN_ENT;
+
+    Stop();
+    gst_object_unref(GST_OBJECT(iPipelineRec));
+    gst_deinit();
+
+    delete iSpeechEncoderConfig;
+    delete iG711EncoderIntfc;
+    delete iG729EncoderIntfc;
+    delete iIlbcEncoderIntfc;
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::NewL
+// Symbian two-phase constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPUplink* TMSIPUplink::NewL(const guint32 codecID,
+        const TMMFPrioritySettings priority)
+    {
+    TMSIPUplink* self = new (ELeave) TMSIPUplink();
+    CleanupStack::PushL(self);
+    self->ConstructL(codecID, priority);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::ConstructL
+// Part two of Symbian two phase construction
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::ConstructL(const guint32 codecID,
+        const TMMFPrioritySettings priority)
+    {
+    TRACE_PRN_FN_ENT;
+
+    iCodecID = codecID;
+    iPriority = priority;
+    //    SetTime();
+    gst_init(NULL, NULL);
+    //    CalcLatency();
+    //    SetTime();
+    gint err = gst_initialize_record();
+    if (err != TMS_RESULT_SUCCESS)
+        {
+        User::Leave(err);
+        }
+
+    // Client must set these before querying!
+    iG711EncodeMode = TMS_G711_CODEC_MODE_ALAW;
+    iILBCEncodeMode = TMS_ILBC_CODEC_MODE_20MS_FRAME;
+    //    CalcLatency();
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::Start
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::Start()
+    {
+    TRACE_PRN_FN_ENT;
+
+    gst_record_raw();
+    iStatus = EStreaming;
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::Stop
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::Stop()
+    {
+    TRACE_PRN_FN_ENT;
+
+    if (iStatus == EStreaming)
+        {
+        if (iPipelineRec != NULL &&
+            iPipelineRec->current_state == GST_STATE_PLAYING)
+            {
+            GstStateChangeReturn ret;
+            ret = gst_element_set_state(iPipelineRec, GST_STATE_NULL);
+            if (ret == GST_STATE_CHANGE_FAILURE)
+                {
+                ;// retry???
+                //GST_STATE_CHANGE_SUCCESS
+                }
+            }
+        iStatus = EReady;
+        }
+
+    if (gstUplBuffer)
+        {
+        gst_buffer_unref(gstUplBuffer);
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::BufferToBeEmptied
+// From MDevSoundObserver
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::BufferToBeEmptied()
+    {
+    TInt buflen = GST_BUFFER_SIZE(gstUplBuffer);
+    TRACE_PRN_N1(_L("TMS->UPL: BTBE->LEN [%d]"), buflen);
+
+    // Adjust/create RChunk if necessary
+    TInt err = DoChunk(buflen, iMsgBuffer);
+
+    if (err != TMS_RESULT_SUCCESS)
+        {
+        Stop();
+        iMsgBuffer.iStatus = err;
+        }
+    else
+        {
+        // Pass buffer parameters to the client
+        iMsgBuffer.iStatus = err;
+        iMsgBuffer.iInt = buflen;
+
+        // Copy data over to RChunk
+        TPtr8 dataPtr(iChunk.Base(), buflen, iMaxBufLen);
+        dataPtr.Copy(GST_BUFFER_DATA(gstUplBuffer), buflen);
+        gst_buffer_unref(gstUplBuffer);
+
+        //RDebug::RawPrint(dataPtr);
+        iStatus = EStreaming;
+
+        // If chunk is opened, we will expect a call from the client to
+        // get chunk handle. When we get a call to copy chunk handle,
+        // check these variables and see if they match. This is not
+        // completely secure, but will provide some level of security.
+        if (iMsgBuffer.iBool == TRUE)
+            {
+            iWriteDataXferHndlToClient = TRUE;
+            iKey = iMsgBuffer.iUint32;
+            }
+        }
+
+    // Notify client there is buffer ready to be emptied
+    iMsgBuffer.iRequest = ECmdEmptyBuffer;
+    err = iMsgQueue.Send(iMsgBuffer);
+    TRACE_PRN_IF_ERR(err);
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::BufferEmptied
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::BufferEmptied()
+    {
+    //TRACE_PRN_N(_L("TMS->UPL->BE"));
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetCodecCi
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetCodecCi()
+    {
+    TRAPD(err, SetCodecCiL());
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetCodecCiL
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::SetCodecCiL()
+    {
+    TRACE_PRN_FN_ENT;
+
+    switch (iCodecID)
+        {
+        case KMccFourCCIdG711:
+            {
+            if (!iG711EncoderIntfc)
+                {
+                iG711EncoderIntfc = GST_G711_ENCODER_GET_IFACE(iSource);
+                }
+            break;
+            }
+        case KMccFourCCIdG729:
+            {
+            if (!iG729EncoderIntfc)
+                {
+                iG729EncoderIntfc = GST_G729_ENCODER_GET_IFACE(iSource);
+                }
+            break;
+            }
+        case KMccFourCCIdILBC:
+            {
+            if (!iIlbcEncoderIntfc)
+                {
+                iIlbcEncoderIntfc = GST_ILBC_ENCODER_GET_IFACE(iSource);
+                }
+            break;
+            }
+        case KMccFourCCIdAMRNB:
+        case KMMFFourCCCodePCM16:
+            {
+            break;
+            }
+        default:
+            {
+            User::Leave(TMS_RESULT_INVALID_ARGUMENT);
+            }
+        }
+
+    if (!iSpeechEncoderConfig && iCodecID != KMMFFourCCCodePCM16)
+        {
+        iSpeechEncoderConfig = GST_SPEECH_ENCODER_CONFIG_GET_IFACE(iSource);
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetGain(const guint gain)
+    {
+    g_object_set(G_OBJECT(iSource), "gain", gain, NULL);
+    TRACE_PRN_N1(_L("TMS->UPL: SetGain [%d]"), gain);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetGain(guint& gain)
+    {
+    g_object_get(G_OBJECT(iSource), "gain", &gain, NULL);
+    TRACE_PRN_N1(_L("TMS->UPL: GetGain [%d]"), gain);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetMaxGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetMaxGain(guint& gain)
+    {
+    g_object_get(G_OBJECT(iSource), "maxgain", &gain, NULL);
+    TRACE_PRN_N1(_L("TMS->UPL: MaxGain [%d]"), gain);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetDataXferChunkHndl
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetDataXferChunkHndl(const TUint32 key, RChunk& chunk)
+    {
+    gint status = TMS_RESULT_SUCCESS;
+
+    if (iChunk.Handle())
+        {
+        if (iWriteDataXferHndlToClient && (iKey == key))
+            {
+            chunk = iChunk;
+            iWriteDataXferHndlToClient = FALSE;
+            iKey = 0;
+            }
+        else
+            {
+            status = TMS_RESULT_ILLEGAL_OPERATION;
+            }
+        }
+
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetIlbcCodecMode(const gint mode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iILBCEncodeMode = mode;
+
+        if (iIlbcEncoderIntfc && iCodecID == KMccFourCCIdILBC)
+            {
+            if (mode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
+                {
+                err = iIlbcEncoderIntfc->SetEncoderMode(EIlbc20msFrame);
+                TRACE_PRN_N(_L("TMS->UPL: SetIlbcCodecMode [20ms Frame]"));
+                }
+            else if (mode == TMS_ILBC_CODEC_MODE_30MS_FRAME)
+                {
+                err = iIlbcEncoderIntfc->SetEncoderMode(EIlbc30msFrame);
+                TRACE_PRN_N(_L("TMS->UPL: SetIlbcCodecMode [30ms Frame]"));
+                }
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetIlbcCodecMode(gint& mode)
+    {
+    // not available through CIs -> return cached value
+    mode = iILBCEncodeMode;
+    TRACE_PRN_N1(_L("TMS->UPL: GetIlbcCodecMode [%d]"), mode);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetG711CodecMode(const gint mode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iG711EncodeMode = mode;
+
+        if (iG711EncoderIntfc && iCodecID == KMccFourCCIdG711)
+            {
+            if (mode == TMS_G711_CODEC_MODE_ALAW)
+                {
+                err = iG711EncoderIntfc->SetEncoderMode(EEncALaw);
+                TRACE_PRN_N(_L("TMS->UPL: SetG711CodecMode [ALaw]"));
+                }
+            else if (mode == TMS_G711_CODEC_MODE_MULAW)
+                {
+                err = iG711EncoderIntfc->SetEncoderMode(EEncULaw);
+                TRACE_PRN_N(_L("TMS->UPL: SetG711CodecMode [uLaw]"));
+                }
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetG711CodecMode(gint& mode)
+    {
+    // not available through CIs -> return cached value
+    mode = iG711EncodeMode;
+    TRACE_PRN_N1(_L("TMS->UPL: GetG711CodecMode [%d]"), mode);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetSupportedBitrates
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetSupportedBitrates(RArray<guint>& bitrates)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+    bitrates.Reset();
+
+    if (iSpeechEncoderConfig)
+        {
+        gint i = 0;
+        GList* gbitrates = NULL;
+        //        GList* walk;
+        err = iSpeechEncoderConfig->GetSupportedBitrates(&gbitrates);
+
+        //TODO: try returning GList and do not convert to RArray
+        for (; gbitrates; gbitrates = g_list_next (gbitrates))
+            {
+            //            guint br = GPOINTER_TO_INT(gbitrates->data);
+            guint br = GPOINTER_TO_UINT(gbitrates->data);
+            bitrates.Append(br);
+            TRACE_PRN_N2(_L("TMS->UPL: GetSupportedBitrates %d:[%d]"), i+1, br);
+            i++;
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetBitrate
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetBitrate(guint bitrate)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iSpeechEncoderConfig)
+        {
+        err = iSpeechEncoderConfig->SetBitrate(bitrate);
+        TRACE_PRN_N1(_L("TMS->UPL: SetBitrate [%d]"), bitrate);
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetBitrate
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetBitrate(guint& bitrate)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iSpeechEncoderConfig)
+        {
+        err = iSpeechEncoderConfig->GetBitrate(&bitrate);
+        TRACE_PRN_N1(_L("TMS->UPL: GetBitrate [%d]"), bitrate);
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetVad
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetVad(const TMSFormatType fmttype, const gboolean vad)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    switch (fmttype)
+        {
+        case TMS_FORMAT_G711:
+            {
+            if (iG711EncoderIntfc)
+                {
+                err = iG711EncoderIntfc->SetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_G729:
+            {
+            if (iG729EncoderIntfc)
+                {
+                err = iG729EncoderIntfc->SetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_ILBC:
+            {
+            if (iIlbcEncoderIntfc)
+                {
+                err = iIlbcEncoderIntfc->SetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_AMR:
+            {
+            if (iSpeechEncoderConfig)
+                {
+                err = iSpeechEncoderConfig->SetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
+                }
+            break;
+            }
+        default:
+            {
+            break; //TMS_RESULT_DOES_NOT_EXIST
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetVad
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetVad(const TMSFormatType fmttype, gboolean& vad)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    switch (fmttype)
+        {
+        case TMS_FORMAT_G711:
+            {
+            if (iG711EncoderIntfc)
+                {
+                err = iG711EncoderIntfc->GetVadMode(&vad);
+                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_G729:
+            {
+            if (iG729EncoderIntfc)
+                {
+                err = iG729EncoderIntfc->GetVadMode(&vad);
+                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_ILBC:
+            {
+            if (iIlbcEncoderIntfc)
+                {
+                err = iIlbcEncoderIntfc->GetVadMode(&vad);
+                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_AMR:
+            {
+            if (iSpeechEncoderConfig)
+                {
+                err = iSpeechEncoderConfig->GetVadMode(&vad);
+                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
+                }
+            break;
+            }
+        default:
+            {
+            break; //TMS_RESULT_DOES_NOT_EXIST
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmsipcalluplinkds.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,690 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+#include <AudioPreference.h>
+#include <mmcccodecinformation.h>
+#include <IlbcEncoderIntfc.h>
+#include <G711EncoderIntfc.h>
+#include <G729EncoderIntfc.h>
+#include <SpeechEncoderConfig.h>
+#include "tmsutility.h"
+#include "tmsipcallstream.h"
+
+using namespace TMS;
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::TMSIPUplink
+// Standard Constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPUplink::TMSIPUplink()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::~TMSIPUplink
+// Standard Constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPUplink::~TMSIPUplink()
+    {
+    TRACE_PRN_FN_ENT;
+
+    Stop();
+
+    delete iSpeechEncoderConfig;
+    delete iG711EncoderIntfc;
+    delete iG729EncoderIntfc;
+    delete iIlbcEncoderIntfc;
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::NewL
+// Symbian two-phase constructor
+// -----------------------------------------------------------------------------
+//
+TMSIPUplink* TMSIPUplink::NewL(const guint32 codecID,
+        const TMMFPrioritySettings priority)
+    {
+    TMSIPUplink* self = new (ELeave) TMSIPUplink();
+    CleanupStack::PushL(self);
+    self->ConstructL(codecID, priority);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::ConstructL
+// Part two of Symbian two phase construction
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::ConstructL(const guint32 codecID,
+        const TMMFPrioritySettings priority)
+    {
+    TRACE_PRN_FN_ENT;
+
+    iCodecID = codecID;
+    iPriority = priority;
+
+    // Client must set these before querying!
+    iG711EncodeMode = TMS_G711_CODEC_MODE_ALAW;
+    iILBCEncodeMode = TMS_ILBC_CODEC_MODE_20MS_FRAME;
+
+    TRAPD(err, InitDevSoundL(EMMFStateRecording, priority));
+    if (err != TMS_RESULT_SUCCESS)
+        {
+        User::Leave(err);
+        }
+
+    iMaxBufLen = ConfigureMedia(iCodecID);
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::Start
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::Start()
+    {
+    TRACE_PRN_FN_ENT;
+
+    gint err = TMS_RESULT_ILLEGAL_OPERATION;
+    iWriteDataXferHndlToClient = FALSE;
+
+    if (iStatus == EReady && iDevSound)
+        {
+        TRAP(err, iDevSound->RecordInitL());
+        TRACE_PRN_IF_ERR(err);
+
+        if (err != TMS_RESULT_SUCCESS)
+            {
+            //TODO: Notify main thread
+            iStatus = EReady;
+            }
+#ifdef _DEBUG
+        else
+            {
+            iSamplesRecCount = 0;
+            }
+#endif
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::Stop
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::Stop()
+    {
+    TRACE_PRN_FN_ENT;
+
+    if (iStatus == EStreaming && iDevSound)
+        {
+        iDevSound->Stop();
+        iStatus = EReady;
+        }
+    else
+        {
+        //TODO: Notify main thread
+        }
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::BufferToBeEmptied
+// From MDevSoundObserver
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::BufferToBeEmptied(CMMFBuffer* aBuffer)
+    {
+    iDevSoundBufPtr = static_cast<CMMFDataBuffer*>(aBuffer);
+    TDes8& data = iDevSoundBufPtr->Data();
+
+    iBufLen = iDevSoundBufPtr->BufferSize();
+    TRACE_PRN_N1(_L("TMS->UPL: BTBE->LEN [%d]"), iBufLen);
+
+    // Adjust/create RChunk if necessary
+    gint err = DoChunk(iBufLen, iMsgBuffer);
+
+    if (err != TMS_RESULT_SUCCESS)
+        {
+        Stop();
+        iMsgBuffer.iStatus = err;
+        }
+    else
+        {
+        // Pass buffer parameters to the client
+        iMsgBuffer.iStatus = err;
+        iMsgBuffer.iInt = iBufLen;
+
+        // Copy data over to RChunk
+        TPtr8 dataPtr(iChunk.Base(), iBufLen, iBufLen);
+        dataPtr = data;
+        iStatus = EStreaming;
+
+        // If chunk is opened, we will expect a call from the client to
+        // get chunk handle. When we get a call to copy chunk handle,
+        // check these variables and see if they match. This is not
+        // completely secure, but will provide some level of security.
+        if (iMsgBuffer.iBool == TRUE)
+            {
+            iWriteDataXferHndlToClient = TRUE;
+            iKey = iMsgBuffer.iUint32;
+            }
+        }
+
+    // Notify client there is buffer ready to be emptied
+    iMsgBuffer.iRequest = ECmdEmptyBuffer;
+    err = iMsgQueue.Send(iMsgBuffer);
+    TRACE_PRN_IF_ERR(err);
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::BufferEmptied
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::BufferEmptied()
+    {
+    //TRACE_PRN_N(_L("TMS->UPL->BE"));
+    if (iDevSound)
+        {
+        iDevSound->RecordData();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetCodecCi
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetCodecCi()
+    {
+    TRAPD(err, SetCodecCiL());
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetCodecCiL
+//
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::SetCodecCiL()
+    {
+    TRACE_PRN_FN_ENT;
+
+    switch (iCodecID)
+        {
+        case KMccFourCCIdG711:
+            {
+            if (!iG711EncoderIntfc)
+                {
+                iG711EncoderIntfc = CG711EncoderIntfc::NewL(*iDevSound);
+                }
+            break;
+            }
+        case KMccFourCCIdG729:
+            {
+            if (!iG729EncoderIntfc)
+                {
+                iG729EncoderIntfc = CG729EncoderIntfc::NewL(*iDevSound);
+                }
+            break;
+            }
+        case KMccFourCCIdILBC:
+            {
+            if (!iIlbcEncoderIntfc)
+                {
+                iIlbcEncoderIntfc = CIlbcEncoderIntfc::NewL(*iDevSound);
+                }
+            break;
+            }
+        case KMccFourCCIdAMRNB:
+        case KMMFFourCCCodePCM16:
+            {
+            break;
+            }
+        default:
+            {
+            User::Leave(TMS_RESULT_INVALID_ARGUMENT);
+            break;
+            }
+        }
+
+    if (!iSpeechEncoderConfig && iCodecID != KMMFFourCCCodePCM16)
+        {
+        iSpeechEncoderConfig = CSpeechEncoderConfig::NewL(*iDevSound);
+        }
+
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetGain(const guint gain)
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iDevSound)
+        {
+        iDevSound->SetGain(gain);
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_N1(_L("TMS->UPL: SetGain [%d]"), gain);
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetGain(guint& gain)
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iDevSound)
+        {
+        gain = iDevSound->Gain();
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_N1(_L("TMS->UPL: GetGain [%d]"), gain);
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetMaxGain
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetMaxGain(guint& gain)
+    {
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+    if (iDevSound)
+        {
+        gain = iDevSound->MaxGain();
+        status = TMS_RESULT_SUCCESS;
+        }
+    TRACE_PRN_N1(_L("TMS->UPL: MaxGain [%d]"), gain);
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetDataXferChunkHndl
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetDataXferChunkHndl(const TUint32 key, RChunk& chunk)
+    {
+    gint status = TMS_RESULT_SUCCESS;
+
+    if (iChunk.Handle())
+        {
+        if (iWriteDataXferHndlToClient && (iKey == key))
+            {
+            chunk = iChunk;
+            iWriteDataXferHndlToClient = FALSE;
+            iKey = 0;
+            }
+        else
+            {
+            status = TMS_RESULT_ILLEGAL_OPERATION;
+            }
+        }
+
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetIlbcCodecMode(const gint mode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iILBCEncodeMode = mode;
+
+        if (iIlbcEncoderIntfc && iCodecID == KMccFourCCIdILBC)
+            {
+            if (mode == TMS_ILBC_CODEC_MODE_20MS_FRAME)
+                {
+                err = iIlbcEncoderIntfc->SetEncoderMode(
+                        CIlbcEncoderIntfc::E20msFrame);
+                TRACE_PRN_N(_L("TMS->UPL: SetIlbcCodecMode [20ms Frame]"));
+                }
+            else if (mode == TMS_ILBC_CODEC_MODE_30MS_FRAME)
+                {
+                err = iIlbcEncoderIntfc->SetEncoderMode(
+                        CIlbcEncoderIntfc::E30msFrame);
+                TRACE_PRN_N(_L("TMS->UPL: SetIlbcCodecMode [30ms Frame]"));
+                }
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetIlbcCodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetIlbcCodecMode(gint& mode)
+    {
+    // not available through CIs -> return cached value
+    mode = iILBCEncodeMode;
+    TRACE_PRN_N1(_L("TMS->UPL: GetIlbcCodecMode [%d]"), mode);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetG711CodecMode(const gint mode)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iStatus == EReady)
+        {
+        iG711EncodeMode = mode;
+
+        if (iG711EncoderIntfc && iCodecID == KMccFourCCIdG711)
+            {
+            if (mode == TMS_G711_CODEC_MODE_ALAW)
+                {
+                err = iG711EncoderIntfc->SetEncoderMode(
+                        CG711EncoderIntfc::EEncALaw);
+                TRACE_PRN_N(_L("TMS->UPL: SetG711CodecMode [ALaw]"));
+                }
+            else if (mode == TMS_G711_CODEC_MODE_MULAW)
+                {
+                err = iG711EncoderIntfc->SetEncoderMode(
+                        CG711EncoderIntfc::EEncULaw);
+                TRACE_PRN_N(_L("TMS->UPL: SetG711CodecMode [uLaw]"));
+                }
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetG711CodecMode
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetG711CodecMode(gint& mode)
+    {
+    // not available through CIs -> return cached value
+    mode = iG711EncodeMode;
+    TRACE_PRN_N1(_L("TMS->UPL: GetG711CodecMode [%d]"), mode);
+    return TMS_RESULT_SUCCESS;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetSupportedBitrates
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetSupportedBitrates(RArray<guint>& bitrates)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+    bitrates.Reset();
+
+    if (iSpeechEncoderConfig)
+        {
+        err = iSpeechEncoderConfig->GetSupportedBitrates(bitrates);
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetBitrate
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetBitrate(guint bitrate)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iSpeechEncoderConfig)
+        {
+        err = iSpeechEncoderConfig->SetBitrate(bitrate);
+        TRACE_PRN_N1(_L("TMS->UPL: SetBitrate [%d]"), bitrate);
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetBitrate
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetBitrate(guint& bitrate)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    if (iSpeechEncoderConfig)
+        {
+        err = iSpeechEncoderConfig->GetBitrate(bitrate);
+        TRACE_PRN_N1(_L("TMS->UPL: GetBitrate [%d]"), bitrate);
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::SetVad
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::SetVad(const TMSFormatType fmttype, const gboolean vad)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    switch (fmttype)
+        {
+        case TMS_FORMAT_G711:
+            {
+            if (iG711EncoderIntfc)
+                {
+                err = iG711EncoderIntfc->SetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_G729:
+            {
+            if (iG729EncoderIntfc)
+                {
+                err = iG729EncoderIntfc->SetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_ILBC:
+            {
+            if (iIlbcEncoderIntfc)
+                {
+                err = iIlbcEncoderIntfc->SetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_AMR:
+            {
+            if (iSpeechEncoderConfig)
+                {
+                err = iSpeechEncoderConfig->SetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: SetVad [%d]"), vad);
+                }
+            break;
+            }
+        default:
+            {
+            break; //TMS_RESULT_DOES_NOT_EXIST
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::GetVad
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSIPUplink::GetVad(const TMSFormatType fmttype, gboolean& vad)
+    {
+    gint err = TMS_RESULT_DOES_NOT_EXIST;
+
+    switch (fmttype)
+        {
+        case TMS_FORMAT_G711:
+            {
+            if (iG711EncoderIntfc)
+                {
+                err = iG711EncoderIntfc->GetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_G729:
+            {
+            if (iG729EncoderIntfc)
+                {
+                err = iG729EncoderIntfc->GetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_ILBC:
+            {
+            if (iIlbcEncoderIntfc)
+                {
+                err = iIlbcEncoderIntfc->GetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
+                }
+            break;
+            }
+        case TMS_FORMAT_AMR:
+            {
+            if (iSpeechEncoderConfig)
+                {
+                err = iSpeechEncoderConfig->GetVadMode(vad);
+                TRACE_PRN_N1(_L("TMS->UPL: GetVad [%d]"), vad);
+                }
+            break;
+            }
+        default:
+            {
+            break; //TMS_RESULT_DOES_NOT_EXIST
+            }
+        }
+
+    TRACE_PRN_IF_ERR(err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::InitializeComplete
+// A callback from the DevSound indicating completion of the initialization.
+// It will send config data to the D/S and configure the encoder via CI.
+// If everything goes well, the state of the thread is set EReady.
+// The initialization completion message is sent back to the main thread.
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::InitializeComplete(TInt aError)
+    {
+    TRACE_PRN_FN_ENT;
+
+    gint err = aError;
+
+    if (err == TMS_RESULT_SUCCESS && iDevSound)
+        {
+        TMMFCapabilities conf;
+        conf = iDevSound->Config();
+        conf.iRate = EMMFSampleRate8000Hz;
+        conf.iChannels = EMMFMono;
+        TRAP(err, iDevSound->SetConfigL(conf));
+        if (err == TMS_RESULT_SUCCESS)
+            {
+            // We are ready to stream even in case of CI setting failure
+            iStatus = EReady;
+            iMaxGain = iDevSound->MaxGain();
+            }
+
+        // Init Custom Interface API to the Encoder
+        err = SetCodecCi();
+        if (err != TMS_RESULT_SUCCESS)
+            {
+            // DEBUG only
+            // Can ignore error - although encoder is not fully configured but
+            // it can still run in the default mode.
+            TRACE_PRN_IF_ERR(err);
+            }
+        }
+
+    // TODO: Notify client
+
+    TRACE_PRN_IF_ERR(err);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSIPUplink::RecordError
+// From MDevSoundObserver
+// Recording error is send to the main thread.
+// The state of recorder is rolled back to EReady.
+// -----------------------------------------------------------------------------
+//
+void TMSIPUplink::RecordError(TInt /*aError*/)
+    {
+    //TRACE_PRN_IF_ERR(aError);
+
+#ifdef _DEBUG
+    iSamplesRecCount = 0;
+#endif
+    iStatus = EReady;
+
+    // TODO: Notify client
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmscallserver/src/tmstarsettings.cpp	Tue May 11 16:42:02 2010 +0300
@@ -0,0 +1,98 @@
+/*
+ * 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: Telephony Multimedia Service
+ *
+ */
+
+// INCLUDE FILES
+#include "tmstarsettings.h"
+#include "tmsclientserver.h"
+#include "tmsutility.h"
+
+using namespace TMS;
+
+// CONSTANTS
+_LIT_SECURITY_POLICY_PASS(KTMSServerReadPolicy);
+_LIT_SECURITY_POLICY_C1(KTMSServerWritePolicy, ECapabilityWriteUserData);
+
+// -----------------------------------------------------------------------------
+// TMSTarSettings::TMSTarSettings
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+TMSTarSettings::TMSTarSettings()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TMSTarSettings::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void TMSTarSettings::ConstructL()
+    {
+    TRACE_PRN_FN_ENT;
+    TInt err = RProperty::Define(ERoutingPs, RProperty::EByteArray,
+            KTMSServerReadPolicy, KTMSServerWritePolicy);
+    TRACE_PRN_N1(_L("TarSetting::ConstructL err:%d"),err);
+
+    if (err != KErrAlreadyExists)
+        {
+        User::LeaveIfError(err);
+        }
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSTarSettings::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+TMSTarSettings* TMSTarSettings::NewL()
+    {
+    TMSTarSettings* self = new (ELeave) TMSTarSettings();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// Destructor
+TMSTarSettings::~TMSTarSettings()
+    {
+    TRACE_PRN_FN_ENT;
+    TInt err = RProperty::Delete(KTMSPropertyCategory, ERoutingPs);
+    TRACE_PRN_N1(_L("TarSetting::~TMSTarSettings err:%d"),err);
+    TRACE_PRN_FN_ENT;
+    }
+
+// -----------------------------------------------------------------------------
+// TMSTarSettings::SetVolume
+// -----------------------------------------------------------------------------
+//
+void TMSTarSettings::SetTar(TRoutingMsgBufPckg rountingpckg, TBool aPublish)
+    {
+    TRACE_PRN_FN_ENT;
+    //    TInt err(KErrNone);
+    if (aPublish)
+        {
+        /*err =*/RProperty::Set(KTMSPropertyCategory, ERoutingPs, rountingpckg);
+        }
+
+    //TRACE_PRN_N1(_L("TarSetting::SetTar err:%d"),err);
+    TRACE_PRN_FN_EXT;
+    }
+
+//  End of File
--- a/mmserv/tms/tmsimpl/eabi/tmsimpl.def	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmsimpl/eabi/tmsimpl.def	Tue May 11 16:42:02 2010 +0300
@@ -15,84 +15,82 @@
 	_ZN3TMS20TMSGlobalRoutingImpl6DeleteERPNS_16TMSGlobalRoutingE @ 14 NONAME
 	_ZTIN3TMS11TMSCallImplE @ 15 NONAME
 	_ZTIN3TMS12TMSMemBufferE @ 16 NONAME
-	_ZTIN3TMS13TMSFormatImplE @ 17 NONAME
-	_ZTIN3TMS13TMSStreamImplE @ 18 NONAME
-	_ZTIN3TMS15TMSCallBodyImplE @ 19 NONAME
-	_ZTIN3TMS16TMSAMRFormatImplE @ 20 NONAME
-	_ZTIN3TMS16TMSMicSourceImplE @ 21 NONAME
-	_ZTIN3TMS16TMSModemSinkImplE @ 22 NONAME
-	_ZTIN3TMS16TMSPCMFormatImplE @ 23 NONAME
-	_ZTIN3TMS17TMSCSCallBodyImplE @ 24 NONAME
-	_ZTIN3TMS17TMSClientSinkImplE @ 25 NONAME
-	_ZTIN3TMS17TMSFormatBodyImplE @ 26 NONAME
-	_ZTIN3TMS17TMSG711FormatImplE @ 27 NONAME
-	_ZTIN3TMS17TMSG729FormatImplE @ 28 NONAME
-	_ZTIN3TMS17TMSGainEffectImplE @ 29 NONAME
-	_ZTIN3TMS17TMSILBCFormatImplE @ 30 NONAME
-	_ZTIN3TMS17TMSIPCallBodyImplE @ 31 NONAME
-	_ZTIN3TMS17TMSStreamBodyImplE @ 32 NONAME
-	_ZTIN3TMS18TMSModemSourceImplE @ 33 NONAME
-	_ZTIN3TMS18TMSSpeakerSinkImplE @ 34 NONAME
-	_ZTIN3TMS19TMSClientSourceImplE @ 35 NONAME
-	_ZTIN3TMS19TMSVolumeEffectImplE @ 36 NONAME
-	_ZTIN3TMS20TMSAMRFormatBodyImplE @ 37 NONAME
-	_ZTIN3TMS20TMSGlobalRoutingImplE @ 38 NONAME
-	_ZTIN3TMS20TMSMicSourceBodyImplE @ 39 NONAME
-	_ZTIN3TMS20TMSModemSinkBodyImplE @ 40 NONAME
-	_ZTIN3TMS20TMSPCMFormatBodyImplE @ 41 NONAME
-	_ZTIN3TMS21TMSClientSinkBodyImplE @ 42 NONAME
-	_ZTIN3TMS21TMSG711FormatBodyImplE @ 43 NONAME
-	_ZTIN3TMS21TMSG729FormatBodyImplE @ 44 NONAME
-	_ZTIN3TMS21TMSGainEffectBodyImplE @ 45 NONAME
-	_ZTIN3TMS21TMSILBCFormatBodyImplE @ 46 NONAME
-	_ZTIN3TMS22TMSGlobalVolEffectImplE @ 47 NONAME
-	_ZTIN3TMS22TMSModemSourceBodyImplE @ 48 NONAME
-	_ZTIN3TMS22TMSSpeakerSinkBodyImplE @ 49 NONAME
-	_ZTIN3TMS23TMSClientSourceBodyImplE @ 50 NONAME
-	_ZTIN3TMS23TMSGlobalGainEffectImplE @ 51 NONAME
-	_ZTIN3TMS23TMSVolumeEffectBodyImplE @ 52 NONAME
-	_ZTIN3TMS24TMSGlobalRoutingBodyImplE @ 53 NONAME
-	_ZTIN3TMS26TMSGlobalVolEffectBodyImplE @ 54 NONAME
-	_ZTIN3TMS27TMSGlobalGainEffectBodyImplE @ 55 NONAME
-	_ZTVN3TMS11TMSCallImplE @ 56 NONAME
-	_ZTVN3TMS12TMSMemBufferE @ 57 NONAME
-	_ZTVN3TMS13TMSFormatImplE @ 58 NONAME
-	_ZTVN3TMS13TMSStreamImplE @ 59 NONAME
-	_ZTVN3TMS15TMSCallBodyImplE @ 60 NONAME
-	_ZTVN3TMS16TMSAMRFormatImplE @ 61 NONAME
-	_ZTVN3TMS16TMSMicSourceImplE @ 62 NONAME
-	_ZTVN3TMS16TMSModemSinkImplE @ 63 NONAME
-	_ZTVN3TMS16TMSPCMFormatImplE @ 64 NONAME
-	_ZTVN3TMS17TMSCSCallBodyImplE @ 65 NONAME
-	_ZTVN3TMS17TMSClientSinkImplE @ 66 NONAME
-	_ZTVN3TMS17TMSFormatBodyImplE @ 67 NONAME
-	_ZTVN3TMS17TMSG711FormatImplE @ 68 NONAME
-	_ZTVN3TMS17TMSG729FormatImplE @ 69 NONAME
-	_ZTVN3TMS17TMSGainEffectImplE @ 70 NONAME
-	_ZTVN3TMS17TMSILBCFormatImplE @ 71 NONAME
-	_ZTVN3TMS17TMSIPCallBodyImplE @ 72 NONAME
-	_ZTVN3TMS17TMSStreamBodyImplE @ 73 NONAME
-	_ZTVN3TMS18TMSModemSourceImplE @ 74 NONAME
-	_ZTVN3TMS18TMSSpeakerSinkImplE @ 75 NONAME
-	_ZTVN3TMS19TMSClientSourceImplE @ 76 NONAME
-	_ZTVN3TMS19TMSVolumeEffectImplE @ 77 NONAME
-	_ZTVN3TMS20TMSAMRFormatBodyImplE @ 78 NONAME
-	_ZTVN3TMS20TMSGlobalRoutingImplE @ 79 NONAME
-	_ZTVN3TMS20TMSMicSourceBodyImplE @ 80 NONAME
-	_ZTVN3TMS20TMSModemSinkBodyImplE @ 81 NONAME
-	_ZTVN3TMS20TMSPCMFormatBodyImplE @ 82 NONAME
-	_ZTVN3TMS21TMSClientSinkBodyImplE @ 83 NONAME
-	_ZTVN3TMS21TMSG711FormatBodyImplE @ 84 NONAME
-	_ZTVN3TMS21TMSG729FormatBodyImplE @ 85 NONAME
-	_ZTVN3TMS21TMSGainEffectBodyImplE @ 86 NONAME
-	_ZTVN3TMS21TMSILBCFormatBodyImplE @ 87 NONAME
-	_ZTVN3TMS22TMSGlobalVolEffectImplE @ 88 NONAME
-	_ZTVN3TMS22TMSModemSourceBodyImplE @ 89 NONAME
-	_ZTVN3TMS22TMSSpeakerSinkBodyImplE @ 90 NONAME
-	_ZTVN3TMS23TMSClientSourceBodyImplE @ 91 NONAME
-	_ZTVN3TMS23TMSGlobalGainEffectImplE @ 92 NONAME
-	_ZTVN3TMS23TMSVolumeEffectBodyImplE @ 93 NONAME
-	_ZTVN3TMS24TMSGlobalRoutingBodyImplE @ 94 NONAME
-	_ZTVN3TMS26TMSGlobalVolEffectBodyImplE @ 95 NONAME
-	_ZTVN3TMS27TMSGlobalGainEffectBodyImplE @ 96 NONAME
+	_ZTIN3TMS13TMSStreamImplE @ 17 NONAME
+	_ZTIN3TMS15TMSCallBodyImplE @ 18 NONAME
+	_ZTIN3TMS16TMSAMRFormatImplE @ 19 NONAME
+	_ZTIN3TMS16TMSMicSourceImplE @ 20 NONAME
+	_ZTIN3TMS16TMSModemSinkImplE @ 21 NONAME
+	_ZTIN3TMS16TMSPCMFormatImplE @ 22 NONAME
+	_ZTIN3TMS17TMSCSCallBodyImplE @ 23 NONAME
+	_ZTIN3TMS17TMSClientSinkImplE @ 24 NONAME
+	_ZTIN3TMS17TMSFormatBodyImplE @ 25 NONAME
+	_ZTIN3TMS17TMSG711FormatImplE @ 26 NONAME
+	_ZTIN3TMS17TMSG729FormatImplE @ 27 NONAME
+	_ZTIN3TMS17TMSGainEffectImplE @ 28 NONAME
+	_ZTIN3TMS17TMSILBCFormatImplE @ 29 NONAME
+	_ZTIN3TMS17TMSIPCallBodyImplE @ 30 NONAME
+	_ZTIN3TMS17TMSStreamBodyImplE @ 31 NONAME
+	_ZTIN3TMS18TMSModemSourceImplE @ 32 NONAME
+	_ZTIN3TMS18TMSSpeakerSinkImplE @ 33 NONAME
+	_ZTIN3TMS19TMSClientSourceImplE @ 34 NONAME
+	_ZTIN3TMS19TMSVolumeEffectImplE @ 35 NONAME
+	_ZTIN3TMS20TMSAMRFormatBodyImplE @ 36 NONAME
+	_ZTIN3TMS20TMSGlobalRoutingImplE @ 37 NONAME
+	_ZTIN3TMS20TMSMicSourceBodyImplE @ 38 NONAME
+	_ZTIN3TMS20TMSModemSinkBodyImplE @ 39 NONAME
+	_ZTIN3TMS20TMSPCMFormatBodyImplE @ 40 NONAME
+	_ZTIN3TMS21TMSClientSinkBodyImplE @ 41 NONAME
+	_ZTIN3TMS21TMSG711FormatBodyImplE @ 42 NONAME
+	_ZTIN3TMS21TMSG729FormatBodyImplE @ 43 NONAME
+	_ZTIN3TMS21TMSGainEffectBodyImplE @ 44 NONAME
+	_ZTIN3TMS21TMSILBCFormatBodyImplE @ 45 NONAME
+	_ZTIN3TMS22TMSGlobalVolEffectImplE @ 46 NONAME
+	_ZTIN3TMS22TMSModemSourceBodyImplE @ 47 NONAME
+	_ZTIN3TMS22TMSSpeakerSinkBodyImplE @ 48 NONAME
+	_ZTIN3TMS23TMSClientSourceBodyImplE @ 49 NONAME
+	_ZTIN3TMS23TMSGlobalGainEffectImplE @ 50 NONAME
+	_ZTIN3TMS23TMSVolumeEffectBodyImplE @ 51 NONAME
+	_ZTIN3TMS24TMSGlobalRoutingBodyImplE @ 52 NONAME
+	_ZTIN3TMS26TMSGlobalVolEffectBodyImplE @ 53 NONAME
+	_ZTIN3TMS27TMSGlobalGainEffectBodyImplE @ 54 NONAME
+	_ZTVN3TMS11TMSCallImplE @ 55 NONAME
+	_ZTVN3TMS12TMSMemBufferE @ 56 NONAME
+	_ZTVN3TMS13TMSStreamImplE @ 57 NONAME
+	_ZTVN3TMS15TMSCallBodyImplE @ 58 NONAME
+	_ZTVN3TMS16TMSAMRFormatImplE @ 59 NONAME
+	_ZTVN3TMS16TMSMicSourceImplE @ 60 NONAME
+	_ZTVN3TMS16TMSModemSinkImplE @ 61 NONAME
+	_ZTVN3TMS16TMSPCMFormatImplE @ 62 NONAME
+	_ZTVN3TMS17TMSCSCallBodyImplE @ 63 NONAME
+	_ZTVN3TMS17TMSClientSinkImplE @ 64 NONAME
+	_ZTVN3TMS17TMSFormatBodyImplE @ 65 NONAME
+	_ZTVN3TMS17TMSG711FormatImplE @ 66 NONAME
+	_ZTVN3TMS17TMSG729FormatImplE @ 67 NONAME
+	_ZTVN3TMS17TMSGainEffectImplE @ 68 NONAME
+	_ZTVN3TMS17TMSILBCFormatImplE @ 69 NONAME
+	_ZTVN3TMS17TMSIPCallBodyImplE @ 70 NONAME
+	_ZTVN3TMS17TMSStreamBodyImplE @ 71 NONAME
+	_ZTVN3TMS18TMSModemSourceImplE @ 72 NONAME
+	_ZTVN3TMS18TMSSpeakerSinkImplE @ 73 NONAME
+	_ZTVN3TMS19TMSClientSourceImplE @ 74 NONAME
+	_ZTVN3TMS19TMSVolumeEffectImplE @ 75 NONAME
+	_ZTVN3TMS20TMSAMRFormatBodyImplE @ 76 NONAME
+	_ZTVN3TMS20TMSGlobalRoutingImplE @ 77 NONAME
+	_ZTVN3TMS20TMSMicSourceBodyImplE @ 78 NONAME
+	_ZTVN3TMS20TMSModemSinkBodyImplE @ 79 NONAME
+	_ZTVN3TMS20TMSPCMFormatBodyImplE @ 80 NONAME
+	_ZTVN3TMS21TMSClientSinkBodyImplE @ 81 NONAME
+	_ZTVN3TMS21TMSG711FormatBodyImplE @ 82 NONAME
+	_ZTVN3TMS21TMSG729FormatBodyImplE @ 83 NONAME
+	_ZTVN3TMS21TMSGainEffectBodyImplE @ 84 NONAME
+	_ZTVN3TMS21TMSILBCFormatBodyImplE @ 85 NONAME
+	_ZTVN3TMS22TMSGlobalVolEffectImplE @ 86 NONAME
+	_ZTVN3TMS22TMSModemSourceBodyImplE @ 87 NONAME
+	_ZTVN3TMS22TMSSpeakerSinkBodyImplE @ 88 NONAME
+	_ZTVN3TMS23TMSClientSourceBodyImplE @ 89 NONAME
+	_ZTVN3TMS23TMSGlobalGainEffectImplE @ 90 NONAME
+	_ZTVN3TMS23TMSVolumeEffectBodyImplE @ 91 NONAME
+	_ZTVN3TMS24TMSGlobalRoutingBodyImplE @ 92 NONAME
+	_ZTVN3TMS26TMSGlobalVolEffectBodyImplE @ 93 NONAME
+	_ZTVN3TMS27TMSGlobalGainEffectBodyImplE @ 94 NONAME
 
--- a/mmserv/tms/tmsimpl/src/tmsbufferimpl.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsbufferimpl.cpp	Tue May 11 16:42:02 2010 +0300
@@ -21,18 +21,6 @@
 
 using namespace TMS;
 
-TMSBufferImpl::TMSBufferImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-TMSBufferImpl::~TMSBufferImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
 EXPORT_C gint TMSBufferImpl::Create(TMSBufferType buffertype, guint size,
         TMSBuffer*& tmsbuffer)
     {
--- a/mmserv/tms/tmsimpl/src/tmseffectimpl.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmseffectimpl.cpp	Tue May 11 16:42:02 2010 +0300
@@ -24,18 +24,6 @@
 
 using namespace TMS;
 
-TMSEffectImpl::TMSEffectImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-TMSEffectImpl::~TMSEffectImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
 EXPORT_C gint TMSEffectImpl::Create(TMSEffectType effecttype,
         TMSEffect*& tmseffect)
     {
--- a/mmserv/tms/tmsimpl/src/tmsformatimpl.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsformatimpl.cpp	Tue May 11 16:42:02 2010 +0300
@@ -26,18 +26,6 @@
 
 using namespace TMS;
 
-TMSFormatImpl::TMSFormatImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-TMSFormatImpl::~TMSFormatImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
 EXPORT_C gint TMSFormatImpl::Create(TMSFormatType fmttype, TMSFormat*& tmsfmt)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
--- a/mmserv/tms/tmsimpl/src/tmssinkimpl.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmssinkimpl.cpp	Tue May 11 16:42:02 2010 +0300
@@ -23,18 +23,6 @@
 
 using namespace TMS;
 
-TMSSinkImpl::TMSSinkImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-TMSSinkImpl::~TMSSinkImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
 EXPORT_C gint TMSSinkImpl::Create(TMSSinkType sinktype, TMSSink*& tmssink)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
--- a/mmserv/tms/tmsimpl/src/tmssourceimpl.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmssourceimpl.cpp	Tue May 11 16:42:02 2010 +0300
@@ -23,18 +23,6 @@
 
 using namespace TMS;
 
-TMSSourceImpl::TMSSourceImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-TMSSourceImpl::~TMSSourceImpl()
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
 EXPORT_C gint TMSSourceImpl::Create(TMSSourceType sourcetype,
         TMSSource*& tmssource)
     {
--- a/mmserv/tms/tmsserver/src/tmsserver.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/tms/tmsserver/src/tmsserver.cpp	Tue May 11 16:42:02 2010 +0300
@@ -80,7 +80,7 @@
     iUplCodecs.Close();
     delete iEffectSettings;
     delete iTarHandler;
-    CancelCenRepHandler();
+    delete iAudioCenRepHandler;
 
     TRACE_PRN_FN_EXT;
     }