multimediacommsengine/mmceshared/src/mcecomfactory.cpp
branchrcs
changeset 49 64c62431ac08
parent 0 1bce908db942
--- a/multimediacommsengine/mmceshared/src/mcecomfactory.cpp	Mon Aug 23 17:50:26 2010 +0300
+++ b/multimediacommsengine/mmceshared/src/mcecomfactory.cpp	Mon Sep 06 17:32:13 2010 +0530
@@ -61,8 +61,23 @@
 #include "mcecomavccodec.h"
 #include "mcecomamrwbcodec.h"
 #include "mceserial.h"
-
-
+#include "mcemessagestream.h"
+#include "mcecommessagestream.h"
+#include "mcemsrpsource.h"
+#include "mcecommsrpsource.h"
+#include "mcemsrpsink.h"
+#include "mcecommsrpsink.h"
+#include "mceexternalsink.h"
+#include "mcecomexternalsink.h"
+#include "mcecomexternalsource.h"
+#include "mcemessagesink.h"
+#include "mcemessagesource.h"
+#include "mcecommessagesink.h"
+#include "mcecommessagesource.h"
+#include "mceexternalsource.h"
+#include "mcemessagecodec.h"
+#include "mcecommessagecodec.h"
+#include "mcecommsrpcodec.h"
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -261,6 +276,11 @@
             stream = CMceComVideoStream::NewLC();
             break;
             }
+		case KMceMessage:
+			{
+			stream = CMceComMessageStream::NewLC();
+			break;
+			}
         default:
             {
             break;
@@ -329,6 +349,23 @@
             source = CMceComFileSource::NewLC();
             break;
             }
+		case KMceExternalSource:
+            {
+            source = CMceComExternalSource::NewLC();
+            break;
+            }
+            
+		case KMceMessageSource:
+		    {
+		    source = CMceComMessageSource::NewLC();
+		    break;
+		    }
+			
+		case KMceMSRPSource:
+            {
+            source = CMceComMsrpSource::NewLC();
+            break;
+            }
         default:
             {
             break;
@@ -394,6 +431,21 @@
             sink = CMceComFileSink::NewLC();
             break;
             }
+		case KMceExternalSink:
+			{
+			sink = CMceComExternalSink::NewLC();
+			break;
+			}
+		case KMceMessageSink:
+		    {
+		    sink = CMceComMessageSink::NewLC();
+		    break;
+		    }
+		case KMceMSRPSink:
+			{
+			sink = CMceComMsrpSink::NewLC();
+			break;
+			}
         default:
             {
             break;
@@ -635,3 +687,67 @@
     return codec;
     
     }
+
+// -----------------------------------------------------------------------------
+// TMceComMessageCodecFactory::CreateLC 
+// -----------------------------------------------------------------------------
+//
+CMceComMessageCodec* TMceComMessageCodecFactory::CreateLC( const TBuf8<KMceMaxSdpNameLength> aSdpName )
+    {
+    CMceComMessageCodec* codec = CreateCodecLC( aSdpName );
+    __ASSERT_ALWAYS( codec, User::Leave( KErrNotSupported ) );
+    
+    return codec;
+    
+    }
+
+// -----------------------------------------------------------------------------
+// TMceComMessageCodecFactory::CreateCodecLC 
+// -----------------------------------------------------------------------------
+//
+CMceComMessageCodec* TMceComMessageCodecFactory::CreateCodecLC( const TBuf8<KMceMaxSdpNameLength> aSdpName )
+    {
+    CMceComMessageCodec* codec = NULL; 
+   	
+   	//plain codec 
+    if ( !aSdpName.CompareF(KMceSDPNameMsrp) )
+        {
+        codec = CMceComMsrpCodec::NewLC( aSdpName );
+        }
+   else
+        {
+        codec = NULL;
+        }
+    
+    return codec;
+    
+    }
+
+// -----------------------------------------------------------------------------
+// TMceComMessageCodecFactory::CreateCodecLC 
+// -----------------------------------------------------------------------------
+//
+CMceComMessageCodec* TMceComMessageCodecFactory::CreateCodecLC( TUint /*aPayload*/ )
+    {
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// TMceComMessageCodecFactory::CreateLC
+// -----------------------------------------------------------------------------
+//
+CMceComMessageCodec* TMceComMessageCodecFactory::CreateLC( MMceComSerializationContext& aSerCtx )
+    {
+    RReadStream& readStream = aSerCtx.ReadStream();
+    
+    MStreamBuf* streamBuf = readStream.Source();
+    TStreamPos pos = streamBuf->TellL( MStreamBuf::ERead );
+    TBuf8<KMceMaxSdpNameLength> sdpName;
+    MceSerial::DecodeL( sdpName, readStream );
+    streamBuf->SeekL( MStreamBuf::ERead, pos );
+    
+    CMceComMessageCodec* codec = CreateLC( sdpName );
+    codec->InternalizeL( aSerCtx );
+    return codec;
+    
+    }