mmsharing/livecommsui/lcui/tsrc/mustester/Stubs/mceclientstub/src/mceaudiostream.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     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 #include "mceaudiostream.h"
       
    20 #include "mcemanager.h"
       
    21 #include "mceaudiocodec.h"
       
    22 #include "mcesession.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CMceAudioStream::NewL
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 EXPORT_C CMceAudioStream* CMceAudioStream::NewL()
       
    31     {
       
    32     CMceAudioStream* self = NewLC();
       
    33     CleanupStack::Pop( self );
       
    34     return self; 
       
    35     }
       
    36    
       
    37 // -----------------------------------------------------------------------------
       
    38 // CMceAudioStream::NewLC
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 EXPORT_C CMceAudioStream* CMceAudioStream::NewLC()
       
    42     {
       
    43     CMceAudioStream* self = new (ELeave) CMceAudioStream();
       
    44     CleanupStack::PushL( self );
       
    45     self->ConstructL();
       
    46     return self;    
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CMceAudioStream::~CMceAudioStream
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 EXPORT_C CMceAudioStream::~CMceAudioStream()
       
    54     {
       
    55     iCodecs.ResetAndDestroy();
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CMceAudioStream::Codecs
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 EXPORT_C const RPointerArray<CMceAudioCodec>& CMceAudioStream::Codecs()
       
    63     {
       
    64     return iCodecs;
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CMceAudioStream::AddCodecL
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 EXPORT_C void CMceAudioStream::AddCodecL(CMceAudioCodec* aCodec)
       
    72     {
       
    73     __ASSERT_ALWAYS(aCodec, User::Leave(KErrArgument));
       
    74     iCodecs.AppendL(aCodec);
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CMceAudioStream::RemoveCodecL
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 EXPORT_C void CMceAudioStream::RemoveCodecL(CMceAudioCodec& aCodec)
       
    82     {
       
    83     for(int i = 0; i < iCodecs.Count(); i++ )
       
    84         {
       
    85         if( iCodecs[i] == &aCodec )
       
    86             {
       
    87             delete iCodecs[i];
       
    88             iCodecs.Remove( i );
       
    89             }
       
    90         }
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CMceAudioStream::CMceAudioStream
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 CMceAudioStream::CMceAudioStream()
       
    98     :CMceMediaStream()
       
    99     {
       
   100     iType = KMceAudio;
       
   101     }
       
   102 
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // CMceAudioStream::ConstructL
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 void CMceAudioStream::ConstructL()
       
   109     {
       
   110     }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CMceAudioStream::InitializeL
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 void CMceAudioStream::InitializeL( CMceSession& aParent )
       
   117     {
       
   118     
       
   119     CMceMediaStream::InitializeL( aParent );
       
   120 
       
   121     InitializeL( &aParent.Manager() );
       
   122             
       
   123     for( TInt i = 0; i < iCodecs.Count(); i++ )
       
   124         {
       
   125         iCodecs[i]->InitializeL( *this );
       
   126         }
       
   127     }
       
   128 
       
   129 
       
   130 // -----------------------------------------------------------------------------
       
   131 // CMceAudioStream::InitializeL
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 void CMceAudioStream::InitializeL( CMceManager* aManager )
       
   135     {
       
   136     CMceMediaStream::InitializeL( aManager );
       
   137     if ( aManager && iCodecs.Count() == 0 )
       
   138         {
       
   139         const RPointerArray<const CMceAudioCodec> supportedCodes = 
       
   140                                       aManager->SupportedAudioCodecs();
       
   141         for( TInt i = 0; i < supportedCodes.Count(); i++ )
       
   142             {
       
   143             CMceAudioCodec* codec = supportedCodes[i]->CloneL();
       
   144             CleanupStack::PushL( codec );
       
   145             iCodecs.AppendL( codec );
       
   146             CleanupStack::Pop( codec );
       
   147             }
       
   148                                       
       
   149         }
       
   150         
       
   151     }
       
   152 
       
   153 
       
   154 
       
   155