multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/CMCETestUIEngineSink.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // MCE API
       
    22 
       
    23 
       
    24 
       
    25 #include <MCESession.h>
       
    26 #include <MCEMediaStream.h>
       
    27 //#include <MCEOneWayStream.h>
       
    28 #include <MCEAudioStream.h>
       
    29 #include <MCEMediaSource.h>
       
    30 #include <MCEMicSource.h>
       
    31 
       
    32 #include <MCERtpSink.h>
       
    33 #include <MCEMediaSink.h>
       
    34 #include <MCESpeakerSink.h>
       
    35 
       
    36 
       
    37 
       
    38 #include "CMCETestUIEngine.h"
       
    39 #include "MCETestUIEngineConstants.h"
       
    40 #include "CMCETestUIEngineSink.h"
       
    41 
       
    42 #include "TMCETestUIEngineCmdBase.h"
       
    43 #include "TMCETestUIEngineCmdEnableAudioSink.h"
       
    44 #include "TMCETestUIEngineCmdDisableAudioSink.h"
       
    45 // ============================ MEMBER FUNCTIONS ===============================
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CMCETestUIEngineSink::NewL()
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CMCETestUIEngineSink* CMCETestUIEngineSink::NewL(
       
    52             CMCETestUIEngine& aEngine, 
       
    53             CMceMediaSink& aSink )
       
    54     {
       
    55 
       
    56     CMCETestUIEngineSink* self = 
       
    57         new (ELeave) CMCETestUIEngineSink( aEngine, 
       
    58                                                   aSink );
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     CleanupStack::Pop( self );
       
    62     return self;  
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CMCETestUIEngineSink::CMCETestUIEngineSink
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CMCETestUIEngineSink::CMCETestUIEngineSink( 
       
    70                 CMCETestUIEngine& aEngine, 
       
    71             	CMceMediaSink& aSink )
       
    72     : iEngine( aEngine ),
       
    73       iSink( aSink )
       
    74     {
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CMCETestUIEngineSink::ConstructL()
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void CMCETestUIEngineSink::ConstructL()
       
    82     {
       
    83 	return; //solve direction function is availble in engineaudiostream.h 
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CMCETestUIEngineSink::~CMCETestUIEngineSink
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 EXPORT_C CMCETestUIEngineSink::~CMCETestUIEngineSink()
       
    91     {
       
    92     iCommands.ResetAndDestroy();
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CMCETestUIEngineSink::GetCommands
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 const RPointerArray<TMCETestUIEngineCmdBase>& 
       
   100             CMCETestUIEngineSink::GetCommandsL()
       
   101     {	
       
   102     iCommands.ResetAndDestroy();
       
   103     
       
   104     if ( iSink.IsEnabled() )
       
   105         {
       
   106         iCommands.Append( new (ELeave) TMCETestUIEngineCmdDisableSink( 
       
   107                                 iEngine, *this ) );
       
   108         }
       
   109     else
       
   110         {
       
   111         iCommands.Append( new (ELeave) TMCETestUIEngineCmdEnableSink( 
       
   112                                 iEngine, *this ) );
       
   113         }	  
       
   114     if(iSink.Type() == KMceRTPSink)    	  
       
   115     	{
       
   116     	iCommands.Append( new (ELeave) TMCETestUIEngineCmdSendSR( 
       
   117                                 iEngine, *this ) );
       
   118     	}   
       
   119      
       
   120     return iCommands; 
       
   121     }
       
   122 
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CMCETestUIEngineSink::State
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 EXPORT_C const TDesC16& CMCETestUIEngineSink::State() const
       
   129     {
       
   130     if ( iSink.IsEnabled() )
       
   131         {
       
   132         return KSinkStateEnabled;
       
   133         }
       
   134     return KSinkStateDisabled;
       
   135     }
       
   136         
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 // CMCETestUIEngineSink::AudioStream
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 EXPORT_C CMceMediaSink& CMCETestUIEngineSink::Sink()
       
   143     {        
       
   144     return iSink;
       
   145     }
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 // CMCETestUIEngineSink::AudioStream
       
   149 // -----------------------------------------------------------------------------
       
   150 //
       
   151 
       
   152 EXPORT_C const TMceSinkType CMCETestUIEngineSink::Type() const
       
   153 {
       
   154 	return iSink.Type();
       
   155 }
       
   156 
       
   157