diff -r ccd8e69b5392 -r 496ad160a278 tsrc/mceclientstub/src/mceaudiostream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/mceclientstub/src/mceaudiostream.cpp Fri Jun 11 13:36:18 2010 +0300 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "mceaudiostream.h" +#include "mcemanager.h" +#include "mceaudiocodec.h" +#include "mcesession.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMceAudioStream::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMceAudioStream* CMceAudioStream::NewL() + { + CMceAudioStream* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMceAudioStream::NewLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMceAudioStream* CMceAudioStream::NewLC() + { + CMceAudioStream* self = new (ELeave) CMceAudioStream(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CMceAudioStream::~CMceAudioStream +// ----------------------------------------------------------------------------- +// +EXPORT_C CMceAudioStream::~CMceAudioStream() + { + iCodecs.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CMceAudioStream::Codecs +// ----------------------------------------------------------------------------- +// +EXPORT_C const RPointerArray& CMceAudioStream::Codecs() + { + return iCodecs; + } + +// ----------------------------------------------------------------------------- +// CMceAudioStream::AddCodecL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMceAudioStream::AddCodecL(CMceAudioCodec* aCodec) + { + __ASSERT_ALWAYS(aCodec, User::Leave(KErrArgument)); + iCodecs.AppendL(aCodec); + } + +// ----------------------------------------------------------------------------- +// CMceAudioStream::RemoveCodecL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMceAudioStream::RemoveCodecL(CMceAudioCodec& aCodec) + { + for(int i = 0; i < iCodecs.Count(); i++ ) + { + if( iCodecs[i] == &aCodec ) + { + delete iCodecs[i]; + iCodecs.Remove( i ); + } + } + } + +// ----------------------------------------------------------------------------- +// CMceAudioStream::CMceAudioStream +// ----------------------------------------------------------------------------- +// +CMceAudioStream::CMceAudioStream() + :CMceMediaStream() + { + iType = KMceAudio; + } + + +// ----------------------------------------------------------------------------- +// CMceAudioStream::ConstructL +// ----------------------------------------------------------------------------- +// +void CMceAudioStream::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CMceAudioStream::InitializeL +// ----------------------------------------------------------------------------- +// +void CMceAudioStream::InitializeL( CMceSession& aParent ) + { + + CMceMediaStream::InitializeL( aParent ); + + InitializeL( &aParent.Manager() ); + + for( TInt i = 0; i < iCodecs.Count(); i++ ) + { + iCodecs[i]->InitializeL( *this ); + } + } + + +// ----------------------------------------------------------------------------- +// CMceAudioStream::InitializeL +// ----------------------------------------------------------------------------- +// +void CMceAudioStream::InitializeL( CMceManager* aManager ) + { + CMceMediaStream::InitializeL( aManager ); + if ( aManager && iCodecs.Count() == 0 ) + { + const RPointerArray supportedCodes = + aManager->SupportedAudioCodecs(); + for( TInt i = 0; i < supportedCodes.Count(); i++ ) + { + CMceAudioCodec* codec = supportedCodes[i]->CloneL(); + CleanupStack::PushL( codec ); + iCodecs.AppendL( codec ); + CleanupStack::Pop( codec ); + } + + } + + } + + + +