multimediacommsengine/mmcecli/src/mcefactory.cpp
branchrcs
changeset 49 64c62431ac08
parent 0 1bce908db942
--- a/multimediacommsengine/mmcecli/src/mcefactory.cpp	Mon Aug 23 17:50:26 2010 +0300
+++ b/multimediacommsengine/mmcecli/src/mcefactory.cpp	Mon Sep 06 17:32:13 2010 +0530
@@ -19,6 +19,7 @@
 
 
 #include <s32buf.h>
+#include <mcedefs.h>
 
 #include "mceinsession.h"
 #include "mceoutsession.h"
@@ -48,6 +49,15 @@
 #include "mcestreambundle.h"
 #include "mceavsink.h"
 #include "mceavccodec.h"
+#include "mcemessagestream.h"
+#include "mcemsrpsource.h"
+#include "mcemsrpsink.h"
+#include "mceexternalsource.h"
+#include "mceexternalsink.h"
+#include "mcemsrpcodec.h"
+#include "mcemessagesource.h"
+#include "mcemessagesink.h"
+
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -254,7 +264,12 @@
             {
             stream = CMceVideoStream::NewLC();
             break;
-            }            
+            }
+        case KMceMessage:
+            {
+            stream = CMceMessageStream::NewLC();
+            break;
+            }
         default:
             {
             break;
@@ -324,6 +339,21 @@
             source = CMceFileSource::NewLC();
             break;
             }
+        case KMceMSRPSource:
+            {
+            source = CMceMsrpSource::NewLC();
+            break;
+            }
+        case KMceExternalSource:
+            {
+            source = CMceExternalSource::NewLC();
+            break;
+            }
+        case KMceMessageSource:
+            {
+            source = CMceMessageSource::NewLC();
+            break;
+            }     
         default:
             {
             break;
@@ -388,6 +418,21 @@
             sink = CMceFileSink::NewLC();
             break;
             }
+        case KMceMSRPSink:
+            {
+            sink = CMceMsrpSink::NewLC();
+            break;
+            }
+        case KMceExternalSink:
+            {
+            sink = CMceExternalSink::NewLC();
+            break;
+            }
+        case KMceMessageSink:
+            {
+            sink = CMceMessageSink::NewLC();
+            break;
+            }
         default:
             {
             break;
@@ -598,3 +643,58 @@
     return codec;    
     }
 
+
+// -----------------------------------------------------------------------------
+// TMceMessageCodecFactory::CreateLC
+// -----------------------------------------------------------------------------
+//
+CMceMessageCodec* TMceMessageCodecFactory::CreateLC( TBuf8<KMceMaxSdpNameLength> aSdpName )
+    {
+    CMceMessageCodec* codec = CreateL( aSdpName );
+    CleanupStack::PushL( codec );
+	return codec;     
+    }
+    
+// -----------------------------------------------------------------------------
+// TMceMessageCodecFactory::CreateL
+// -----------------------------------------------------------------------------
+//
+CMceMessageCodec* TMceMessageCodecFactory::CreateL( TBuf8<KMceMaxSdpNameLength> aSdpName )
+    {
+    CMceMessageCodec* codec = NULL;
+    if( !aSdpName.CompareF(KMceSDPNameMsrp) )
+        {
+        codec = CMceMsrpCodec::NewL( aSdpName );
+        } 
+    //else if( !aSdpName.CompareF(KMceSDPNameRED) )
+    //    {
+    //    codec = CMceRedCodec::NewL( aSdpName );
+    //    } 
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }
+	return codec;
+	        
+    }
+
+// -----------------------------------------------------------------------------
+// TMceMessageCodecFactory::CreateLC
+// -----------------------------------------------------------------------------
+//
+CMceMessageCodec* TMceMessageCodecFactory::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 );
+    
+    CMceMessageCodec* codec = CreateL( sdpName );
+    CleanupStack::PushL( codec );
+    codec->InternalizeL( aSerCtx );
+    return codec;    
+    }