multimediacommsengine/mmceshared/src/mcecommicsource.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 #include "mcemicsource.h"
       
    22 #include "mcecommicsource.h"
       
    23 #include "mceevents.h"
       
    24 
       
    25 #ifdef MCE_COMMON_SERVER_SIDE
       
    26 
       
    27 #include <mmccinterface.h>
       
    28 #include "mcesdpsession.h"
       
    29 #include "mcemediamanager.h"
       
    30 
       
    31 #endif//MCE_COMMON_SERVER_SIDE
       
    32 
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CMceComMicSource::NewL
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 CMceComMicSource* CMceComMicSource::NewL()
       
    42     {
       
    43     CMceComMicSource* self = NewLC();
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CMceComMicSource::NewLC
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CMceComMicSource* CMceComMicSource::NewLC()
       
    53     {
       
    54     CMceComMicSource* self = new (ELeave) CMceComMicSource();
       
    55     CleanupStack::PushL( self );
       
    56     return self;
       
    57     }
       
    58 
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CMceComMicSource::~CMceComMicSource
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 CMceComMicSource::~CMceComMicSource()
       
    65     {
       
    66     }
       
    67     
       
    68 // -----------------------------------------------------------------------------
       
    69 // CMceComMicSource::CMceComMicSource
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 CMceComMicSource::CMceComMicSource()
       
    73   : CMceComMediaSource( KMceMicSource ),
       
    74     iGain( KMceNotAssignedInt )
       
    75     {
       
    76     }
       
    77 
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CMceComMicSource::InternalizeFlatL
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CMceComMicSource::InternalizeFlatL( RReadStream& aReadStream )
       
    84     {
       
    85     CMceComMediaSource::InternalizeFlatL( aReadStream );
       
    86     
       
    87     iGain = aReadStream.ReadInt32L();
       
    88     }
       
    89     
       
    90 // -----------------------------------------------------------------------------
       
    91 // CMceComMicSource::ExternalizeFlatL
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CMceComMicSource::ExternalizeFlatL( RWriteStream& aWriteStream )
       
    95     {
       
    96     CMceComMediaSource::ExternalizeFlatL( aWriteStream );
       
    97     
       
    98     aWriteStream.WriteInt32L( iGain );
       
    99     }
       
   100     
       
   101     
       
   102 // -----------------------------------------------------------------------------
       
   103 // CMceComMicSource::CloneL
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 CMceComMediaSource* CMceComMicSource::CloneL()
       
   107     {
       
   108     CMceComMicSource* copy = new (ELeave) CMceComMicSource();
       
   109     Mem::Copy( copy, this, sizeof(CMceComMicSource) );
       
   110     copy->Zero();
       
   111     return copy;
       
   112         
       
   113     }
       
   114     
       
   115     
       
   116 // -----------------------------------------------------------------------------
       
   117 // CMceComMicSource::EventReceivedL
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 TInt CMceComMicSource::EventReceivedL( TMceComEvent& aEvent )
       
   121     {
       
   122     TInt status = CMceComMediaSource::EventReceivedL( aEvent );
       
   123     if ( status != KMceEventNotConsumed )
       
   124         {
       
   125         return status;
       
   126         }
       
   127                 
       
   128     if ( aEvent.Id().IsSourceId() )
       
   129         {
       
   130         status = aEvent.Handler().HandleL( *this, aEvent );
       
   131         }
       
   132     else
       
   133         {
       
   134         status = KMceEventNotConsumed;
       
   135         }
       
   136     
       
   137     return status;
       
   138     
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CMceComMicSource::UpdateL
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 void CMceComMicSource::UpdateL( CMceComMediaSource& aUpdate )
       
   146     {
       
   147     CMceComMediaSource::UpdateL( aUpdate );
       
   148     
       
   149     iGain = static_cast<CMceComMicSource&>( aUpdate ).iGain;
       
   150     }
       
   151     
       
   152 // -----------------------------------------------------------------------------
       
   153 // CMceComMicSource::Reusable
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 TBool CMceComMicSource::Reusable( const CMceComMediaStream& /*aParent*/ ) const
       
   157     {
       
   158     return EFalse;
       
   159     }
       
   160     
       
   161 #ifdef MCE_COMMON_SERVER_SIDE
       
   162 
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // CMceComMicSource::MccType
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 const TUid CMceComMicSource::MccType()
       
   169     {
       
   170     return KUidMmfAudioInput;
       
   171     }
       
   172 
       
   173 // -----------------------------------------------------------------------------
       
   174 // CMceComMicSource::PrepareL
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 void CMceComMicSource::PrepareL()
       
   178     {
       
   179     if ( MediaStream() && MediaStream()->Session() && iGain != KMceNotAssignedInt )
       
   180         {
       
   181         MediaStream()->Session()->SdpSession().Manager().SetGainL( *this, iGain );
       
   182         }
       
   183     }
       
   184     
       
   185 #endif//MCE_COMMON_SERVER_SIDE
       
   186 
       
   187 
       
   188     
       
   189